Skip to content

Conversation

paulfd
Copy link
Member

@paulfd paulfd commented Mar 17, 2021

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:

  • Upon looping the first time, the buffer ends exactly at the loop point. Rendering the new buffer, the host sends the CC state at delay 0, which "replaces" the previous state at loop end and no smoothing occurs.
  • Upon looping the second time, loop point is mid buffer. The host splits the buffer and sends a CC state at delay 128. Now, a short smoothing will occur between delay 0 and 128.

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.

@paulfd paulfd requested a review from jpcima March 17, 2021 10:54
const auto threshold = 2 * static_cast<float>(impl.resources_.beatClock.getBeatsPerFrame());

if (positionDifference > threshold)
impl.playheadMoved_ = true;
Copy link
Member Author

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.

Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@paulfd paulfd merged commit 3dfc9c8 into sfztools:develop Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reset the smoothccs
2 participants