Mercurial > hg > svcore
comparison transform/FeatureExtractionModelTransformer.cpp @ 451:3c5252e7cefd
* Fix (kinda) display of fixed-sample-rate features with sample rate
different from the input model's rate
author | Chris Cannam |
---|---|
date | Wed, 08 Oct 2008 15:27:31 +0000 |
parents | 55cff2c6e4a0 |
children | ba7aaacb7211 |
comparison
equal
deleted
inserted
replaced
450:d8a2c28ba9f6 | 451:3c5252e7cefd |
---|---|
201 case Vamp::Plugin::OutputDescriptor::OneSamplePerStep: | 201 case Vamp::Plugin::OutputDescriptor::OneSamplePerStep: |
202 modelResolution = m_transform.getStepSize(); | 202 modelResolution = m_transform.getStepSize(); |
203 break; | 203 break; |
204 | 204 |
205 case Vamp::Plugin::OutputDescriptor::FixedSampleRate: | 205 case Vamp::Plugin::OutputDescriptor::FixedSampleRate: |
206 modelRate = size_t(m_descriptor->sampleRate + 0.001); | 206 //!!! SV doesn't actually support display of models that have |
207 //!!! different underlying rates together -- so we always set | |
208 //!!! the model rate to be the input model's rate, and adjust | |
209 //!!! the resolution appropriately. We can't properly display | |
210 //!!! data with a higher resolution than the base model at all | |
211 // modelRate = size_t(m_descriptor->sampleRate + 0.001); | |
212 if (m_descriptor->sampleRate > input->getSampleRate()) { | |
213 modelResolution = 1; | |
214 } else { | |
215 modelResolution = size_t(input->getSampleRate() / | |
216 m_descriptor->sampleRate); | |
217 } | |
207 break; | 218 break; |
208 } | 219 } |
209 | 220 |
210 bool preDurationPlugin = (m_plugin->getVampApiVersion() < 2); | 221 bool preDurationPlugin = (m_plugin->getVampApiVersion() < 2); |
211 | 222 |
596 Vamp::Plugin::OutputDescriptor::FixedSampleRate) { | 607 Vamp::Plugin::OutputDescriptor::FixedSampleRate) { |
597 | 608 |
598 if (feature.hasTimestamp) { | 609 if (feature.hasTimestamp) { |
599 //!!! warning: sampleRate may be non-integral | 610 //!!! warning: sampleRate may be non-integral |
600 frame = Vamp::RealTime::realTime2Frame(feature.timestamp, | 611 frame = Vamp::RealTime::realTime2Frame(feature.timestamp, |
601 lrintf(m_descriptor->sampleRate)); | 612 //!!! see comment above when setting up modelResolution and modelRate |
613 // lrintf(m_descriptor->sampleRate)); | |
614 inputRate); | |
602 } else { | 615 } else { |
603 frame = m_output->getEndFrame(); | 616 frame = m_output->getEndFrame(); |
604 } | 617 } |
605 } | 618 } |
606 | 619 |