diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 2b37e20..1f57850 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -524,9 +524,25 @@ void MonostepAudioProcessor::processBlock (juce::AudioBuffer& buffer, juc { lastStep = -1; lastGateApplied = false; + retrigPpq = 0.0; } - freePpq = hostPpq; + // Optional retrigger: a fresh note-on restarts the pattern from + // step 1, offset from the host transport position. + const bool retrigOn = seqRetrigParam->load() >= 0.5f; + + if (noteOnSeen && retrigOn) + { + retrigPpq = hostPpq; + lastStep = -1; + lastGateApplied = false; + } + else if (! retrigOn) + { + retrigPpq = 0.0; + } + + freePpq = hostPpq - retrigPpq; } else { @@ -537,8 +553,7 @@ void MonostepAudioProcessor::processBlock (juce::AudioBuffer& buffer, juc } // Optional retrigger: a fresh note-on restarts the pattern from - // step 1. Only honoured in free-run mode; while the host transport - // is running, the pattern follows the host grid instead. + // step 1 in free-run mode. if (noteOnSeen && seqRetrigParam->load() >= 0.5f) { freePpq = 0.0; diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index ea228cf..9af6b01 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -127,4 +127,5 @@ private: bool wasPlaying = false; double lastHostPpq = -1.0; double freePpq = 0.0; + double retrigPpq = 0.0; };