Forget about the canvas patchbay, I'll work that later
[klaudia.git] / patches / jack-mixer_8.diff
blob8e6060e36fe3c00f2234fd0c7fc0bad41fd0f2d8
1 --- jack-mixer-8.orig/jack_mixer.py
2 +++ jack-mixer-8/jack_mixer.py
3 @@ -1,5 +1,5 @@
4 #!/usr/bin/env python
5 -# -*- coding: UTF-8 -*-
6 +# -*- coding: utf-8 -*-
8 # This file is part of jack_mixer
10 @@ -25,6 +25,7 @@
11 import gobject
12 import sys
13 import os
14 +import signal
16 try:
17 import lash
18 @@ -67,6 +68,8 @@
19 return
20 self.monitor_channel = self.mixer.add_output_channel("Monitor", True, True)
22 + self.save = False
24 if lash_client:
25 # Send our client name to server
26 lash_event = lash.lash_event_new_with_type(lash.LASH_Client_Name)
27 @@ -186,8 +189,18 @@
28 gobject.timeout_add(80, self.read_meters)
29 self.lash_client = lash_client
31 - if lash_client:
32 - gobject.timeout_add(1000, self.lash_check_events)
33 + gobject.timeout_add(200, self.lash_check_events)
35 + def sighandler(self, signum, frame):
36 + #print "Signal %d received" % signum
37 + if signum == signal.SIGUSR1:
38 + self.save = True
39 + elif signum == signal.SIGTERM:
40 + gtk.main_quit()
41 + elif signum == signal.SIGINT:
42 + gtk.main_quit()
43 + else:
44 + print "Unknown signal %d received" % signum
46 def cleanup(self):
47 print "Cleaning jack_mixer"
48 @@ -473,6 +486,19 @@
49 about.destroy()
51 def lash_check_events(self):
52 + if self.save:
53 + self.save = False
54 + if self.current_filename:
55 + print "saving on SIGUSR1 request"
56 + self.on_save_cb()
57 + print "save done"
58 + else:
59 + print "not saving because filename is not known"
60 + return True
62 + if not self.lash_client:
63 + return True
65 while lash.lash_get_pending_event_count(self.lash_client):
66 event = lash.lash_get_event(self.lash_client)
68 @@ -578,6 +604,10 @@
70 self.window.show_all()
72 + signal.signal(signal.SIGUSR1, self.sighandler)
73 + signal.signal(signal.SIGTERM, self.sighandler)
74 + signal.signal(signal.SIGINT, self.sighandler)
76 gtk.main()
78 #f = file("/dev/stdout", "w")
79 @@ -607,7 +637,8 @@
81 # Yeah , this sounds stupid, we connected earlier, but we dont want to show this if we got --help option
82 # This issue should be fixed in pylash, there is a reason for having two functions for initialization after all
83 - if lash_client:
84 + lash_connection = lash.lash_get_server_name(lash_client)
85 + if lash_connection:
86 print "Successfully connected to LASH server at " + lash.lash_get_server_name(lash_client)
88 if len(args) == 1:
89 @@ -618,7 +649,7 @@
90 if not name:
91 name = "jack_mixer-%u" % os.getpid()
93 - gtk.gdk.threads_init()
94 + #gtk.gdk.threads_init() # if this function is called, when SIGUSR1 is received, we enter tight loop...
95 try:
96 mixer = JackMixer(name, lash_client)
97 except Exception, e: