comparison audioio/AudioCallbackPlaySource.cpp @ 56:4253ad318db5

* Add spectrum icon * Start range mapper class for use in mapping between e.g. dial positions and underlying values
author Chris Cannam
date Mon, 16 Oct 2006 13:13:57 +0000
parents 0739be123304
children bedc7517b6e8
comparison
equal deleted inserted replaced
55:ca1e3f5657d5 56:4253ad318db5
30 #include <cassert> 30 #include <cassert>
31 31
32 //#define DEBUG_AUDIO_PLAY_SOURCE 1 32 //#define DEBUG_AUDIO_PLAY_SOURCE 1
33 //#define DEBUG_AUDIO_PLAY_SOURCE_PLAYING 1 33 //#define DEBUG_AUDIO_PLAY_SOURCE_PLAYING 1
34 34
35 //const size_t AudioCallbackPlaySource::m_ringBufferSize = 102400;
36 const size_t AudioCallbackPlaySource::m_ringBufferSize = 131071; 35 const size_t AudioCallbackPlaySource::m_ringBufferSize = 131071;
37 36
38 AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManager *manager) : 37 AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManager *manager) :
39 m_viewManager(manager), 38 m_viewManager(manager),
40 m_audioGenerator(new AudioGenerator()), 39 m_audioGenerator(new AudioGenerator()),
792 791
793 size_t available; 792 size_t available;
794 793
795 int warned = 0; 794 int warned = 0;
796 795
797
798
799 //!!!
800 // We want output blocks of e.g. 1024 (probably fixed, certainly 796 // We want output blocks of e.g. 1024 (probably fixed, certainly
801 // bounded). We can provide input blocks of any size (unbounded) 797 // bounded). We can provide input blocks of any size (unbounded)
802 // at the timestretcher's request. The input block for a given 798 // at the timestretcher's request. The input block for a given
803 // output is approx output / ratio, but we can't predict it 799 // output is approx output / ratio, but we can't predict it
804 // exactly, for an adaptive timestretcher. The stretcher will 800 // exactly, for an adaptive timestretcher. The stretcher will
805 // need some additional buffer space. 801 // need some additional buffer space. See the time stretcher code
806 802 // and comments.
807
808
809 803
810 while ((available = ts->getAvailableOutputSamples()) < count) { 804 while ((available = ts->getAvailableOutputSamples()) < count) {
811 805
812 size_t reqd = lrintf((count - available) / ratio); 806 size_t reqd = lrintf((count - available) / ratio);
813 reqd = std::max(reqd, ts->getRequiredInputSamples()); 807 reqd = std::max(reqd, ts->getRequiredInputSamples());