From: Olivier Guilyardi Date: Thu, 18 Feb 2010 17:35:43 +0000 (+0000) Subject: remove absurd input adapter nframes() method: the adapter isn't meant to deal with... X-Git-Tag: 0.3.2~188 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3e389ae8293e7d389e900752210ff1e67c326fab;p=timeside.git remove absurd input adapter nframes() method: the adapter isn't meant to deal with processor output --- diff --git a/core.py b/core.py index 6ee180a..bf13948 100644 --- 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. diff --git a/tests/api/examples.py b/tests/api/examples.py index 3a78414..06accf0 100644 --- a/tests/api/examples.py +++ b/tests/api/examples.py @@ -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): diff --git a/tests/testinputadapter.py b/tests/testinputadapter.py index 28550e1..0c051c7 100644 --- a/tests/testinputadapter.py +++ b/tests/testinputadapter.py @@ -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],