]> git.parisson.com Git - timeside.git/commitdiff
remove absurd input adapter nframes() method: the adapter isn't meant to deal with...
authorOlivier Guilyardi <olivier@samalyse.com>
Thu, 18 Feb 2010 17:35:43 +0000 (17:35 +0000)
committerOlivier Guilyardi <olivier@samalyse.com>
Thu, 18 Feb 2010 17:35:43 +0000 (17:35 +0000)
core.py
tests/api/examples.py
tests/testinputadapter.py

diff --git a/core.py b/core.py
index 6ee180a4cf182d2c37c92ec4a9d293039e138bcd..bf13948f7070f4c082dc3ba48966b4b2ecb61a75 100644 (file)
--- a/core.py
+++ b/core.py
@@ -106,19 +106,6 @@ class FixedSizeInputAdapter(object):
         self.len         = 0
         self.pad         = pad
 
-    def nframes(self, input_nframes):
-        """Return the total number of frames that this adapter will output according to the
-        input_nframes argument"""
-
-        nframes = input_nframes
-        if self.pad:
-            mod = input_nframes % self.buffer_size
-            if mod:
-                nframes += self.buffer_size - mod
-
-        return nframes                
-
-
     def process(self, frames, eod):
         """Returns an iterator over tuples of the form (buffer, eod) where buffer is a 
         fixed-sized block of data, and eod indicates whether this is the last block.
index 3a784149bfb46d4f66df96ea56b4af6a52515bb5..06accf0b262dcf34b8a0b651f9afc72bee398a68 100644 (file)
@@ -316,10 +316,6 @@ class FixedInputProcessor(Processor):
         super(FixedInputProcessor, self).setup(channels, samplerate, nframes)
         self.adapter = FixedSizeInputAdapter(self.BUFFER_SIZE, channels, pad=True)
 
-    @interfacedoc        
-    def nframes(self):
-        return self.adapter.nframes(self.input_nframes)
-
     @interfacedoc
     def process(self, frames, eod=False):
         for buffer, end in self.adapter.process(frames, eod):
index 28550e1da00f58f81b6bcf8d39a6fdf7a1caf64d..0c051c763de79b292fa9fee359d9df38a0842d4b 100644 (file)
@@ -23,11 +23,6 @@ data = numpy.arange(44).reshape(2,22).transpose()
 adapter = FixedSizeInputAdapter(4, 2)
 stdout.write("%s simple test" % adapter.__class__.__name__)
 
-expected = len(data)
-actual   = adapter.nframes(len(data))
-if actual != expected:
-    raise Exception("%d != %d nframes", (actual, expected))
-
 test(adapter, data[0:1], False, [])
 test(adapter, data[1:5], False, [data[0:4]], False)
 test(adapter, data[5:12], False, [data[4:8], data[8:12]], False)
@@ -42,11 +37,6 @@ stdout.write(" OK\n")
 adapter = FixedSizeInputAdapter(4, 2, pad=True)
 stdout.write("%s padding test" % adapter.__class__.__name__)
 
-expected = len(data) + 2
-actual   = adapter.nframes(len(data))
-if actual != expected:
-    raise Exception("%d != %d nframes", (actual, expected))
-
 test(adapter, data[0:21], False, [data[0:4], data[4:8], data[8:12], data[12:16], data[16:20]], False)
 test(adapter, data[21:22], True, [[
     [20, 42],