Register
Handmade Hero»Forums»Code»Handling wrapping in the mixer code
9 posts
Handling wrapping in the mixer code
1 week, 1 day ago Edited by Terans on June 7, 2021, 7:52 p.m. Reason: Initial post
Hi, in the audio mixer, we do a linear interpolation between two samples, but how does Casey handles the fact that we might read one index past the end of the buffer? In this case, we should rather lerp between buffer[size - 1] and buffer[0], and not buffer[size - 1] and buffer[size]?
It's on the line 231 in handmade_audio.cpp
Mārtiņš Možeiko
2232 posts / 1 project
Handling wrapping in the mixer code
1 week, 1 day ago
That is handled in asset builder - when it parses wave file and prepares sound asset for runtime, it pads with extra zeroes: https://guide.handmadehero.org/code/day145/#990