-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
AudioStreamPlaybackWAV
: Inherit from Resampled
#100652
Conversation
1b3c20d
to
b544824
Compare
Updated the Increment doesn't need to be multiplied by 8192, so I made it an |
Co-authored-by: DeeJayLSP <djlsp@proton.me>
b544824
to
ccfbdf2
Compare
AudioStreamPlaybackWAV
: inherit from Resampled
AudioStreamPlaybackWAV
: Inherit from Resampled
This technically fixes #58216, could this get a bug label? |
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.
Looks good to me from a cursory glance, and from reading the description. Let's get this tested.
Thanks! |
TL;DR: this is a non-breaking change that simplifies AudioStreamWAV a lot while improving the resampling quality.
A continuation and updated version of #83483, so everything that has been discussed there applies here. The original author, @wareya, has been added as the commit author, and I left myself as a co-author, as what I've done was mostly patching.
Removes the resampling code entirely from
AudioStreamPlaybackWAV
and makes it inherit fromAudioStreamPlaybackResampled
, fixes #58216. This brings the class in par with the Ogg Vorbis and MP3 equivalents, which already inherit fromResampled
.I have tested this with as many audio files I could, with every loop mode, and found no problems.
Any existing project needs no modifications to work with this PR. It barely modifies unexposed methods, so no compatibility breaks.
A few notable changes:
do_resample
did two things: convert samples from their format toAudioFrame
, then apply linear interpolation. Interpolation code was removed and the function renamed todecode_samples
.DATA_PAD
has been removed fromAudioStreamWAV
as it lost its purpose. Functions that required handling the pads have been simplified, potentially reducing memory overhead.production=yes
had a 4KB reduction in binary size. Note however thatAudioStreamPlaybackResampled
have an internal buffer of 1056B.Caveats
Files imported with loop mode set to Forward, Ping-Pong or Backward in a build before #96768 was merged will cause crashes, as it will try to read one index out of bounds. It can be fixed by simply reimporting.