comparison src/vamp-hostsdk/PluginBufferingAdapter.cpp @ 353:bd9a63d35e71

Use double arithmetic for rate calculations
author Chris Cannam
date Thu, 28 Mar 2013 13:40:38 +0000
parents 1a8a58e8ea7a
children 656ce0eae135
comparison
equal deleted inserted replaced
352:60ede78a20db 353:bd9a63d35e71
615 { 615 {
616 if (feature.hasTimestamp) { 616 if (feature.hasTimestamp) {
617 double secs = feature.timestamp.sec; 617 double secs = feature.timestamp.sec;
618 secs += feature.timestamp.nsec / 1e9; 618 secs += feature.timestamp.nsec / 1e9;
619 m_fixedRateFeatureNos[outputNo] = 619 m_fixedRateFeatureNos[outputNo] =
620 int(secs * m_outputs[outputNo].sampleRate + 0.5); 620 int(secs * double(m_outputs[outputNo].sampleRate) + 0.5);
621 } 621 }
622 622
623 feature.timestamp = RealTime::fromSeconds 623 feature.timestamp = RealTime::fromSeconds
624 (m_fixedRateFeatureNos[outputNo] / m_outputs[outputNo].sampleRate); 624 (m_fixedRateFeatureNos[outputNo] / double(m_outputs[outputNo].sampleRate));
625 625
626 feature.hasTimestamp = true; 626 feature.hasTimestamp = true;
627 627
628 m_fixedRateFeatureNos[outputNo] = m_fixedRateFeatureNos[outputNo] + 1; 628 m_fixedRateFeatureNos[outputNo] = m_fixedRateFeatureNos[outputNo] + 1;
629 } 629 }