2 # -*- coding: utf-8 -*-
4 # This file is part of jack_mixer
6 # Copyright (C) 2006-2009 Nedko Arnaudov <nedko@arnaudov.name>
7 # Copyright (C) 2009 Frederic Peters <fpeters@0d.be>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25 from argparse import ArgumentParser
28 gi.require_version('Gtk', '3.0')
29 from gi.repository import Gtk
30 from gi.repository import GObject
31 from gi.repository import GLib
33 # temporary change Python modules lookup path to look into installation
34 # directory ($prefix/share/jack_mixer/)
36 sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '..', 'share', 'jack_mixer'))
44 from preferences import PreferencesDialog
46 from serialization_xml import XmlSerialization
47 from serialization import SerializedObject, Serializator
49 from nsmclient import NSMClient
51 # restore Python modules lookup path
54 class JackMixer(SerializedObject):
56 # scales suitable as meter scales
57 meter_scales = [scale.IEC268(), scale.Linear70dB(), scale.IEC268Minimalistic()]
59 # scales suitable as volume slider scales
60 slider_scales = [scale.Linear30dB(), scale.Linear70dB()]
62 # name of settngs file that is currently open
63 current_filename = None
65 _init_solo_channels = None
67 def __init__(self, client_name='jack_mixer'):
69 self.nsm_client = None
71 if os.environ.get('NSM_URL'):
72 self.nsm_client = NSMClient(prettyName = "jack_mixer",
73 saveCallback = self.nsm_save_cb,
74 openOrNewCallback = self.nsm_open_cb,
75 supportsSaveStatus = False,
76 hideGUICallback = self.nsm_hide_cb,
77 showGUICallback = self.nsm_show_cb,
78 exitProgramCallback = self.nsm_exit_cb,
79 loggingLevel = "error",
81 self.nsm_client.announceGuiVisibility(self.visible)
85 self.create_mixer(client_name, with_nsm = False)
87 def create_mixer(self, client_name, with_nsm = True):
88 self.create_ui(with_nsm)
89 self.mixer = jack_mixer_c.Mixer(client_name)
93 #self.mixer.midi_behavior_mode = self.gui_factory.midi_behavior_modes[self.gui_factory.get_midi_behavior_mode()]
95 self.window.set_title(client_name)
97 self.monitor_channel = self.mixer.add_output_channel("Monitor", True, True)
100 GLib.timeout_add(80, self.read_meters)
102 GLib.timeout_add(200, self.nsm_react)
103 GLib.timeout_add(50, self.midi_events_check)
105 def create_ui(self, with_nsm):
107 self.output_channels = []
108 self.window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
109 self.window.set_icon_name('jack_mixer')
110 self.gui_factory = gui.Factory(self.window, self.meter_scales, self.slider_scales)
111 self.gui_factory.connect('midi-behavior-mode-changed', self.on_midi_behavior_mode_changed)
112 self.vbox_top = Gtk.VBox()
113 self.window.add(self.vbox_top)
115 self.menubar = Gtk.MenuBar()
116 self.vbox_top.pack_start(self.menubar, False, True, 0)
118 mixer_menu_item = Gtk.MenuItem.new_with_mnemonic("_Mixer")
119 self.menubar.append(mixer_menu_item)
120 edit_menu_item = Gtk.MenuItem.new_with_mnemonic('_Edit')
121 self.menubar.append(edit_menu_item)
122 help_menu_item = Gtk.MenuItem.new_with_mnemonic('_Help')
123 self.menubar.append(help_menu_item)
125 self.window.set_default_size(120, 300)
127 self.mixer_menu = Gtk.Menu()
128 mixer_menu_item.set_submenu(self.mixer_menu)
130 add_input_channel = Gtk.MenuItem.new_with_mnemonic('New _Input Channel')
131 self.mixer_menu.append(add_input_channel)
132 add_input_channel.connect("activate", self.on_add_input_channel)
134 add_output_channel = Gtk.MenuItem.new_with_mnemonic('New _Output Channel')
135 self.mixer_menu.append(add_output_channel)
136 add_output_channel.connect("activate", self.on_add_output_channel)
138 self.mixer_menu.append(Gtk.SeparatorMenuItem())
140 open = Gtk.MenuItem.new_with_mnemonic('_Open')
141 self.mixer_menu.append(open)
142 open.connect('activate', self.on_open_cb)
143 save = Gtk.MenuItem.new_with_mnemonic('_Save')
144 self.mixer_menu.append(save)
145 save.connect('activate', self.on_save_cb)
147 save_as = Gtk.MenuItem.new_with_mnemonic('Save_As')
148 self.mixer_menu.append(save_as)
149 save_as.connect('activate', self.on_save_as_cb)
151 self.mixer_menu.append(Gtk.SeparatorMenuItem())
153 quit = Gtk.MenuItem.new_with_mnemonic('_Quit')
154 self.mixer_menu.append(quit)
155 quit.connect('activate', self.on_quit_cb)
157 edit_menu = Gtk.Menu()
158 edit_menu_item.set_submenu(edit_menu)
160 self.channel_edit_input_menu_item = Gtk.MenuItem.new_with_mnemonic('_Edit Input Channel')
161 edit_menu.append(self.channel_edit_input_menu_item)
162 self.channel_edit_input_menu = Gtk.Menu()
163 self.channel_edit_input_menu_item.set_submenu(self.channel_edit_input_menu)
165 self.channel_edit_output_menu_item = Gtk.MenuItem.new_with_mnemonic('Edit _Output Channel')
166 edit_menu.append(self.channel_edit_output_menu_item)
167 self.channel_edit_output_menu = Gtk.Menu()
168 self.channel_edit_output_menu_item.set_submenu(self.channel_edit_output_menu)
170 self.channel_remove_input_menu_item = Gtk.MenuItem.new_with_mnemonic('Remove _Input Channel')
171 edit_menu.append(self.channel_remove_input_menu_item)
172 self.channel_remove_input_menu = Gtk.Menu()
173 self.channel_remove_input_menu_item.set_submenu(self.channel_remove_input_menu)
175 self.channel_remove_output_menu_item = Gtk.MenuItem.new_with_mnemonic('_Remove Output Channel')
176 edit_menu.append(self.channel_remove_output_menu_item)
177 self.channel_remove_output_menu = Gtk.Menu()
178 self.channel_remove_output_menu_item.set_submenu(self.channel_remove_output_menu)
180 channel_remove_all_menu_item = Gtk.MenuItem.new_with_mnemonic('Clear')
181 edit_menu.append(channel_remove_all_menu_item)
182 channel_remove_all_menu_item.connect("activate", self.on_channels_clear)
184 edit_menu.append(Gtk.SeparatorMenuItem())
186 preferences = Gtk.MenuItem.new_with_mnemonic('_Preferences')
187 preferences.connect('activate', self.on_preferences_cb)
188 edit_menu.append(preferences)
190 help_menu = Gtk.Menu()
191 help_menu_item.set_submenu(help_menu)
193 about = Gtk.MenuItem.new_with_mnemonic('_About')
194 help_menu.append(about)
195 about.connect("activate", self.on_about)
197 self.hbox_top = Gtk.HBox()
198 self.vbox_top.pack_start(self.hbox_top, True, True, 0)
200 self.scrolled_window = Gtk.ScrolledWindow()
201 self.hbox_top.pack_start(self.scrolled_window, True, True, 0)
203 self.hbox_inputs = Gtk.HBox()
204 self.hbox_inputs.set_spacing(0)
205 self.hbox_inputs.set_border_width(0)
206 self.hbox_top.set_spacing(0)
207 self.hbox_top.set_border_width(0)
209 self.scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
210 self.scrolled_window.add(self.hbox_inputs)
212 self.hbox_outputs = Gtk.HBox()
213 self.hbox_outputs.set_spacing(0)
214 self.hbox_outputs.set_border_width(0)
216 self.hbox_outputs.pack_start(frame, False, True, 0)
217 self.hbox_top.pack_start(self.hbox_outputs, False, True, 0)
219 self.window.connect("destroy", Gtk.main_quit)
221 self.window.connect('delete-event', self.on_delete_event)
224 self.nsm_client.reactToMessage()
227 def nsm_hide_cb(self):
230 self.nsm_client.announceGuiVisibility(False)
232 def nsm_show_cb(self):
233 self.window.show_all()
235 self.nsm_client.announceGuiVisibility(True)
237 def nsm_open_cb(self, path, session_name, client_name):
238 self.create_mixer(client_name, with_nsm = True)
239 self.current_filename = path + '.xml'
240 if os.path.isfile(self.current_filename):
241 f = open(self.current_filename, 'r')
242 self.load_from_xml(f)
245 f = open(self.current_filename, 'w')
248 def nsm_save_cb(self, path, session_name, client_name):
249 self.current_filename = path + '.xml'
250 f = open(self.current_filename, 'w')
254 def nsm_exit_cb(self, path, session_name, client_name):
257 def on_midi_behavior_mode_changed(self, gui_factory, value):
258 print('on_midi_behavior_mode_changed', value)
259 self.mixer.midi_behavior_mode = value
261 def on_delete_event(self, widget, event):
264 def sighandler(self, signum, frame):
265 #print "Signal %d received" % signum
266 if signum == signal.SIGUSR1:
268 elif signum == signal.SIGTERM:
270 elif signum == signal.SIGINT:
273 print("Unknown signal %d received" % signum)
276 print("Cleaning jack_mixer")
280 for channel in self.channels:
285 def on_open_cb(self, *args):
286 dlg = Gtk.FileChooserDialog(title='Open', parent=self.window,
287 action=Gtk.FileChooserAction.OPEN,
288 buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
289 Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
290 dlg.set_default_response(Gtk.ResponseType.OK)
291 if dlg.run() == Gtk.ResponseType.OK:
292 filename = dlg.get_filename()
294 f = open(filename, 'r')
295 self.load_from_xml(f)
297 err = Gtk.MessageDialog(self.window,
298 Gtk.DialogFlags.MODAL,
299 Gtk.MessageType.ERROR,
301 "Failed loading settings.")
305 self.current_filename = filename
310 def on_save_cb(self, *args):
311 if not self.current_filename:
312 return self.on_save_as_cb()
313 f = open(self.current_filename, 'w')
317 def on_save_as_cb(self, *args):
318 dlg = Gtk.FileChooserDialog(title='Save', parent=self.window,
319 action=Gtk.FileChooserAction.SAVE,
320 buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
321 Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
322 dlg.set_default_response(Gtk.ResponseType.OK)
323 if dlg.run() == Gtk.ResponseType.OK:
324 self.current_filename = dlg.get_filename()
328 def on_quit_cb(self, *args):
331 preferences_dialog = None
332 def on_preferences_cb(self, widget):
333 if not self.preferences_dialog:
334 self.preferences_dialog = PreferencesDialog(self)
335 self.preferences_dialog.show()
336 self.preferences_dialog.present()
338 def on_add_input_channel(self, widget):
339 dialog = NewChannelDialog(app=self)
340 dialog.set_transient_for(self.window)
345 if ret == Gtk.ResponseType.OK:
346 result = dialog.get_result()
347 channel = self.add_channel(**result)
349 self.window.show_all()
351 def on_add_output_channel(self, widget):
352 dialog = NewOutputChannelDialog(app=self)
353 dialog.set_transient_for(self.window)
358 if ret == Gtk.ResponseType.OK:
359 result = dialog.get_result()
360 channel = self.add_output_channel(**result)
362 self.window.show_all()
364 def on_edit_input_channel(self, widget, channel):
365 print('Editing channel "%s"' % channel.channel_name)
366 channel.on_channel_properties()
368 def remove_channel_edit_input_menuitem_by_label(self, widget, label):
369 if (widget.get_label() == label):
370 self.channel_edit_input_menu.remove(widget)
372 def on_remove_input_channel(self, widget, channel):
373 print('Removing channel "%s"' % channel.channel_name)
374 self.channel_remove_input_menu.remove(widget)
375 self.channel_edit_input_menu.foreach(
376 self.remove_channel_edit_input_menuitem_by_label,
377 channel.channel_name);
378 if self.monitored_channel is channel:
379 channel.monitor_button.set_active(False)
380 for i in range(len(self.channels)):
381 if self.channels[i] is channel:
384 self.hbox_inputs.remove(channel.get_parent())
386 if len(self.channels) == 0:
387 self.channel_remove_input_menu_item.set_sensitive(False)
389 def on_edit_output_channel(self, widget, channel):
390 print('Editing channel "%s"' % channel.channel_name)
391 channel.on_channel_properties()
393 def remove_channel_edit_output_menuitem_by_label(self, widget, label):
394 if (widget.get_label() == label):
395 self.channel_edit_output_menu.remove(widget)
397 def on_remove_output_channel(self, widget, channel):
398 print('Removing channel "%s"' % channel.channel_name)
399 self.channel_remove_output_menu.remove(widget)
400 self.channel_edit_output_menu.foreach(
401 self.remove_channel_edit_output_menuitem_by_label,
402 channel.channel_name);
403 if self.monitored_channel is channel:
404 channel.monitor_button.set_active(False)
405 for i in range(len(self.channels)):
406 if self.output_channels[i] is channel:
408 del self.output_channels[i]
409 self.hbox_outputs.remove(channel.get_parent())
411 if len(self.output_channels) == 0:
412 self.channel_remove_output_menu_item.set_sensitive(False)
414 def rename_channels(self, container, parameters):
415 if (container.get_label() == parameters['oldname']):
416 container.set_label(parameters['newname'])
418 def on_channel_rename(self, oldname, newname):
419 rename_parameters = { 'oldname' : oldname, 'newname' : newname }
420 self.channel_edit_input_menu.foreach(self.rename_channels,
422 self.channel_edit_output_menu.foreach(self.rename_channels,
424 self.channel_remove_input_menu.foreach(self.rename_channels,
426 self.channel_remove_output_menu.foreach(self.rename_channels,
428 print("Renaming channel from %s to %s\n" % (oldname, newname))
431 def on_channels_clear(self, widget):
432 for channel in self.output_channels:
434 self.hbox_outputs.remove(channel.get_parent())
435 for channel in self.channels:
437 self.hbox_inputs.remove(channel.get_parent())
439 self.output_channels = []
440 self.channel_edit_input_menu = Gtk.Menu()
441 self.channel_edit_input_menu_item.set_submenu(self.channel_edit_input_menu)
442 self.channel_edit_input_menu_item.set_sensitive(False)
443 self.channel_remove_input_menu = Gtk.Menu()
444 self.channel_remove_input_menu_item.set_submenu(self.channel_remove_input_menu)
445 self.channel_remove_input_menu_item.set_sensitive(False)
446 self.channel_edit_output_menu = Gtk.Menu()
447 self.channel_edit_output_menu_item.set_submenu(self.channel_edit_output_menu)
448 self.channel_edit_output_menu_item.set_sensitive(False)
449 self.channel_remove_output_menu = Gtk.Menu()
450 self.channel_remove_output_menu_item.set_submenu(self.channel_remove_output_menu)
451 self.channel_remove_output_menu_item.set_sensitive(False)
453 def add_channel(self, name, stereo, volume_cc, balance_cc, mute_cc, solo_cc):
455 channel = InputChannel(self, name, stereo)
456 self.add_channel_precreated(channel)
458 e = sys.exc_info()[0]
459 err = Gtk.MessageDialog(self.window,
460 Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
461 Gtk.MessageType.ERROR,
463 "Channel creation failed")
468 channel.channel.volume_midi_cc = volume_cc
470 channel.channel.autoset_volume_midi_cc()
472 channel.channel.balance_midi_cc = balance_cc
474 channel.channel.autoset_balance_midi_cc()
476 channel.channel.mute_midi_cc = mute_cc
478 channel.channel.autoset_mute_midi_cc()
480 channel.channel.solo_midi_cc = solo_cc
482 channel.channel.autoset_solo_midi_cc()
485 def add_channel_precreated(self, channel):
488 self.hbox_inputs.pack_start(frame, False, True, 0)
491 channel_edit_menu_item = Gtk.MenuItem(label=channel.channel_name)
492 self.channel_edit_input_menu.append(channel_edit_menu_item)
493 channel_edit_menu_item.connect("activate", self.on_edit_input_channel, channel)
494 self.channel_edit_input_menu_item.set_sensitive(True)
496 channel_remove_menu_item = Gtk.MenuItem(label=channel.channel_name)
497 self.channel_remove_input_menu.append(channel_remove_menu_item)
498 channel_remove_menu_item.connect("activate", self.on_remove_input_channel, channel)
499 self.channel_remove_input_menu_item.set_sensitive(True)
501 self.channels.append(channel)
503 for outputchannel in self.output_channels:
504 channel.add_control_group(outputchannel)
506 # create post fader output channel matching the input channel
507 channel.post_fader_output_channel = self.mixer.add_output_channel(
508 channel.channel.name + ' Out', channel.channel.is_stereo, True)
509 channel.post_fader_output_channel.volume = 0
510 channel.post_fader_output_channel.set_solo(channel.channel, True)
512 def read_meters(self):
513 for channel in self.channels:
515 for channel in self.output_channels:
519 def midi_events_check(self):
520 for channel in self.channels + self.output_channels:
521 channel.midi_events_check()
524 def add_output_channel(self, name, stereo, volume_cc, balance_cc, mute_cc,
525 display_solo_buttons, color):
527 channel = OutputChannel(self, name, stereo)
528 channel.display_solo_buttons = display_solo_buttons
529 channel.color = color
530 self.add_output_channel_precreated(channel)
532 err = Gtk.MessageDialog(self.window,
533 Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
534 Gtk.MessageType.ERROR,
536 "Channel creation failed")
542 channel.channel.volume_midi_cc = volume_cc
544 channel.channel.autoset_volume_midi_cc()
546 channel.channel.balance_midi_cc = balance_cc
548 channel.channel.autoset_balance_midi_cc()
550 channel.channel.mute_midi_cc = mute_cc
552 channel.channel.autoset_mute_midi_cc()
556 def add_output_channel_precreated(self, channel):
559 self.hbox_outputs.pack_start(frame, False, True, 0)
562 channel_edit_menu_item = Gtk.MenuItem(label=channel.channel_name)
563 self.channel_edit_output_menu.append(channel_edit_menu_item)
564 channel_edit_menu_item.connect("activate", self.on_edit_output_channel, channel)
565 self.channel_edit_output_menu_item.set_sensitive(True)
567 channel_remove_menu_item = Gtk.MenuItem(label=channel.channel_name)
568 self.channel_remove_output_menu.append(channel_remove_menu_item)
569 channel_remove_menu_item.connect("activate", self.on_remove_output_channel, channel)
570 self.channel_remove_output_menu_item.set_sensitive(True)
572 self.output_channels.append(channel)
574 _monitored_channel = None
575 def get_monitored_channel(self):
576 return self._monitored_channel
578 def set_monitored_channel(self, channel):
579 if self._monitored_channel:
580 if channel.channel.name == self._monitored_channel.channel.name:
582 self._monitored_channel = channel
583 if type(channel) is InputChannel:
584 # reset all solo/mute settings
585 for in_channel in self.channels:
586 self.monitor_channel.set_solo(in_channel.channel, False)
587 self.monitor_channel.set_muted(in_channel.channel, False)
588 self.monitor_channel.set_solo(channel.channel, True)
589 self.monitor_channel.prefader = True
591 self.monitor_channel.prefader = False
592 self.update_monitor(channel)
593 monitored_channel = property(get_monitored_channel, set_monitored_channel)
595 def update_monitor(self, channel):
596 if self.monitored_channel is not channel:
598 self.monitor_channel.volume = channel.channel.volume
599 self.monitor_channel.balance = channel.channel.balance
600 self.monitor_channel.out_mute = channel.channel.out_mute
601 if type(self.monitored_channel) is OutputChannel:
602 # sync solo/muted channels
603 for input_channel in self.channels:
604 self.monitor_channel.set_solo(input_channel.channel,
605 channel.channel.is_solo(input_channel.channel))
606 self.monitor_channel.set_muted(input_channel.channel,
607 channel.channel.is_muted(input_channel.channel))
609 def get_input_channel_by_name(self, name):
610 for input_channel in self.channels:
611 if input_channel.channel.name == name:
615 def on_about(self, *args):
616 about = Gtk.AboutDialog()
617 about.set_name('jack_mixer')
618 about.set_copyright('Copyright © 2006-2020\nNedko Arnaudov, Frederic Peters, Arnout Engelen, Daniel Sheeler')
619 about.set_license('''\
620 jack_mixer is free software; you can redistribute it and/or modify it
621 under the terms of the GNU General Public License as published by the
622 Free Software Foundation; either version 2 of the License, or (at your
623 option) any later version.
625 jack_mixer is distributed in the hope that it will be useful, but
626 WITHOUT ANY WARRANTY; without even the implied warranty of
627 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
628 General Public License for more details.
630 You should have received a copy of the GNU General Public License along
631 with jack_mixer; if not, write to the Free Software Foundation, Inc., 51
632 Franklin Street, Fifth Floor, Boston, MA 02110-130159 USA''')
633 about.set_authors(['Nedko Arnaudov <nedko@arnaudov.name>',
634 'Frederic Peters <fpeters@0d.be>',
635 'Daniel Sheeler <dsheeler@pobox.com>'])
636 about.set_logo_icon_name('jack_mixer')
637 about.set_website('https://rdio.space/jackmixer/')
642 def save_to_xml(self, file):
643 #print "Saving to XML..."
644 b = XmlSerialization()
649 def load_from_xml(self, file, silence_errors=False):
650 #print "Loading from XML..."
651 self.on_channels_clear(None)
652 self.unserialized_channels = []
653 b = XmlSerialization()
661 s.unserialize(self, b)
662 for channel in self.unserialized_channels:
663 if isinstance(channel, InputChannel):
664 if self._init_solo_channels and channel.channel_name in self._init_solo_channels:
666 self.add_channel_precreated(channel)
667 self._init_solo_channels = None
668 for channel in self.unserialized_channels:
669 if isinstance(channel, OutputChannel):
670 self.add_output_channel_precreated(channel)
671 del self.unserialized_channels
673 self.window.show_all()
675 def serialize(self, object_backend):
676 width, height = self.window.get_size()
677 object_backend.add_property('geometry',
678 '%sx%s' % (width, height))
680 for input_channel in self.channels:
681 if input_channel.channel.solo:
682 solo_channels.append(input_channel)
684 object_backend.add_property('solo_channels', '|'.join([x.channel.name for x in solo_channels]))
685 object_backend.add_property('visible', '%s' % str(self.visible))
687 def unserialize_property(self, name, value):
688 if name == 'geometry':
689 width, height = value.split('x')
690 self.window.resize(int(width), int(height))
692 if name == 'solo_channels':
693 self._init_solo_channels = value.split('|')
695 if name == 'visible':
696 self.visible = value == 'True'
699 def unserialize_child(self, name):
700 if name == InputChannel.serialization_name():
701 channel = InputChannel(self, "", True)
702 self.unserialized_channels.append(channel)
705 if name == OutputChannel.serialization_name():
706 channel = OutputChannel(self, "", True)
707 self.unserialized_channels.append(channel)
710 if name == gui.Factory.serialization_name():
711 self.gui_factory = gui.Factory(self.window, self.meter_scales, self.slider_scales)
712 self.gui_factory.connect('midi-behavior-mode-changed', self.on_midi_behavior_mode_changed)
713 return self.gui_factory
715 def serialization_get_childs(self):
716 '''Get child objects that required and support serialization'''
717 childs = self.channels[:] + self.output_channels[:] + [self.gui_factory]
720 def serialization_name(self):
728 self.window.show_all()
730 signal.signal(signal.SIGUSR1, self.sighandler)
731 signal.signal(signal.SIGTERM, self.sighandler)
732 signal.signal(signal.SIGINT, self.sighandler)
733 signal.signal(signal.SIGHUP, signal.SIG_IGN)
737 #f = file("/dev/stdout", "w")
742 parser = ArgumentParser()
743 parser.add_argument('-c', '--config', help='use a non default configuration file')
744 parser.add_argument('client_name', metavar='NAME', nargs='?', default='jack_mixer',
745 help='set JACK client name')
746 args = parser.parse_args()
749 mixer = JackMixer(args.client_name)
750 except Exception as e:
751 err = Gtk.MessageDialog(None,
752 Gtk.DialogFlags.MODAL,
753 Gtk.MessageType.ERROR,
755 "Mixer creation failed (%s)" % str(e))
760 if not mixer.nsm_client and args.config:
761 f = open(args.config)
762 mixer.current_filename = args.config
765 mixer.load_from_xml(f)
767 err = Gtk.MessageDialog(mixer.window,
768 Gtk.DialogFlags.MODAL,
769 Gtk.MessageType.ERROR,
771 "Failed loading settings.")
774 mixer.window.set_default_size(60*(1+len(mixer.channels)+len(mixer.output_channels)), 300)
781 if __name__ == "__main__":