Mercurial > hg > svapp
comparison audioio/AudioCallbackPlaySource.cpp @ 404:08a45e4cf1b1 tonioni
Update subrepos and merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 16:23:48 +0100 |
parents | f7dddea0dbe0 |
children | ddfb480c70a0 |
comparison
equal
deleted
inserted
replaced
384:ad33fdc4ad92 | 404:08a45e4cf1b1 |
---|---|
359 void | 359 void |
360 AudioCallbackPlaySource::clearRingBuffers(bool haveLock, int count) | 360 AudioCallbackPlaySource::clearRingBuffers(bool haveLock, int count) |
361 { | 361 { |
362 if (!haveLock) m_mutex.lock(); | 362 if (!haveLock) m_mutex.lock(); |
363 | 363 |
364 cerr << "clearRingBuffers" << endl; | |
365 | |
364 rebuildRangeLists(); | 366 rebuildRangeLists(); |
365 | 367 |
366 if (count == 0) { | 368 if (count == 0) { |
367 if (m_writeBuffers) count = m_writeBuffers->size(); | 369 if (m_writeBuffers) count = m_writeBuffers->size(); |
368 } | 370 } |
369 | 371 |
372 cerr << "current playing frame = " << getCurrentPlayingFrame() << endl; | |
373 | |
374 cerr << "write buffer fill (before) = " << m_writeBufferFill << endl; | |
375 | |
370 m_writeBufferFill = getCurrentBufferedFrame(); | 376 m_writeBufferFill = getCurrentBufferedFrame(); |
377 | |
378 cerr << "current buffered frame = " << m_writeBufferFill << endl; | |
371 | 379 |
372 if (m_readBuffers != m_writeBuffers) { | 380 if (m_readBuffers != m_writeBuffers) { |
373 delete m_writeBuffers; | 381 delete m_writeBuffers; |
374 } | 382 } |
375 | 383 |
600 // This method attempts to estimate which audio sample frame is | 608 // This method attempts to estimate which audio sample frame is |
601 // "currently coming through the speakers". | 609 // "currently coming through the speakers". |
602 | 610 |
603 int targetRate = getTargetSampleRate(); | 611 int targetRate = getTargetSampleRate(); |
604 int latency = m_playLatency; // at target rate | 612 int latency = m_playLatency; // at target rate |
605 RealTime latency_t = RealTime::frame2RealTime(latency, targetRate); | 613 RealTime latency_t = RealTime::zeroTime; |
614 | |
615 if (targetRate != 0) { | |
616 latency_t = RealTime::frame2RealTime(latency, targetRate); | |
617 } | |
606 | 618 |
607 return getCurrentFrame(latency_t); | 619 return getCurrentFrame(latency_t); |
608 } | 620 } |
609 | 621 |
610 int | 622 int |