1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
|
# GNU Solfege - free ear training software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Tom Cato Amundsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import gobject, gtk
import gu, mpd
import configureoutput
import notenamespinbutton
from instrumentselector import nInstrumentSelector, InstrumentConfigurator
import cfg
import osutils
import soundcard
import languages
import filesystem
if sys.platform == 'win32':
try:
from soundcard import winmidi
except ImportError, e:
print "Loading winmidi.pyd failed:"
print e
winmidi = None
def find_wav_player_programs():
ret = []
for p, cmd in (('/usr/bin/play', '/usr/bin/play %s'),
('/usr/bin/aplay', '/usr/bin/aplay %s'),
('/usr/bin/esdplay', '/usr/bin/esdplay %s')):
if os.path.exists(p):
ret.append(cmd)
return ret
def find_midi_player_programs():
for p, cmd in (('/usr/bin/timidity', '/usr/bin/timidity -idqq %s'),
('/usr/bin/drvmidi', '/usr/bin/drvmidi'),
('/usr/bin/playmidi', '/usr/bin/playmidi')):
if os.path.exists(p):
yield cmd
class ConfigWindow(gtk.Dialog, cfg.ConfigUtils):
def on_destroy(self, widget, e):
self.m_app.m_ui.g_config_window.destroy()
self.m_app.m_ui.g_config_window = None
def __init__(self, app):
gtk.Dialog.__init__(self, _("GNU Solfege Preferences"),
app.m_ui, 0,
(gtk.STOCK_HELP, gtk.RESPONSE_HELP, gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
cfg.ConfigUtils.__init__(self, 'configwindow')
self.connect('response', self.apply_and_close)
# We do this so that the window is only hidden when the
# user click on the close button provided by the window manager.
self.connect('delete-event', self.on_destroy)#lambda w, e: True)
self.set_default_size(400, 400)
self.m_app = app
self.g_notebook = gtk.Notebook()
self.vbox.pack_start(self.g_notebook)
########
# midi #
########
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("Midi")))
vbox, category_vbox = gu.hig_category_vbox(_("Tempo"))
page_vbox.pack_start(vbox, False)
sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
self.g_default_bpm = gu.nSpinButton('config', 'default_bpm',
gtk.Adjustment(self.get_int('config/default_bpm'), 10, 500, 1, 10))
box = gu.hig_label_widget(_("_Default bpm:"), self.g_default_bpm, sizegroup)
category_vbox.pack_start(box, False)
self.g_arpeggio_bpm = gu.nSpinButton('config', 'arpeggio_bpm',
gtk.Adjustment(self.get_int('config/arpeggio_bpm'), 10, 500, 1, 10))
box = gu.hig_label_widget(_("A_rpeggio bpm:"), self.g_arpeggio_bpm, sizegroup)
category_vbox.pack_start(box, False)
box, category_vbox = gu.hig_category_vbox(_("Preferred instrument"))
page_vbox.pack_start(box, False)
self.g_instrsel = nInstrumentSelector('config',
'preferred_instrument', sizegroup)
category_vbox.pack_start(self.g_instrsel, False)
box, category_vbox = gu.hig_category_vbox(_("Chord instruments"))
page_vbox.pack_start(box, False)
self.g_instrument_configurator \
= InstrumentConfigurator("config", 3,
_("Use different instruments for chords and harmonic intervals."))
category_vbox.pack_start(self.g_instrument_configurator, False)
vbox, category_box = gu.hig_category_vbox(_("Preferred percussion instruments"))
page_vbox.pack_start(vbox, False)
category_box.pack_start(gu.hig_label_widget(
_("Count in:"),
gu.PercussionNameComboBoxEntry("config", "countin_perc", "Claves"),
sizegroup))
category_box.pack_start(gu.hig_label_widget(
_("Rhythm:"),
gu.PercussionNameComboBoxEntry("config", "rhythm_perc", "Side Stick"),
sizegroup))
########
# user #
########
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("User")))
box, category_vbox = gu.hig_category_vbox(_("User's voice"))
page_vbox.pack_start(box, False)
sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
self.g_highest_singable = notenamespinbutton.NotenameSpinButton(
self.get_string('user/highest_pitch'))
box = gu.hig_label_widget(_("Highest note user can sing:"),
self.g_highest_singable,
sizegroup)
category_vbox.pack_start(box)
self.g_lowest_singable = notenamespinbutton.NotenameSpinButton(
self.get_string('user/lowest_pitch'))
box = gu.hig_label_widget(_("Lowest note user can sing:"),
self.g_lowest_singable,
sizegroup)
category_vbox.pack_start(box)
notenamespinbutton.nNotenameRangeController(
self.g_lowest_singable, self.g_highest_singable,
mpd.LOWEST_NOTENAME, mpd.HIGHEST_NOTENAME,
'user', 'lowest_pitch', 'highest_pitch')
box, category_vbox = gu.hig_category_vbox(_("Sex"))
page_vbox.pack_start(box, False)
self.g_sex_male = gtk.RadioButton(None, _("_Male"))
self.g_sex_male.connect('toggled', lambda w: self.set_string('user/sex', 'male'))
category_vbox.pack_start(self.g_sex_male, False)
self.g_sex_female = gtk.RadioButton(self.g_sex_male, _("_Female or child"))
self.g_sex_female.connect('toggled', lambda w: self.set_string('user/sex', 'female'))
category_vbox.pack_start(self.g_sex_female, False)
if self.get_string('user/sex') == 'female':
self.g_sex_female.set_active(True)
#####################
# external programs #
#####################
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("External programs")))
box, category_vbox = gu.hig_category_vbox(_("Convertors"))
page_vbox.pack_start(box, False)
sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
# midi_to_wav
liststore = gtk.ListStore(gobject.TYPE_STRING)
liststore.append(("/usr/bin/timidity -Ow %(in)s -o %(out)s",))
self.g_wav_convertor = gtk.ComboBoxEntry(liststore)
self.g_wav_convertor.child.set_text(
self.get_string("app/midi_to_wav_cmd"))
self.g_wav_convertor.connect('changed',
lambda w: self.set_string('app/midi_to_wav_cmd', w.child.get_text()))
category_vbox.pack_start(
gu.hig_label_widget(_("MIDI to WAV convertor:"),
self.g_wav_convertor, sizegroup))
# wav_to_mp3
liststore = gtk.ListStore(gobject.TYPE_STRING)
liststore.append(("/usr/bin/lame %(in)s %(out)s",))
self.g_mp3_convertor = gtk.ComboBoxEntry(liststore)
self.g_mp3_convertor.child.set_text(
self.get_string("app/wav_to_mp3_cmd"))
self.g_mp3_convertor.connect('changed',
lambda w: self.set_string('app/wav_to_mp3_cmd', w.child.get_text()))
category_vbox.pack_start(
gu.hig_label_widget(_("WAV to MP3 convertor:"),
self.g_mp3_convertor, sizegroup))
# wav_to_ogg
liststore = gtk.ListStore(gobject.TYPE_STRING)
liststore.append(("/usr/bin/oggenc %(in)s",))
self.g_ogg_convertor = gtk.ComboBoxEntry(liststore)
self.g_ogg_convertor.child.set_text(
self.get_string("app/wav_to_ogg_cmd"))
self.g_ogg_convertor.connect('changed',
lambda w: self.set_string('app/wav_to_ogg_cmd', w.child.get_text()))
category_vbox.pack_start(
gu.hig_label_widget(_("WAV to OGG convertor:"),
self.g_ogg_convertor, sizegroup))
self.add_gui_for_external_programs(page_vbox)
box, category_vbox = gu.hig_category_vbox(_("Misc"))
page_vbox.pack_start(box, False)
liststore = gtk.ListStore(gobject.TYPE_STRING)
for n in ("xterm -e mutt", "thunderbird"):
liststore.append((n,))
self.g_mail_program = gtk.ComboBoxEntry(liststore)
self.g_mail_program.child.set_text(self.get_string("config/mua"))
self.g_mail_program.child.connect('changed', lambda w: self.set_string('config/mua', self.g_mail_program.child.get_text()))
box = gu.hig_label_widget(_("_Mail program:"), self.g_mail_program, sizegroup)
category_vbox.pack_start(box)
#######
# Gui #
#######
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("Gui")))
box, category_vbox = gu.hig_category_vbox(_("Gui"))
page_vbox.pack_start(box, False)
self.g_mainwin_user_resizeable = gu.nCheckButton('gui',
'mainwin_user_resizeable', _("_User resizeable main window"))
category_vbox.pack_start(self.g_mainwin_user_resizeable, False)
# Combobox to select language
hbox = gtk.HBox()
hbox.set_spacing(6)
label = gtk.Label()
label.set_text_with_mnemonic(_("Select _language:"))
hbox.pack_start(label, False)
self.g_language = gtk.combo_box_new_text()
for n in languages.languages:
self.g_language.append_text(n)
label.set_mnemonic_widget(self.g_language)
if sys.platform == 'win32':
lang = self.m_app.win32_get_langenviron()
if lang in languages.languages:
idx = languages.languages.index(lang)
else:
idx = 0
else:
if cfg.get_string('app/lc_messages') in languages.languages:
idx = languages.languages.index(cfg.get_string('app/lc_messages'))
else:
idx = 0
self.g_language.set_active(idx)
def f(combobox):
cfg.set_string('app/lc_messages', languages.languages[combobox.get_active()])
if sys.platform == 'win32':
if combobox.get_active():
lang = languages.languages[combobox.get_active()]
app.win32_put_langenviron(lang)
else:
app.win32_put_langenviron(None)
self.g_language.connect_after('changed', f)
hbox.pack_start(self.g_language, False)
category_vbox.pack_start(hbox)
l = gtk.Label(_("You have to restart the program for the language change to take effect."))
l.set_alignment(0.0, 0.5)
category_vbox.pack_start(l)
############
# Practise #
############
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("Practise")))
box, category_vbox = gu.hig_category_vbox(_("Practise"))
page_vbox.pack_start(box, False)
self.g_picky_on_new_question = gu.nCheckButton('config', 'picky_on_new_question', _("_Not allow new question before the old is solved"))
category_vbox.pack_start(self.g_picky_on_new_question, False)
self.g_autorepeat_if_wrong = gu.nCheckButton('config', 'auto_repeat_question_if_wrong_answer', _("_Repeat question if the answer was wrong"))
category_vbox.pack_start(self.g_autorepeat_if_wrong, False)
self.g_expert_mode = gu.nCheckButton('gui',
'expert_mode', _("E_xpert mode"))
self.g_expert_mode.connect('toggled', self.m_app.reset_exercise)
category_vbox.pack_start(self.g_expert_mode, False)
#########
# sound #
#########
if sys.platform == 'win32':
self.create_win32_sound_page()
else:
self.create_linux_sound_page()
self.show_all()
def add_gui_for_external_programs(self, page_vbox):
box, category_vbox = gu.hig_category_vbox(_("Audio players"))
page_vbox.pack_start(box, False)
if sys.platform != 'win32':
format_info = [
{'id': 'wav',
# testfile is a file in lesson-files/share
'testfile': 'fifth-small-220.00.wav',
'label': _("WAV file player"),
# players is a tuple of tuples. The inner tuple has to elements:
# '/path/to/player', 'comandline'
'players': (('/usr/bin/play', '/usr/bin/play %s'),
('/usr/bin/aplay', '/usr/bin/aplay %s'),
('/usr/bin/esdplay', '/usr/bin/esdplay %s'),
),
}
]
else:
format_info = []
format_info.extend([
{'id': 'midi',
'testfile': 'fanfare.midi',
'label': _("MIDI file player"),
'players': (('/usr/bin/timidity', '/usr/bin/timidity -idqq %s'),
('/usr/bin/drvmidi', '/usr/bin/drvmidi'),
('/usr/bin/playmidi', '/usr/bin/playmidi'),
),
},
{'id': 'mp3',
'testfile': 'fanfare.mp3',
'label': _("MP3 file player"),
'players': (('/usr/bin/mpg123', '/usr/bin/mpg123'),
('/usr/bin/alsaplayer', '/usr/bin/alsaplayer'),
),
},
{'id': 'ogg',
'testfile': 'fanfare.ogg',
'label': _("OGG file player"),
'players': (('/usr/bin/ogg123', '/usr/bin/ogg123'),
('/usr/bin/alsaplayer', '/usr/bin/alsaplayer'),
),
},
])
self.g_player_boxes = {}
sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
for format in format_info:
liststore = gtk.ListStore(gobject.TYPE_STRING)
for path, cmd in format['players']:
if os.path.exists(path):
liststore.append((cmd,))
self.g_player_boxes[format['id']] = gtk.ComboBoxEntry(liststore)
self.g_player_boxes[format['id']].child.set_text(cfg.get_string('sound/%s_player' % format['id']))
def _changed(widget, formatid):
self.set_string('sound/%s_player' % formatid,
widget.child.get_text())
self.g_player_boxes[format['id']].connect('changed',
_changed, format['id'])
button = gtk.Button(_("Test"))
button.connect('clicked', self.test_XXX_player,
format['id'], format['testfile'])
box = gu.hig_label_widget(format['label'],
[self.g_player_boxes[format['id']], button],
sizegroup)
category_vbox.pack_start(box)
def test_XXX_player(self, w, typeid, testfile):
osutils.run_external_program(self.g_player_boxes[typeid].child.get_text(),
'lesson-files/share', testfile)
def create_linux_sound_page(self):
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("Sound setup")))
#############
# midi setup
#############
box, category_vbox = gu.hig_category_vbox(_("Midi setup"))
page_vbox.pack_start(box)
self.g_fakesynth_radio = gu.RadioButton(None, _("_No sound"), None)
category_vbox.pack_start(self.g_fakesynth_radio, False)
hbox = gu.bHBox(category_vbox, False)
self.g_device_radio = gu.RadioButton(self.g_fakesynth_radio,
_("Use _device"), None)
hbox.pack_start(self.g_device_radio, False)
liststore = gtk.ListStore(gobject.TYPE_STRING)
for s in ('/dev/sequencer', '/dev/sequencer2', '/dev/music'):
liststore.append((s,))
self.g_device_file = gtk.ComboBoxEntry(liststore)
self.g_device_file.child.set_text(self.get_string('sound/device_file'))
self.g_synth_num = gtk.SpinButton(gtk.Adjustment(0, 0, 100, 1, 1),
digits=0)
self.g_synth_num.set_value(self.get_int('sound/synth_number'))
hbox.pack_start(self.g_device_file, False)
hbox.pack_start(self.g_synth_num, False)
# checkbox to enable awe support
hbox = gtk.HBox()
category_vbox.pack_start(hbox, False)
hbox.pack_start(gtk.Label(" "))
self.g_awe_checkbutton = gtk.CheckButton(_("_My sound card is Sound Blaster AWE32, AWE64 or pnp32"))
self.g_awe_checkbutton.set_active(self.get_string('sound/card_info') == 'awe')
if not configureoutput.HAVE_LINUX_AWE_VOICE_H:
self.g_awe_checkbutton.set_sensitive(False)
else:
self.g_awe_checkbutton.set_sensitive(self.get_string("sound/type") == "sequencer-device")
hbox.pack_start(self.g_awe_checkbutton, False)
###
hbox = gu.bHBox(category_vbox, False)
self.g_midiplayer_radio = gu.RadioButton(self.g_fakesynth_radio,
_("Use _external midiplayer"), None)
hbox.pack_start(self.g_midiplayer_radio, False)
if self.get_string("sound/type") == "external-midiplayer":
self.g_midiplayer_radio.set_active(True)
elif self.get_string("sound/type") == "sequencer-device":
self.g_device_radio.set_active(True)
else:
self.g_fakesynth_radio.set_active(True)
hbox = gtk.HButtonBox()
category_vbox.pack_start(hbox)
gu.bButton(category_vbox, _("_Apply changes and play test sound"), self.on_apply_and_play_test_sound)
self.g_device_radio.connect('toggled', lambda w: self.g_awe_checkbutton.set_sensitive(w.get_active()))
def create_win32_sound_page(self):
page_vbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(page_vbox, gtk.Label(_("Midi setup")))
#############
# midi setup
#############
box, category_vbox = gu.hig_category_vbox(_("Sound setup"))
page_vbox.pack_start(box)
txt = gtk.Label(_("""Solfege has two ways to play midi files. It is recommended to use Windows multimedia output. An external midiplayer can be useful if your soundcard lacks a hardware synth, in which case you have to use a program like timidity to play the music."""))
txt.set_line_wrap(1)
txt.set_justify(gtk.JUSTIFY_FILL)
txt.set_alignment(0.0, 0.0)
category_vbox.pack_start(txt, False)
self.g_fakesynth_radio = gu.RadioButton(None, _("_No sound"), None)
category_vbox.pack_start(self.g_fakesynth_radio, False)
hbox = gu.bHBox(category_vbox, False)
self.g_device_radio = gu.RadioButton(self.g_fakesynth_radio,
_("_Windows multimedia output:"), None)
self.g_synth = gtk.combo_box_new_text()
if winmidi:
for devname in winmidi.output_devices():
#FIXME workaround of the bug
# http://code.google.com/p/solfege/issues/detail?id=12
if devname is None:
self.g_synth.append_text("FIXME bug #12")
else:
self.g_synth.append_text(devname)
self.g_synth.set_active(self.get_int('sound/synth_number') + 1)
hbox.pack_start(self.g_device_radio, False)
hbox.pack_start(self.g_synth, False)
hbox = gu.bHBox(category_vbox, False)
self.g_midiplayer_radio = gu.RadioButton(self.g_fakesynth_radio,
_("Use _external midiplayer"), None)
hbox.pack_start(self.g_midiplayer_radio, False)
if self.get_string("sound/type") == "external-midiplayer":
self.g_midiplayer_radio.set_active(True)
elif self.get_string("sound/type") == "winsynth":
self.g_device_radio.set_active(True)
else:
self.g_fakesynth_radio.set_active(True)
gu.bButton(category_vbox, _("_Apply changes and play test sound"), self.on_apply_and_play_test_sound)
def set_gui_from_config(self):
if self.get_string("sound/type") == "fake-synth":
self.g_fakesynth_radio.set_active(True)
elif self.get_string("sound/type") == "external-midiplayer":
self.g_midiplayer_radio.set_active(True)
else:
assert self.get_string("sound/type") in ("winsynth", "sequencer-device")
self.g_device_radio.set_active(True)
return -1
def apply_and_close(self, w, response):
if response == gtk.RESPONSE_DELETE_EVENT:
self.set_gui_from_config()
elif response == gtk.RESPONSE_HELP:
self.m_app.handle_href("preferences-window.html")
return
else:
if self.on_apply() == -1:
self.set_gui_from_config()
return
self.hide()
def on_apply_and_play_test_sound(self, *w):
if self.on_apply() != -1:
self.set_gui_from_config()
self.play_midi_test_sound()
def play_midi_test_sound(self):
try:
mpd.play_music(r"""
\staff\relative c{
c16 e g c e, g c e g, c e g c4
}
\staff{
c4 e g8 e c4
}
""", 130, 0, 100)
except Exception, e:
if isinstance(e, osutils.OsUtilsException):
self.m_app.m_ui.display_exception_message(e)
else:
raise
def on_apply(self, *v):
"""Returns -1 if sound init fails."""
card_info = ""
if soundcard.synth:
soundcard.synth.close()
if self.g_midiplayer_radio.get_active():
soundcard.initialise_external_midiplayer(
self.g_player_boxes['midi'].child.get_text())
soundcard.synth.error_report_cb = self.m_app.m_ui.display_error_message
elif self.g_device_radio.get_active():
if sys.platform != 'win32' and configureoutput.HAVE_LINUX_AWE_VOICE_H and \
self.g_awe_checkbutton.get_active():
card_info = "awe"
else:
card_info = ""
try:
if sys.platform == 'win32':
soundcard.initialise_winsynth(self.g_synth.get_active() - 1)
else:
soundcard.initialise_devicefile(
self.g_device_file.child.get_text(),
self.g_synth_num.get_value_as_int(),
card_info)
except (soundcard.SoundInitException, OSError, ImportError), e:
self.m_app.display_sound_init_error_message(e)
return -1
else: # no sound
assert self.g_fakesynth_radio.get_active()
soundcard.initialise_using_fake_synth(0)
if self.g_midiplayer_radio.get_active():
self.set_string("sound/type", "external-midiplayer")
elif self.g_device_radio.get_active():
if sys.platform == "win32":
self.set_string("sound/type", "winsynth")
else:
self.set_string("sound/type", "sequencer-device")
else:
assert self.g_fakesynth_radio.get_active()
self.set_string("sound/type", "fake-synth")
if sys.platform != 'win32':
self.set_string("sound/device_file", self.g_device_file.child.get_text())
self.set_string("sound/card_info", card_info)
if soundcard.synth.m_type_major not in ('Midifile', 'Fake'):
self.set_int("sound/synth_number", soundcard.synth.m_devnum)
# we set the spin just in case m_devnum was changed by the
# soundcard setup code, if it was out of range
if sys.platform != 'win32':
self.g_synth_num.set_value(soundcard.synth.m_devnum)
else:
self.g_synth.set_active(soundcard.synth.m_devnum + 1)
|