| 69 | } |
| 70 | |
| 71 | bool AdvancedFrameTokenizer::process(YAAFE::Ports<YAAFE::InputBuffer*>& inp, YAAFE::Ports<YAAFE::OutputBuffer*>& outp) |
| 72 | { |
| 73 | assert(inp.size()==1); |
| 74 | InputBuffer* in = inp[0].data; |
| 75 | assert(outp.size()==1); |
| 76 | OutputBuffer* out = outp[0].data; |
| 77 | assert(in->size()==1); |
| 78 | |
| 79 | if ((out->tokenno()==0) && (in->tokenno()!=-m_blockSize/2)) |
| 80 | in->prependZeros(m_blockSize/2); |
| 81 | |
| 82 | if (!in->hasTokens(m_blockSize)) |
| 83 | return false; |
| 84 | |
| 85 | while (in->hasTokens(m_blockSize)) { |
| 86 | in->read(out->writeToken(),m_blockSize); |
| 87 | int nextInputToken = (int) floor(out->tokenno() * m_outStepSize * in->info().sampleRate / m_outSampleRate + 0.5); |
| 88 | in->consumeTokens(nextInputToken - m_blockSize/2 - in->tokenno()); |
| 89 | } |
| 90 | |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | void AdvancedFrameTokenizer::flush(YAAFE::Ports<YAAFE::InputBuffer*>& inp, YAAFE::Ports<YAAFE::OutputBuffer*>& outp) |
| 95 | { |
nothing calls this directly
no test coverage detected