MCPcopy Create free account
hub / github.com/Yaafe/Yaafe / process

Method process

src_cpp/yaafe-components/audio/AdvancedFrameTokenizer.cpp:71–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71bool 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
94void AdvancedFrameTokenizer::flush(YAAFE::Ports<YAAFE::InputBuffer*>& inp, YAAFE::Ports<YAAFE::OutputBuffer*>& outp)
95{

Callers

nothing calls this directly

Calls 7

prependZerosMethod · 0.80
hasTokensMethod · 0.80
readMethod · 0.80
writeTokenMethod · 0.80
consumeTokensMethod · 0.80
sizeMethod · 0.45
tokennoMethod · 0.45

Tested by

no test coverage detected