Mercurial > hg > piper-cpp
changeset 271:776175b737ad
When the input domain is FrequencyDomain, the caller is expected to pass
in the frequency-domain input - which means they need the additional
values for DC and Nyquist. So check this and refuse if absent
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 17 Oct 2018 15:18:42 +0100 |
parents | 60ff32818c30 |
children | 50e3c02c11cc |
files | vamp-server/simple-server.cpp |
diffstat | 1 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp-server/simple-server.cpp Wed Oct 17 11:49:31 2018 +0100 +++ b/vamp-server/simple-server.cpp Wed Oct 17 15:18:42 2018 +0100 @@ -520,12 +520,26 @@ } const float **fbuffers = new const float *[channels]; + + bool frequencyDomain = + (preq.plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain); + int blockSize = mapper.getBlockSize(h); + int inputBufferSize; + if (frequencyDomain) { + inputBufferSize = 2 * (blockSize / 2) + 2; + } else { + inputBufferSize = blockSize; + } + for (int i = 0; i < channels; ++i) { - if (int(preq.inputBuffers[i].size()) != mapper.getBlockSize(h)) { + if (int(preq.inputBuffers[i].size()) != inputBufferSize) { ostringstream os; - os << "wrong block size supplied to process (" - << preq.inputBuffers[i].size() - << ", expecting " << mapper.getBlockSize(h) << ")" << ends; + os << "wrong buffer size passed to process call as " + << (frequencyDomain ? "frequency" : "time") + << "-domain input on channel " << i << " with block size " + << blockSize << " (expected " << inputBufferSize + << " values, obtained " << preq.inputBuffers[i].size() + << ")" << ends; delete[] fbuffers; throw runtime_error(os.str()); }