comparison main/MainWindow.cpp @ 156:63a9c88fbba9

* highlight the nearest measurement rect * fix rewind during playback
author Chris Cannam
date Fri, 29 Jun 2007 13:58:08 +0000
parents 7310316bf74b
children d8ec67a6e3c7
comparison
equal deleted inserted replaced
155:7310316bf74b 156:63a9c88fbba9
3409 int frame = m_viewManager->getPlaybackFrame(); 3409 int frame = m_viewManager->getPlaybackFrame();
3410 if (frame > 0) --frame; 3410 if (frame > 0) --frame;
3411 3411
3412 Layer *layer = getSnapLayer(); 3412 Layer *layer = getSnapLayer();
3413 size_t sr = getMainModel()->getSampleRate(); 3413 size_t sr = getMainModel()->getSampleRate();
3414
3415 // when rewinding during playback, we want to allow a period
3416 // following a rewind target point at which the rewind will go to
3417 // the prior point instead of the immediately neighbouring one
3418 if (m_playSource && m_playSource->isPlaying()) {
3419 RealTime ct = RealTime::frame2RealTime(frame, sr);
3420 ct = ct - RealTime::fromSeconds(0.25);
3421 if (ct < RealTime::zeroTime) ct = RealTime::zeroTime;
3422 // std::cerr << "rewind: frame " << frame << " -> ";
3423 frame = RealTime::realTime2Frame(ct, sr);
3424 // std::cerr << frame << std::endl;
3425 }
3414 3426
3415 if (!layer) { 3427 if (!layer) {
3416 3428
3417 frame = RealTime::realTime2Frame 3429 frame = RealTime::realTime2Frame
3418 (RealTime::frame2RealTime(frame, sr) - RealTime(2, 0), sr); 3430 (RealTime::frame2RealTime(frame, sr) - RealTime(2, 0), sr);