Sfoglia il codice sorgente

Transport: Stop after a pause goes back to the seek mark; a new project forgets it (issue #169)

FL's Stop while paused (transport state 2) runs the stop that returns to the
mark, not the stopped-again rule that goes to the start.
Ka1-S 2 settimane fa
parent
commit
a8d6a3efd1
2 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 13 1
      src/ui/MainComponent.cpp
  2. 1 0
      src/ui/MainComponent.h

+ 13 - 1
src/ui/MainComponent.cpp

@@ -3126,6 +3126,15 @@ void MainComponent::notePlayStart (bool resume)
     seekClicksSeen = EditorGlobals::get().seekMarkSerial; // (the click that put the position here is this start)
 }
 
+void MainComponent::forgetSeekMark()
+{
+    auto& globals = EditorGlobals::get();
+    globals.seekMark = -1;
+    seekClicksSeen = globals.seekMarkSerial;
+    returnTicks = -1.0;
+    transportPaused = false;
+}
+
 std::int64_t MainComponent::stopReturn (bool alreadyStopped, bool spaceKey)
 {
     auto& globals = EditorGlobals::get();
@@ -3175,7 +3184,8 @@ void MainComponent::stopAndRewind (bool toStart)
 {
     // Stop while nothing plays (the second press, or a double click) goes back to the very start even when
     // "Remember seek time" sends the first Stop to the ruler mark (round 162, issue #9)
-    const auto alreadyStopped = toStart || ! (engine.getTransport().playing.load() || engine.isWaitingForInput() || engine.isCountingIn() || engine.isLinkWaiting());
+    // (paused is not stopped: FL's Stop after a pause (transport state 2) still goes back to the seek mark, issue #169)
+    const auto alreadyStopped = toStart || ! (transportPaused || engine.getTransport().playing.load() || engine.isWaitingForInput() || engine.isCountingIn() || engine.isLinkWaiting());
     const auto back = stopReturn (alreadyStopped, false); // (issue #169: FL's seek mark, Pattern mode too)
     engine.stop();
     transportPaused = false;
@@ -7142,6 +7152,7 @@ void MainComponent::openStartupProject()
 
 void MainComponent::startNewProject (Song song, const juce::File& file)
 {
+    forgetSeekMark();
     engine.stop();
     engine.rewind();
     engine.setSong (std::move (song));
@@ -7282,6 +7293,7 @@ void MainComponent::openFileRequest (const juce::File& file)
 
 void MainComponent::openFile (const juce::File& file)
 {
+    forgetSeekMark(); // (another project: FL's mark and a pause don't carry over)
     juce::String error;
     crashguard::note (("opening project " + file.getFileName()).toStdString()); // session breadcrumb (round 111)
 

+ 1 - 0
src/ui/MainComponent.h

@@ -259,6 +259,7 @@ private:
     double positionToStartFrom() const; // the position playback starts from (a seek still on its way counts)
     void notePlayStart (bool resume);
     std::int64_t stopReturn (bool alreadyStopped, bool spaceKey);
+    void forgetSeekMark();
 
     // key map and actions
     bool runAction (const std::string& id);