[jokosher-devel] Fix for critical bug?



Attached possible fix for critical bug 69714

-- 
John Green
Index: Project.py
===================================================================
--- Project.py	(revision 937)
+++ Project.py	(working copy)
@@ -552,6 +552,7 @@
 				self.recordingEvents[instr] = (event, recordingbin)
 				Globals.debug("Recording in single-input mode")
 
+		self.SetInstrumentEffects()
 		self.mainpipeline.add(recordingbin)
 
 		#Make sure we start playing from the beginning
@@ -572,7 +573,39 @@
 		# [/DEBUG]
 				
 	#_____________________________________________________________________
+	
+	def SetInstrumentEffects(self):
+		for ins in self.instruments:
+			ins.PrepareController()
+			if ins.effectsbin_obsolete == 1:
+				self.mainpipeline.set_state(gst.STATE_NULL)
+				Globals.debug("Unlinking obsolete effects bin")
+				ins.converterElement.unlink(ins.effectsbin)
+				ins.effectsbin.unlink(ins.volumeElement)
+				
+				effpads = list(ins.effectsbin.pads())
+				for p in effpads:
+					ins.effectsbin.remove_pad(p)
+				
+				elements = list(ins.effectsbin)
+				ins.effectsbin.remove_many(*elements)						
+				ins.effectsbin_obsolete = 0
+				
+			if ins.effects:
+				Globals.debug("there are effects")
+				Globals.debug("pipeline is NULL or ready, gonna prepare effects bin")
+				ins.PrepareEffectsBin()
+				ins.converterElement.link(ins.effectsbin)
+				ins.effectsbin.link(ins.volumeElement)
+			else:
+				Globals.debug("there are no effects")
+				try:
+					ins.converterElement.link(ins.volumeElement)
+				except:
+					pass
 
+	#_____________________________________________________________________
+	
 	def state_changed(self, bus, message, movePlayhead=True):
 		""" Handler for GStreamer statechange events. 
 		"""
@@ -592,36 +625,8 @@
 		
 		if len(self.instruments) > 0:
 			Globals.debug("play() in Project.py")
+			self.SetInstrumentEffects()
 
-			for ins in self.instruments:
-				ins.PrepareController()
-				if ins.effectsbin_obsolete == 1:
-					self.mainpipeline.set_state(gst.STATE_NULL)
-					Globals.debug("Unlinking obsolete effects bin")
-					ins.converterElement.unlink(ins.effectsbin)
-					ins.effectsbin.unlink(ins.volumeElement)
-					
-					effpads = list(ins.effectsbin.pads())
-					for p in effpads:
-						ins.effectsbin.remove_pad(p)
-					
-					elements = list(ins.effectsbin)
-					ins.effectsbin.remove_many(*elements)						
-					ins.effectsbin_obsolete = 0
-					
-				if ins.effects:
-					Globals.debug("there are effects")
-					Globals.debug("pipeline is NULL or ready, gonna prepare effects bin")
-					ins.PrepareEffectsBin()
-					ins.converterElement.link(ins.effectsbin)
-					ins.effectsbin.link(ins.volumeElement)
-				else:
-					Globals.debug("there are no effects")
-					try:
-						ins.converterElement.link(ins.volumeElement)
-					except:
-						pass
-
 			# And set it going
 			self.state_id = self.bus.connect("message::state-changed", self.state_changed, movePlayhead)
 			#set to PAUSED so the transport manager can seek first (if needed)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]