Refactored audio conversion to reduce copying

More of the logic has been moved into SDL_AudioQueue,
allowing data to be converted directly from the input buffer.
This commit is contained in:
Brick
2024-04-04 19:22:29 +01:00
committed by Sam Lantinga
parent ae57b0c9d8
commit edaab8ad9f
7 changed files with 478 additions and 409 deletions

View File

@@ -821,11 +821,6 @@ static double sine_wave_sample(const Sint64 idx, const Sint64 rate, const Sint64
return SDL_sin(((double)(idx * freq % rate)) / ((double)rate) * (SDL_PI_D * 2) + phase);
}
static void free_audio_buffer(void* userdata, const void* buf, int len)
{
SDL_free((void*) buf);
}
/* Split the data into randomly sized chunks */
static int put_audio_data_split(SDL_AudioStream* stream, const void* buf, int len)
{