twn_audio: settle down on float32 2-channel sampling only, format enums to style used elsewhere

This commit is contained in:
2024-10-01 12:59:01 +03:00
parent 57fe5e8946
commit a0ea657eb9
4 changed files with 31 additions and 42 deletions

View File

@ -383,14 +383,16 @@ static bool initialize(void) {
SDL_zero(request);
request.freq = AUDIO_FREQUENCY;
request.format = AUDIO_S16;
request.channels = AUDIO_N_CHANNELS;
request.format = AUDIO_F32;
request.channels = 2;
request.callback = audio_callback;
/* TODO: check for errors */
ctx.audio_device = SDL_OpenAudioDevice(NULL, 0, &request, &got, 0);
ctx.audio_stream_format = got.format;
ctx.audio_stream_frequency = got.freq;
ctx.audio_stream_channel_count = got.channels;
SDL_assert_always(got.format == AUDIO_F32);
SDL_assert_always(got.channels == 2);
SDL_PauseAudioDevice(ctx.audio_device, 0);