comparison src/vamp-hostsdk/PluginInputDomainAdapter.cpp @ 386:e0697515163f

Fine adjustment to timestamp to avoid rounding error
author Chris Cannam
date Wed, 14 Jan 2015 16:58:53 +0000
parents 364e4653fe20
children 35fa4733bc5d
comparison
equal deleted inserted replaced
385:632d90c185ec 386:e0697515163f
506 Plugin::FeatureSet 506 Plugin::FeatureSet
507 PluginInputDomainAdapter::Impl::processShiftingTimestamp(const float *const *inputBuffers, 507 PluginInputDomainAdapter::Impl::processShiftingTimestamp(const float *const *inputBuffers,
508 RealTime timestamp) 508 RealTime timestamp)
509 { 509 {
510 if (m_method == ShiftTimestamp) { 510 if (m_method == ShiftTimestamp) {
511 // we may need to add one nsec if timestamp +
512 // getTimestampAdjustment() rounds down
511 timestamp = timestamp + getTimestampAdjustment(); 513 timestamp = timestamp + getTimestampAdjustment();
514 RealTime nsec(0, 1);
515 if (RealTime::realTime2Frame(timestamp, m_inputSampleRate) <
516 RealTime::realTime2Frame(timestamp + nsec, m_inputSampleRate)) {
517 timestamp = timestamp + nsec;
518 }
512 } 519 }
513 520
514 for (int c = 0; c < m_channels; ++c) { 521 for (int c = 0; c < m_channels; ++c) {
515 522
516 m_window->cut(inputBuffers[c], m_ri); 523 m_window->cut(inputBuffers[c], m_ri);