Skip to content
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

setTempo creates invalid boundaries if loop is not starting at buffer position 0 #51

Closed
harthorst opened this issue Sep 15, 2018 · 2 comments

Comments

@harthorst
Copy link

harthorst commented Sep 15, 2018

if a loop is running from start > 0 to end > start (set by setLoopRange()) and setTempo() is called I observed:

  1. buffer positions of audio events are scaled according to ratio (oldTempo/newTempo)
  2. min_buffer_position stays untouched (but should be scaled too?)
  3. max_buffer_position is samples_per_bar * amount_of_bars bout should be min_buffer_position + samples_per_bar * amount_of_bars

Maybe I'm not using it correctly. But changing handleTempoUpdate() to:
float ratio = tempo / aQueuedTempo;
....
min_buffer_position = min_buffer_position * ratio;
max_buffer_position = ( min_buffer_position + samples_per_bar * amount_of_bars ) - 1;

Helped me.

@igorski
Copy link
Owner

igorski commented Sep 19, 2018

That's a great find, took your code and implemented it in #52

@igorski igorski closed this as completed Sep 19, 2018
@harthorst
Copy link
Author

Thanks. I forgot to mention that you have to scale the notification marker as well.

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

No branches or pull requests

2 participants