comparison audioio/AudioCallbackPlaySource.cpp @ 132:3b61a975b47e sv1-v1.3 sv1-v1.3rc1

* Updates for 1.3
author Chris Cannam
date Thu, 10 Jul 2008 12:50:56 +0000
parents 883f7fc7fd34
children 72495c4cd315
comparison
equal deleted inserted replaced
131:883f7fc7fd34 132:3b61a975b47e
374 if (startFrame >= m_lastModelEndFrame) { 374 if (startFrame >= m_lastModelEndFrame) {
375 startFrame = 0; 375 startFrame = 0;
376 } 376 }
377 } 377 }
378 378
379 #ifdef DEBUG_AUDIO_PLAY_SOURCE
379 std::cerr << "play(" << startFrame << ") -> playback model "; 380 std::cerr << "play(" << startFrame << ") -> playback model ";
381 #endif
380 382
381 startFrame = m_viewManager->alignReferenceToPlaybackFrame(startFrame); 383 startFrame = m_viewManager->alignReferenceToPlaybackFrame(startFrame);
382 384
383 std::cerr << startFrame << std::endl; 385 std::cerr << startFrame << std::endl;
384 386
398 400
399 m_readBufferFill = m_writeBufferFill = startFrame; 401 m_readBufferFill = m_writeBufferFill = startFrame;
400 if (m_readBuffers) { 402 if (m_readBuffers) {
401 for (size_t c = 0; c < getTargetChannelCount(); ++c) { 403 for (size_t c = 0; c < getTargetChannelCount(); ++c) {
402 RingBuffer<float> *rb = getReadRingBuffer(c); 404 RingBuffer<float> *rb = getReadRingBuffer(c);
405 #ifdef DEBUG_AUDIO_PLAY_SOURCE
403 std::cerr << "reset ring buffer for channel " << c << std::endl; 406 std::cerr << "reset ring buffer for channel " << c << std::endl;
407 #endif
404 if (rb) rb->reset(); 408 if (rb) rb->reset();
405 } 409 }
406 } 410 }
407 if (m_converter) src_reset(m_converter); 411 if (m_converter) src_reset(m_converter);
408 if (m_crapConverter) src_reset(m_crapConverter); 412 if (m_crapConverter) src_reset(m_crapConverter);
691 695
692 if (!m_playStartFramePassed) { 696 if (!m_playStartFramePassed) {
693 RealTime playstart_t = RealTime::frame2RealTime(m_playStartFrame, 697 RealTime playstart_t = RealTime::frame2RealTime(m_playStartFrame,
694 sourceRate); 698 sourceRate);
695 if (playing_t < playstart_t) { 699 if (playing_t < playstart_t) {
696 std::cerr << "playing_t " << playing_t << " < playstart_t " 700 // std::cerr << "playing_t " << playing_t << " < playstart_t "
697 << playstart_t << std::endl; 701 // << playstart_t << std::endl;
698 if (/*!!! sincerequest_t > RealTime::zeroTime && */ 702 if (/*!!! sincerequest_t > RealTime::zeroTime && */
699 m_playStartedAt + latency_t + stretchlat_t < 703 m_playStartedAt + latency_t + stretchlat_t <
700 RealTime::fromSeconds(currentTime)) { 704 RealTime::fromSeconds(currentTime)) {
701 std::cerr << "but we've been playing for long enough that I think we should disregard it (it probably results from loop wrapping)" << std::endl; 705 std::cerr << "but we've been playing for long enough that I think we should disregard it (it probably results from loop wrapping)" << std::endl;
702 m_playStartFramePassed = true; 706 m_playStartFramePassed = true;