comparison framework/MainWindowBase.cpp @ 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 9c904ede116c
children b218f441302f
comparison
equal deleted inserted replaced
92:792bca285459 93:737b373246b5
447 if (m_viewManager) m_viewManager->setPlaybackModel(0); 447 if (m_viewManager) m_viewManager->setPlaybackModel(0);
448 return; 448 return;
449 } 449 }
450 450
451 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); 451 Model *prevPlaybackModel = m_viewManager->getPlaybackModel();
452 int frame = m_playSource->getCurrentPlayingFrame(); 452
453 453 // What we want here is not the currently playing frame (unless we
454 std::cerr << "playing frame (in ref model) = " << frame << std::endl; 454 // are about to clear out the audio playback buffers -- which may
455 // or may not be possible, depending on the audio driver). What
456 // we want is the frame that was last committed to the soundcard
457 // buffers, as the audio driver will continue playing up to that
458 // frame before switching to whichever one we decide we want to
459 // switch to, regardless of our efforts.
460
461 int frame = m_playSource->getCurrentBufferedFrame();
462
463 // std::cerr << "currentPaneChanged: current frame (in ref model) = " << frame << std::endl;
455 464
456 View::ModelSet soloModels = p->getModels(); 465 View::ModelSet soloModels = p->getModels();
457 466
458 View::ModelSet sources; 467 View::ModelSet sources;
459 for (View::ModelSet::iterator mi = soloModels.begin(); 468 for (View::ModelSet::iterator mi = soloModels.begin();
486 getPlaybackModel()); 495 getPlaybackModel());
487 496
488 m_playSource->setSoloModelSet(soloModels); 497 m_playSource->setSoloModelSet(soloModels);
489 498
490 if (a && b && (a != b)) { 499 if (a && b && (a != b)) {
491 /*!!!
492 int rframe = a->alignToReference(frame);
493 int bframe = b->alignFromReference(rframe);
494 if (m_playSource->isPlaying()) m_playSource->play(bframe);
495 */
496 if (m_playSource->isPlaying()) m_playSource->play(frame); 500 if (m_playSource->isPlaying()) m_playSource->play(frame);
497 } 501 }
498 } 502 }
499 503
500 void 504 void