-
-
Notifications
You must be signed in to change notification settings - Fork 69
Reset the smoothers #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset the smoothers #710
Conversation
const auto threshold = 2 * static_cast<float>(impl.resources_.beatClock.getBeatsPerFrame()); | ||
|
||
if (positionDifference > threshold) | ||
impl.playheadMoved_ = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is not super pretty although it does make some sense. There may be a better way to assess whether the playhead moved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps reset them only at T=0 ?
It seems working in Reaper to check for bar=0 && beat=0 && playing=on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was talking about the detection of the moved playhead. For the reset conditions there are many variations. It seems sforzando does not reset only on playhead moved but I'm not sure it's so natural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Alex's example if you have the ability to render/bounce a region, only resetting at T=0 would smooth if the region you render does not start on 0.
Closes: #382
In the end I added some code to check if the playhead moved. If the playhead moved and we're rendering with transport is playing, the smoothers are reset and the CC state is flushed.
It seemed to match sforzando behavior in Reaper on Windows. It's not entirely what we discussed because upon looping you will have a discrete jump and no smoothing. The alternative is not as straightforward though, because looping seems to always involve splitting buffers in Reaper (as expected), which in turns mean you have a non-deterministic behavior of the smoother. To give an example, assuming a block size of 256:
All of this can be discussed and tweaked for sure. I'll try to compare more with the DAWs I have at hand, which is mainly Ardour now...
I also corrected some things in the BeatClock, @jpcima you might want to validate it. I'll comment them inline. There's also a small change in the MidiState which is actually a bug correction I think.