Mercurial > hg > sonic-visualiser
diff audioio/AudioCallbackPlaySource.cpp @ 22:80126455d169
* add samplerate parameter to timestretcher (not properly used yet),
and update credits
author | Chris Cannam |
---|---|
date | Fri, 15 Sep 2006 13:35:37 +0000 |
parents | 3715efc38f95 |
children | e74f508db18c |
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp Thu Sep 14 16:08:23 2006 +0000 +++ b/audioio/AudioCallbackPlaySource.cpp Fri Sep 15 13:35:37 2006 +0000 @@ -603,7 +603,8 @@ if (factor != 1) { PhaseVocoderTimeStretcher *newStretcher = new PhaseVocoderTimeStretcher - (getTargetChannelCount(), + (getTargetSampleRate(), + getTargetChannelCount(), factor, sharpen, lrintf(getTargetBlockSize() / factor)); @@ -712,52 +713,6 @@ ts->getOutput(buffer, count); - -/*!!! - for (size_t ch = 0; ch < getTargetChannelCount(); ++ch) { - - RingBuffer<float> *rb = getReadRingBuffer(ch); - - if (rb) { - - float ratio = ts->getRatio(); - -// std::cout << "ratio = " << ratio << std::endl; - - size_t available; - - while ((available = ts->getAvailableOutputSamples()) < count) { - - size_t reqd = lrintf((count - available) / ratio); - reqd = std::max(reqd, ts->getRequiredInputSamples()); - if (reqd == 0) reqd = 1; - - float ib[reqd]; - size_t got = rb->read(ib, reqd); - -#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING - std::cout << "AudioCallbackPlaySource::getSamples: got " << got << " samples on channel " << ch << " (reqd=" << reqd << ", count=" << count << ", ratio=" << ratio << ", got*ratio=" << got * ratio << "), running time stretcher" << std::endl; -#endif - - if (got < reqd) { - std::cerr << "WARNING: Read underrun in playback (" - << got << " < " << reqd << ")" << std::endl; - } - - ts->putInput(ib, got); - - if (got == 0) break; - - if (ts->getAvailableOutputSamples() == available) { - std::cerr << "WARNING: AudioCallbackPlaySource::getSamples: Added " << got << " samples to time stretcher, created no new available output samples" << std::endl; - break; - } - } - - ts->getOutput(buffer[ch], count); - } - } -*/ m_condition.wakeAll(); return count;