]> git.parisson.com Git - timeside.git/commitdiff
Fix ProcessPipe: proper copy of processor already in pipe
authorThomas Fillon <thomas@parisson.com>
Tue, 16 Dec 2014 14:04:25 +0000 (15:04 +0100)
committerThomas Fillon <thomas@parisson.com>
Tue, 16 Dec 2014 14:04:25 +0000 (15:04 +0100)
tests/test_process_pipe.py
timeside/core.py

index b503efb7fb31a1df0eca3756cb7e6526824bc480..fd7e1f2b9c3ec7ceb4e9c84f91c78b7aa18f7c45 100755 (executable)
@@ -25,11 +25,15 @@ class TestProcessPipe(unittest.TestCase):
         dec2 = FileDecoder(source)
         self.assertRaises(ValueError, pipe.append_processor, dec2)
 
-        a = timeside.analyzer.odf.OnsetDetectionFunction()
-        abis = timeside.analyzer.odf.OnsetDetectionFunction()
+        odf = timeside.analyzer.odf.OnsetDetectionFunction()
+        odf2 = timeside.analyzer.odf.OnsetDetectionFunction()
 
-        a2 = timeside.analyzer.spectrogram.Spectrogram()
-        pipe2 = (dec | a | a2 | abis)
+        spectro2 = timeside.analyzer.spectrogram.Spectrogram()
+        pipe2 = (dec | odf | spectro2 | odf2)
+
+        self.assertEqual(pipe2, odf.process_pipe)
+        self.assertEqual(pipe2, odf2.process_pipe)
+        self.assertEqual(pipe2, spectro2.process_pipe)
 
         self.assertEqual(len(pipe2.processors), 4)
         # Release temporary buffers in Spectrogram
index 917752fcdf7de80955cf55713aec4ac5c2f8bb24..d724bf54cfc2def789a61f521cc8b4b4d76e810d 100644 (file)
@@ -353,6 +353,7 @@ class ProcessPipe(object):
                 child_proc = self._graph.node[child]['processor']
                 if proc == child_proc:
                     proc.UUID = child_proc.UUID
+                    proc.process_pipe = self
                     break
         if not self._graph.has_node(proc.uuid()):
             self.processors.append(proc)  # Add processor to the pipe