user-friendly hack/heuristic: if they edit a BBT non-duration clock to say zero beats...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 20 Feb 2018 22:19:43 +0000 (17:19 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 20 Feb 2018 22:19:43 +0000 (17:19 -0500)
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h

index ae98f21de560d47b84adcf61441a468e7330aa68..6a7733ae5f9bd7bc3f9b52116e900a26b2600e5f 100644 (file)
@@ -1920,7 +1920,7 @@ AudioClock::current_duration (samplepos_t pos) const
 }
 
 bool
-AudioClock::bbt_validate_edit (const string& str)
+AudioClock::bbt_validate_edit (string & str)
 {
        AnyTime any;
 
@@ -1937,7 +1937,14 @@ AudioClock::bbt_validate_edit (const string& str)
        }
 
        if (!is_duration && any.bbt.beats == 0) {
-               return false;
+               /* user could not have mean zero beats because for a
+                * non-duration clock that's impossible. Assume that they
+                * mis-entered things and meant Bar|1|ticks
+                */
+
+               char buf[128];
+               snprintf (buf, sizeof (buf), "%" PRIu32 "|%" PRIu32 "|%" PRIu32, any.bbt.bars, 1, any.bbt.ticks);
+               str = buf;
        }
 
        return true;
index 6b9c61a7e8963534d92239d117ff45ea8fc449d9..5d8e58be6bca0ab749a475e4bc5cb3918095ed14 100644 (file)
@@ -223,7 +223,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
        samplepos_t get_sample_step (Field, samplepos_t pos = 0, int dir = 1);
 
        bool timecode_validate_edit (const std::string&);
-       bool bbt_validate_edit (const std::string&);
+       bool bbt_validate_edit (std::string&);
        bool minsec_validate_edit (const std::string&);
 
        samplepos_t samples_from_timecode_string (const std::string&) const;