# HG changeset patch # User Chris Cannam # Date 1223479651 0 # Node ID 3c5252e7cefd0aaf4c05bcad9e8bc183d612934b # Parent d8a2c28ba9f698fe808b185c905bf2ebd89e168d * Fix (kinda) display of fixed-sample-rate features with sample rate different from the input model's rate diff -r d8a2c28ba9f6 -r 3c5252e7cefd transform/FeatureExtractionModelTransformer.cpp --- a/transform/FeatureExtractionModelTransformer.cpp Tue Oct 07 12:59:55 2008 +0000 +++ b/transform/FeatureExtractionModelTransformer.cpp Wed Oct 08 15:27:31 2008 +0000 @@ -203,7 +203,18 @@ break; case Vamp::Plugin::OutputDescriptor::FixedSampleRate: - modelRate = size_t(m_descriptor->sampleRate + 0.001); + //!!! SV doesn't actually support display of models that have + //!!! different underlying rates together -- so we always set + //!!! the model rate to be the input model's rate, and adjust + //!!! the resolution appropriately. We can't properly display + //!!! data with a higher resolution than the base model at all +// modelRate = size_t(m_descriptor->sampleRate + 0.001); + if (m_descriptor->sampleRate > input->getSampleRate()) { + modelResolution = 1; + } else { + modelResolution = size_t(input->getSampleRate() / + m_descriptor->sampleRate); + } break; } @@ -598,7 +609,9 @@ if (feature.hasTimestamp) { //!!! warning: sampleRate may be non-integral frame = Vamp::RealTime::realTime2Frame(feature.timestamp, - lrintf(m_descriptor->sampleRate)); +//!!! see comment above when setting up modelResolution and modelRate +// lrintf(m_descriptor->sampleRate)); + inputRate); } else { frame = m_output->getEndFrame(); }