comparison audioio/AudioCallbackPlaySource.h @ 93:737b373246b5

* Further fixes to the handling of playback frame and buffered frame counts
author Chris Cannam
date Mon, 11 Feb 2008 12:46:39 +0000
parents 9fc4b256c283
children 9cc9862333bd
comparison
equal deleted inserted replaced
92:792bca285459 93:737b373246b5
24 #include <QObject> 24 #include <QObject>
25 #include <QMutex> 25 #include <QMutex>
26 #include <QWaitCondition> 26 #include <QWaitCondition>
27 27
28 #include "base/Thread.h" 28 #include "base/Thread.h"
29 #include "base/RealTime.h"
29 30
30 #include <samplerate.h> 31 #include <samplerate.h>
31 32
32 #include <set> 33 #include <set>
33 #include <map> 34 #include <map>
97 /** 98 /**
98 * Return the frame number that is currently expected to be coming 99 * Return the frame number that is currently expected to be coming
99 * out of the speakers. (i.e. compensating for playback latency.) 100 * out of the speakers. (i.e. compensating for playback latency.)
100 */ 101 */
101 virtual size_t getCurrentPlayingFrame(); 102 virtual size_t getCurrentPlayingFrame();
103
104 /**
105 * Return the last frame that would come out of the speakers if we
106 * stopped playback right now.
107 */
108 virtual size_t getCurrentBufferedFrame();
102 109
103 /** 110 /**
104 * Return the frame at which playback is expected to end (if not looping). 111 * Return the frame at which playback is expected to end (if not looping).
105 */ 112 */
106 virtual size_t getPlayEndFrame() { return m_lastModelEndFrame; } 113 virtual size_t getPlayEndFrame() { return m_lastModelEndFrame; }
329 size_t mixModels(size_t &frame, size_t count, float **buffers); 336 size_t mixModels(size_t &frame, size_t count, float **buffers);
330 337
331 // Called from getSourceSamples. 338 // Called from getSourceSamples.
332 void applyAuditioningEffect(size_t count, float **buffers); 339 void applyAuditioningEffect(size_t count, float **buffers);
333 340
341 // Ranges of current selections, if play selection is active
342 std::vector<RealTime> m_rangeStarts;
343 std::vector<RealTime> m_rangeDurations;
344 void rebuildRangeLists();
345
346 size_t getCurrentFrame(RealTime outputLatency);
347
334 class FillThread : public Thread 348 class FillThread : public Thread
335 { 349 {
336 public: 350 public:
337 FillThread(AudioCallbackPlaySource &source) : 351 FillThread(AudioCallbackPlaySource &source) :
338 Thread(Thread::NonRTThread), 352 Thread(Thread::NonRTThread),