diff 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
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Jun 28 14:50:58 2007 +0000
+++ b/main/MainWindow.cpp	Fri Jun 29 13:58:08 2007 +0000
@@ -3411,6 +3411,18 @@
 
     Layer *layer = getSnapLayer();
     size_t sr = getMainModel()->getSampleRate();
+    
+    // when rewinding during playback, we want to allow a period
+    // following a rewind target point at which the rewind will go to
+    // the prior point instead of the immediately neighbouring one
+    if (m_playSource && m_playSource->isPlaying()) {
+        RealTime ct = RealTime::frame2RealTime(frame, sr);
+        ct = ct - RealTime::fromSeconds(0.25);
+        if (ct < RealTime::zeroTime) ct = RealTime::zeroTime;
+//        std::cerr << "rewind: frame " << frame << " -> ";
+        frame = RealTime::realTime2Frame(ct, sr);
+//        std::cerr << frame << std::endl;
+    }
 
     if (!layer) {