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 self.mixer.midi_behavior_mode = value
260 def on_delete_event(self, widget, event):
263 def sighandler(self, signum, frame):
264 #print "Signal %d received" % signum
265 if signum == signal.SIGUSR1:
267 elif signum == signal.SIGTERM:
269 elif signum == signal.SIGINT:
272 print("Unknown signal %d received" % signum)
275 print("Cleaning jack_mixer")
279 for channel in self.channels:
284 def on_open_cb(self, *args):
285 dlg = Gtk.FileChooserDialog(title='Open', parent=self.window,
286 action=Gtk.FileChooserAction.OPEN)
287 dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
288 Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
289 dlg.set_default_response(Gtk.ResponseType.OK)
290 if dlg.run() == Gtk.ResponseType.OK:
291 filename = dlg.get_filename()
293 f = open(filename, 'r')
294 self.load_from_xml(f)
295 except Exception as e:
296 err = Gtk.MessageDialog(parent = self.window,
298 message_type = Gtk.MessageType.ERROR,
299 buttons = Gtk.ButtonsType.OK,
300 text = "Failed loading settings (%s)." % str(e))
304 self.current_filename = filename
309 def on_save_cb(self, *args):
310 if not self.current_filename:
311 return self.on_save_as_cb()
312 f = open(self.current_filename, 'w')
316 def on_save_as_cb(self, *args):
317 dlg = Gtk.FileChooserDialog(title='Save', parent=self.window,
318 action=Gtk.FileChooserAction.SAVE)
319 dlg.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
320 Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
321 dlg.set_default_response(Gtk.ResponseType.OK)
322 if dlg.run() == Gtk.ResponseType.OK:
323 self.current_filename = dlg.get_filename()
327 def on_quit_cb(self, *args):
330 preferences_dialog = None
331 def on_preferences_cb(self, widget):
332 if not self.preferences_dialog:
333 self.preferences_dialog = PreferencesDialog(self)
334 self.preferences_dialog.show()
335 self.preferences_dialog.present()
337 def on_add_input_channel(self, widget):
338 dialog = NewChannelDialog(app=self)
339 dialog.set_transient_for(self.window)
344 if ret == Gtk.ResponseType.OK:
345 result = dialog.get_result()
346 channel = self.add_channel(**result)
348 self.window.show_all()
350 def on_add_output_channel(self, widget):
351 dialog = NewOutputChannelDialog(app=self)
352 dialog.set_transient_for(self.window)
357 if ret == Gtk.ResponseType.OK:
358 result = dialog.get_result()
359 channel = self.add_output_channel(**result)
361 self.window.show_all()
363 def on_edit_input_channel(self, widget, channel):
364 print('Editing channel "%s"' % channel.channel_name)
365 channel.on_channel_properties()
367 def remove_channel_edit_input_menuitem_by_label(self, widget, label):
368 if (widget.get_label() == label):
369 self.channel_edit_input_menu.remove(widget)
371 def on_remove_input_channel(self, widget, channel):
372 print('Removing channel "%s"' % channel.channel_name)
373 self.channel_remove_input_menu.remove(widget)
374 self.channel_edit_input_menu.foreach(
375 self.remove_channel_edit_input_menuitem_by_label,
376 channel.channel_name);
377 if self.monitored_channel is channel:
378 channel.monitor_button.set_active(False)
379 for i in range(len(self.channels)):
380 if self.channels[i] is channel:
383 self.hbox_inputs.remove(channel.get_parent())
385 if len(self.channels) == 0:
386 self.channel_remove_input_menu_item.set_sensitive(False)
388 def on_edit_output_channel(self, widget, channel):
389 print('Editing channel "%s"' % channel.channel_name)
390 channel.on_channel_properties()
392 def remove_channel_edit_output_menuitem_by_label(self, widget, label):
393 if (widget.get_label() == label):
394 self.channel_edit_output_menu.remove(widget)
396 def on_remove_output_channel(self, widget, channel):
397 print('Removing channel "%s"' % channel.channel_name)
398 self.channel_remove_output_menu.remove(widget)
399 self.channel_edit_output_menu.foreach(
400 self.remove_channel_edit_output_menuitem_by_label,
401 channel.channel_name);
402 if self.monitored_channel is channel:
403 channel.monitor_button.set_active(False)
404 for i in range(len(self.channels)):
405 if self.output_channels[i] is channel:
407 del self.output_channels[i]
408 self.hbox_outputs.remove(channel.get_parent())
410 if len(self.output_channels) == 0:
411 self.channel_remove_output_menu_item.set_sensitive(False)
413 def rename_channels(self, container, parameters):
414 if (container.get_label() == parameters['oldname']):
415 container.set_label(parameters['newname'])
417 def on_channel_rename(self, oldname, newname):
418 rename_parameters = { 'oldname' : oldname, 'newname' : newname }
419 self.channel_edit_input_menu.foreach(self.rename_channels,
421 self.channel_edit_output_menu.foreach(self.rename_channels,
423 self.channel_remove_input_menu.foreach(self.rename_channels,
425 self.channel_remove_output_menu.foreach(self.rename_channels,
427 print("Renaming channel from %s to %s\n" % (oldname, newname))
430 def on_channels_clear(self, widget):
431 for channel in self.output_channels:
433 self.hbox_outputs.remove(channel.get_parent())
434 for channel in self.channels:
436 self.hbox_inputs.remove(channel.get_parent())
438 self.output_channels = []
439 self.channel_edit_input_menu = Gtk.Menu()
440 self.channel_edit_input_menu_item.set_submenu(self.channel_edit_input_menu)
441 self.channel_edit_input_menu_item.set_sensitive(False)
442 self.channel_remove_input_menu = Gtk.Menu()
443 self.channel_remove_input_menu_item.set_submenu(self.channel_remove_input_menu)
444 self.channel_remove_input_menu_item.set_sensitive(False)
445 self.channel_edit_output_menu = Gtk.Menu()
446 self.channel_edit_output_menu_item.set_submenu(self.channel_edit_output_menu)
447 self.channel_edit_output_menu_item.set_sensitive(False)
448 self.channel_remove_output_menu = Gtk.Menu()
449 self.channel_remove_output_menu_item.set_submenu(self.channel_remove_output_menu)
450 self.channel_remove_output_menu_item.set_sensitive(False)
452 def add_channel(self, name, stereo, volume_cc, balance_cc, mute_cc, solo_cc):
454 channel = InputChannel(self, name, stereo)
455 self.add_channel_precreated(channel)
457 e = sys.exc_info()[0]
458 err = Gtk.MessageDialog(self.window,
459 Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
460 Gtk.MessageType.ERROR,
462 "Channel creation failed")
467 channel.channel.volume_midi_cc = volume_cc
469 channel.channel.autoset_volume_midi_cc()
471 channel.channel.balance_midi_cc = balance_cc
473 channel.channel.autoset_balance_midi_cc()
475 channel.channel.mute_midi_cc = mute_cc
477 channel.channel.autoset_mute_midi_cc()
479 channel.channel.solo_midi_cc = solo_cc
481 channel.channel.autoset_solo_midi_cc()
484 def add_channel_precreated(self, channel):
487 self.hbox_inputs.pack_start(frame, False, True, 0)
490 channel_edit_menu_item = Gtk.MenuItem(label=channel.channel_name)
491 self.channel_edit_input_menu.append(channel_edit_menu_item)
492 channel_edit_menu_item.connect("activate", self.on_edit_input_channel, channel)
493 self.channel_edit_input_menu_item.set_sensitive(True)
495 channel_remove_menu_item = Gtk.MenuItem(label=channel.channel_name)
496 self.channel_remove_input_menu.append(channel_remove_menu_item)
497 channel_remove_menu_item.connect("activate", self.on_remove_input_channel, channel)
498 self.channel_remove_input_menu_item.set_sensitive(True)
500 self.channels.append(channel)
502 for outputchannel in self.output_channels:
503 channel.add_control_group(outputchannel)
505 # create post fader output channel matching the input channel
506 channel.post_fader_output_channel = self.mixer.add_output_channel(
507 channel.channel.name + ' Out', channel.channel.is_stereo, True)
508 channel.post_fader_output_channel.volume = 0
509 channel.post_fader_output_channel.set_solo(channel.channel, True)
511 def read_meters(self):
512 for channel in self.channels:
514 for channel in self.output_channels:
518 def midi_events_check(self):
519 for channel in self.channels + self.output_channels:
520 channel.midi_events_check()
523 def add_output_channel(self, name, stereo, volume_cc, balance_cc, mute_cc,
524 display_solo_buttons, color):
526 channel = OutputChannel(self, name, stereo)
527 channel.display_solo_buttons = display_solo_buttons
528 channel.color = color
529 self.add_output_channel_precreated(channel)
531 err = Gtk.MessageDialog(self.window,
532 Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
533 Gtk.MessageType.ERROR,
535 "Channel creation failed")
541 channel.channel.volume_midi_cc = volume_cc
543 channel.channel.autoset_volume_midi_cc()
545 channel.channel.balance_midi_cc = balance_cc
547 channel.channel.autoset_balance_midi_cc()
549 channel.channel.mute_midi_cc = mute_cc
551 channel.channel.autoset_mute_midi_cc()
555 def add_output_channel_precreated(self, channel):
558 self.hbox_outputs.pack_start(frame, False, True, 0)
561 channel_edit_menu_item = Gtk.MenuItem(label=channel.channel_name)
562 self.channel_edit_output_menu.append(channel_edit_menu_item)
563 channel_edit_menu_item.connect("activate", self.on_edit_output_channel, channel)
564 self.channel_edit_output_menu_item.set_sensitive(True)
566 channel_remove_menu_item = Gtk.MenuItem(label=channel.channel_name)
567 self.channel_remove_output_menu.append(channel_remove_menu_item)
568 channel_remove_menu_item.connect("activate", self.on_remove_output_channel, channel)
569 self.channel_remove_output_menu_item.set_sensitive(True)
571 self.output_channels.append(channel)
573 _monitored_channel = None
574 def get_monitored_channel(self):
575 return self._monitored_channel
577 def set_monitored_channel(self, channel):
578 if self._monitored_channel:
579 if channel.channel.name == self._monitored_channel.channel.name:
581 self._monitored_channel = channel
582 if type(channel) is InputChannel:
583 # reset all solo/mute settings
584 for in_channel in self.channels:
585 self.monitor_channel.set_solo(in_channel.channel, False)
586 self.monitor_channel.set_muted(in_channel.channel, False)
587 self.monitor_channel.set_solo(channel.channel, True)
588 self.monitor_channel.prefader = True
590 self.monitor_channel.prefader = False
591 self.update_monitor(channel)
592 monitored_channel = property(get_monitored_channel, set_monitored_channel)
594 def update_monitor(self, channel):
595 if self.monitored_channel is not channel:
597 self.monitor_channel.volume = channel.channel.volume
598 self.monitor_channel.balance = channel.channel.balance
599 self.monitor_channel.out_mute = channel.channel.out_mute
600 if type(self.monitored_channel) is OutputChannel:
601 # sync solo/muted channels
602 for input_channel in self.channels:
603 self.monitor_channel.set_solo(input_channel.channel,
604 channel.channel.is_solo(input_channel.channel))
605 self.monitor_channel.set_muted(input_channel.channel,
606 channel.channel.is_muted(input_channel.channel))
608 def get_input_channel_by_name(self, name):
609 for input_channel in self.channels:
610 if input_channel.channel.name == name:
614 def on_about(self, *args):
615 about = Gtk.AboutDialog()
616 about.set_name('jack_mixer')
617 about.set_copyright('Copyright © 2006-2020\nNedko Arnaudov, Frederic Peters, Arnout Engelen, Daniel Sheeler')
618 about.set_license('''\
619 jack_mixer is free software; you can redistribute it and/or modify it
620 under the terms of the GNU General Public License as published by the
621 Free Software Foundation; either version 2 of the License, or (at your
622 option) any later version.
624 jack_mixer is distributed in the hope that it will be useful, but
625 WITHOUT ANY WARRANTY; without even the implied warranty of
626 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
627 General Public License for more details.
629 You should have received a copy of the GNU General Public License along
630 with jack_mixer; if not, write to the Free Software Foundation, Inc., 51
631 Franklin Street, Fifth Floor, Boston, MA 02110-130159 USA''')
632 about.set_authors(['Nedko Arnaudov <nedko@arnaudov.name>',
633 'Frederic Peters <fpeters@0d.be>',
634 'Daniel Sheeler <dsheeler@pobox.com>'])
635 about.set_logo_icon_name('jack_mixer')
636 about.set_website('https://rdio.space/jackmixer/')
641 def save_to_xml(self, file):
642 #print "Saving to XML..."
643 b = XmlSerialization()
648 def load_from_xml(self, file, silence_errors=False):
649 #print "Loading from XML..."
650 self.on_channels_clear(None)
651 self.unserialized_channels = []
652 b = XmlSerialization()
660 s.unserialize(self, b)
661 for channel in self.unserialized_channels:
662 if isinstance(channel, InputChannel):
663 if self._init_solo_channels and channel.channel_name in self._init_solo_channels:
665 self.add_channel_precreated(channel)
666 self._init_solo_channels = None
667 for channel in self.unserialized_channels:
668 if isinstance(channel, OutputChannel):
669 self.add_output_channel_precreated(channel)
670 del self.unserialized_channels
672 self.window.show_all()
674 def serialize(self, object_backend):
675 width, height = self.window.get_size()
676 object_backend.add_property('geometry',
677 '%sx%s' % (width, height))
679 for input_channel in self.channels:
680 if input_channel.channel.solo:
681 solo_channels.append(input_channel)
683 object_backend.add_property('solo_channels', '|'.join([x.channel.name for x in solo_channels]))
684 object_backend.add_property('visible', '%s' % str(self.visible))
686 def unserialize_property(self, name, value):
687 if name == 'geometry':
688 width, height = value.split('x')
689 self.window.resize(int(width), int(height))
691 if name == 'solo_channels':
692 self._init_solo_channels = value.split('|')
694 if name == 'visible':
695 self.visible = value == 'True'
698 def unserialize_child(self, name):
699 if name == InputChannel.serialization_name():
700 channel = InputChannel(self, "", True)
701 self.unserialized_channels.append(channel)
704 if name == OutputChannel.serialization_name():
705 channel = OutputChannel(self, "", True)
706 self.unserialized_channels.append(channel)
709 if name == gui.Factory.serialization_name():
710 self.gui_factory = gui.Factory(self.window, self.meter_scales, self.slider_scales)
711 self.gui_factory.connect('midi-behavior-mode-changed', self.on_midi_behavior_mode_changed)
712 return self.gui_factory
714 def serialization_get_childs(self):
715 '''Get child objects that required and support serialization'''
716 childs = self.channels[:] + self.output_channels[:] + [self.gui_factory]
719 def serialization_name(self):
727 self.window.show_all()
729 signal.signal(signal.SIGUSR1, self.sighandler)
730 signal.signal(signal.SIGTERM, self.sighandler)
731 signal.signal(signal.SIGINT, self.sighandler)
732 signal.signal(signal.SIGHUP, signal.SIG_IGN)
736 #f = file("/dev/stdout", "w")
741 parser = ArgumentParser()
742 parser.add_argument('-c', '--config', help='use a non default configuration file')
743 parser.add_argument('client_name', metavar='NAME', nargs='?', default='jack_mixer',
744 help='set JACK client name')
745 args = parser.parse_args()
748 mixer = JackMixer(args.client_name)
749 except Exception as e:
750 err = Gtk.MessageDialog(parent = None,
752 message_type = Gtk.MessageType.ERROR,
753 buttons = Gtk.ButtonsType.OK,
754 text = "Mixer creation failed (%s)" % str(e))
759 if not mixer.nsm_client and args.config:
760 f = open(args.config)
761 mixer.current_filename = args.config
764 mixer.load_from_xml(f)
765 except Exception as e:
766 err = Gtk.MessageDialog(parent = mixer.window,
768 message_type = Gtk.MessageType.ERROR,
769 buttons = Gtk.ButtonsType.OK,
770 text = "Failed loading settings (%s)." % str(e))
773 mixer.window.set_default_size(60*(1+len(mixer.channels)+len(mixer.output_channels)), 300)
780 if __name__ == "__main__":