Merge lp:~michael-sheldon/jokosher/pulse_fixes into lp:jokosher

Proposed by Michael Sheldon
Status: Merged
Merged at revision: not available
Proposed branch: lp:~michael-sheldon/jokosher/pulse_fixes
Merge into: lp:jokosher
Diff against target: 92 lines (+20/-9)
3 files modified
Jokosher/AudioBackend.py (+12/-5)
Jokosher/Instrument.py (+1/-1)
Jokosher/Project.py (+7/-3)
To merge this branch: bzr merge lp:~michael-sheldon/jokosher/pulse_fixes
Reviewer Review Type Date Requested Status
Jokosher Code Pending
Review via email: mp+22841@code.launchpad.net

Description of the change

Fixes some problems with multichannel recording and works around some bugs in pulsesrc.

To post a comment you must log in.
1110. By Michael Sheldon

Allow other events to continue while waiting for gstreamer async operation to complete

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Jokosher/AudioBackend.py'
2--- Jokosher/AudioBackend.py 2009-03-22 18:31:29 +0000
3+++ Jokosher/AudioBackend.py 2010-04-05 22:38:23 +0000
4@@ -10,7 +10,8 @@
5 #
6 #-------------------------------------------------------------------------------
7
8-import gst, gobject
9+import gst, gtk, gobject
10+import time
11 import Globals
12
13 #=========================================================================
14@@ -63,16 +64,22 @@
15 if gobject.type_is_a(element, gst.interfaces.PropertyProbe):
16 element.probe_property_name("device")
17 devices = element.probe_get_values_name("device")
18-
19- if not default_device in devices:
20+
21+ if (default_device != None) and (default_device not in devices):
22 dev_info_list.append((default_device, ""))
23
24 if probe_name and hasattr(element.props, "device-name"):
25 for dev in devices:
26 element.set_property("device", dev)
27
28- element.set_state(gst.STATE_PAUSED)
29- # certain elements like pulsesrc won't load the device-name until STATE_PAUSED
30+ # certain elements like pulsesrc won't load the device-name until STATE_PLAYING
31+ state_change_type = element.set_state(gst.STATE_PLAYING)
32+ if state_change_type == gst.STATE_CHANGE_ASYNC:
33+ new_state = None
34+ while new_state != gst.STATE_PLAYING and new_state != gst.STATE_READY:
35+ gtk.main_iteration()
36+ state_change_type, new_state, pending = element.get_state(0)
37+ time.sleep(0.01)
38 name = element.get_property("device-name")
39 element.set_state(gst.STATE_NULL)
40
41
42=== modified file 'Jokosher/Instrument.py'
43--- Jokosher/Instrument.py 2009-04-04 23:06:39 +0000
44+++ Jokosher/Instrument.py 2010-04-05 22:38:23 +0000
45@@ -119,7 +119,7 @@
46 self.id = project.GenerateUniqueID(id) #check is id is already being used before setting
47
48 self.input = None # the device to use for recording on this instrument.
49- self.inTrack = -1 # Input track to record from if device is multichannel.
50+ self.inTrack = 0 # Input track to record from if device is multichannel.
51
52 # CREATE GSTREAMER ELEMENTS #
53 self.playbackbin = gst.element_factory_make("bin", "Instrument_%d"%self.id)
54
55=== modified file 'Jokosher/Project.py'
56--- Jokosher/Project.py 2009-06-08 12:42:25 +0000
57+++ Jokosher/Project.py 2010-04-05 22:38:23 +0000
58@@ -315,6 +315,7 @@
59 devices[default_device].append(instr)
60
61
62+ recbin = 0
63 for device, recInstruments in devices.iteritems():
64 if len(recInstruments) == 0:
65 #Nothing to record on this device
66@@ -329,11 +330,13 @@
67
68
69 if channelsNeeded > 1: #We're recording from a multi-input device
70- recordingbin = gst.Bin("recording bin")
71+ #Need multiple recording bins with unique names when we're
72+ #recording from multiple devices
73+ recordingbin = gst.Bin("recordingbin_%d" % recbin)
74 recordString = Globals.settings.recording["audiosrc"]
75 srcBin = gst.parse_bin_from_description(recordString, True)
76 try:
77- src_element = recordingbin.iterate_sources().next()
78+ src_element = srcBin.iterate_sources().next()
79 except StopIteration:
80 pass
81 else:
82@@ -370,8 +373,9 @@
83
84 split.connect("pad-added", self.__RecordingPadAddedCb, recInstruments, recordingbin)
85 Globals.debug("Recording in multi-input mode")
86- Globals.debug("adding recordingbin")
87+ Globals.debug("adding recordingbin_%d" % recbin)
88 self.mainpipeline.add(recordingbin)
89+ recbin += 1
90 else:
91 instr = recInstruments[0]
92 event = instr.GetRecordingEvent()

Subscribers

People subscribed via source and target branches