Mercurial > hg > sonic-visualiser
diff audioio/AudioCallbackPlaySource.cpp @ 15:cc566264c935
* timestretcher improvements -- simplify API (it can calculate its own
processing block sizes etc)
author | Chris Cannam |
---|---|
date | Wed, 13 Sep 2006 11:56:44 +0000 |
parents | 085f34c73939 |
children | 3715efc38f95 |
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp Wed Sep 13 11:06:28 2006 +0000 +++ b/audioio/AudioCallbackPlaySource.cpp Wed Sep 13 11:56:44 2006 +0000 @@ -598,15 +598,11 @@ for (size_t ch = 0; ch < channels; ++ch) { - m_stretcher[ch] = StretcherBuffer -//!!! - (new PhaseVocoderTimeStretcher(factor, - blockSize, + m_stretcher[ch] = new PhaseVocoderTimeStretcher(factor, blockSize); // 128), - (blockSize/2) / factor), - new float[lrintf(blockSize * factor)]); +// (blockSize/2) / factor), +// new float[lrintf(blockSize * factor)]); } - m_stretchInputBuffer = new float[blockSize]; } AudioCallbackPlaySource::TimeStretcherData::~TimeStretcherData() @@ -614,19 +610,19 @@ // std::cerr << "TimeStretcherData::~TimeStretcherData" << std::endl; while (!m_stretcher.empty()) { - delete m_stretcher.begin()->second.first; - delete[] m_stretcher.begin()->second.second; + delete m_stretcher.begin()->second; +// delete[] m_stretcher.begin()->second.second; m_stretcher.erase(m_stretcher.begin()); } - delete m_stretchInputBuffer; +// delete m_stretchInputBuffer; } PhaseVocoderTimeStretcher * AudioCallbackPlaySource::TimeStretcherData::getStretcher(size_t channel) { - return m_stretcher[channel].first; + return m_stretcher[channel]; } - +/* float * AudioCallbackPlaySource::TimeStretcherData::getOutputBuffer(size_t channel) { @@ -646,7 +642,7 @@ getOutputBuffer(channel), m_blockSize); } - +*/ void AudioCallbackPlaySource::setSlowdownFactor(float factor) { @@ -665,7 +661,8 @@ // factor > 1 ? getTargetBlockSize() : getTargetBlockSize() / factor); //!!! doesn't work if the block size > getTargetBlockSize(), but it // should be made to - getTargetBlockSize()); +// getTargetBlockSize()); + lrintf(getTargetBlockSize() / factor)); m_slowdownCounter = 0; m_timeStretcher = newStretcher; } else {