-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Switch to libsamplerate's callback API in Sample
#7361
Switch to libsamplerate's callback API in Sample
#7361
Conversation
We shouldn't limit our use of libsamplerate to only one of its API's.
The bounds are already checked inside the switch chase for Loop::Off. Also do some cleanup and adjustmenets.
Forgot to apply amplification, fixing that now (as well as merge conflicts). |
Does this got anything to do with the crashes I experience on #5990? Looks like it. |
I don't think so. 5990 uses |
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.
I tested it and it seems to work pretty well
This PR switches the use of libsamplerate in
Sample
to the callback API instead of the full API. This PR is great for many reasons:Sample
. TheSample::advance
function was removed as well as the heap allocation inSample::play
.Sample::play
was removed,Sample::play
should be more safe to call in real-time.marginSize
of64
fixed this in current master, but I wanted to try and improve this code further.Other changes:
double
, but it was originally being passed in as afloat
).AudioResampler
since it was no longer being used by anything, and it does not seem like a good idea for libsamplerate's usage in the codebase to be limited by the API ofAudioResampler
. The code should be allowed to choose which API from libsamplerate it wants to use.s_interpolationMargins
is only used byGigInstrument
currently, so I moved the array in there.