Make note length configurable

This commit is contained in:
Gergely Polonkai 2016-06-09 21:40:53 +02:00
parent 1350b39b13
commit d9f2fa1d7f
2 changed files with 48 additions and 8 deletions

View File

@ -158,6 +158,7 @@ class GitSoundWindow(object):
self.skip_spin = self.builder.get_object('skip-spin') self.skip_spin = self.builder.get_object('skip-spin')
self.scale_combo = self.builder.get_object('scale-combo') self.scale_combo = self.builder.get_object('scale-combo')
self.chooser_button = self.builder.get_object('repo-chooser') self.chooser_button = self.builder.get_object('repo-chooser')
self.notelen_spin = self.builder.get_object('notelen-spin')
self.gitmidi = None self.gitmidi = None
@ -291,6 +292,7 @@ class GitSoundWindow(object):
scale_selected = self.scale_combo.get_active_id() scale_selected = self.scale_combo.get_active_id()
skip = int(self.skip_spin.get_value()) skip = int(self.skip_spin.get_value())
vol_deviation = int(self.vol_spin.get_value()) vol_deviation = int(self.vol_spin.get_value())
notelen = self.notelen_spin.get_value()
self.set_status("Generating data") self.set_status("Generating data")
self.progressbar.set_fraction(0.0) self.progressbar.set_fraction(0.0)
@ -301,7 +303,8 @@ class GitSoundWindow(object):
scale=SCALES[scale_selected][1], scale=SCALES[scale_selected][1],
program=PROGRAMS[program_selected], program=PROGRAMS[program_selected],
volume_range=vol_deviation, volume_range=vol_deviation,
skip=skip) skip=skip,
note_duration=notelen)
self.gitmidi.gen_repo_data(callback=self.genrepo_cb) self.gitmidi.gen_repo_data(callback=self.genrepo_cb)
self.gitmidi.generate_midi(callback=self.genrepo_cb) self.gitmidi.generate_midi(callback=self.genrepo_cb)

View File

@ -35,6 +35,13 @@
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
</object> </object>
<object class="GtkAdjustment" id="notelen-adjustment">
<property name="lower">0.1</property>
<property name="upper">10.0</property>
<property name="step_increment">0.1</property>
<property name="page_increment">1</property>
<property name="value">0.3</property>
</object>
<object class="GtkWindow" id="main-window"> <object class="GtkWindow" id="main-window">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title" translatable="yes">Git Sound</property> <property name="title" translatable="yes">Git Sound</property>
@ -110,7 +117,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">6</property> <property name="top_attach">7</property>
<property name="width">1</property> <property name="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -128,7 +135,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">6</property> <property name="top_attach">7</property>
<property name="width">1</property> <property name="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -146,7 +153,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="top_attach">6</property> <property name="top_attach">7</property>
<property name="width">1</property> <property name="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -159,7 +166,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">7</property> <property name="top_attach">8</property>
<property name="width">3</property> <property name="width">3</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -232,7 +239,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">8</property> <property name="top_attach">9</property>
<property name="width">4</property> <property name="width">4</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -245,7 +252,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="top_attach">7</property> <property name="top_attach">8</property>
<property name="width">1</property> <property name="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
@ -278,6 +285,36 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="notelen-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Note length</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="notelen-spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">0.3</property>
<property name="adjustment">notelen-adjustment</property>
<property name="value">0.3</property>
<property name="digits">1</property>
<signal name="value-changed" handler="settings_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="vol-label"> <object class="GtkLabel" id="vol-label">
<property name="visible">True</property> <property name="visible">True</property>
@ -320,7 +357,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="top_attach">6</property> <property name="top_attach">7</property>
<property name="width">1</property> <property name="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>