From 4cb44499b27cd8fe4955a16a9af46cf97ecf06e3 Mon Sep 17 00:00:00 2001 From: realtradam Date: Fri, 16 Jun 2023 02:17:51 -0400 Subject: switch SDL_Init to use SDL_InitSubSystem and move to where relevant --- src/audio/rodeo_audio.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/audio/rodeo_audio.c') diff --git a/src/audio/rodeo_audio.c b/src/audio/rodeo_audio.c index 485ddfd..78cef3d 100644 --- a/src/audio/rodeo_audio.c +++ b/src/audio/rodeo_audio.c @@ -19,17 +19,42 @@ void rodeo_audio_init(uint32_t channels) { - if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) + rodeo_log( + rodeo_logLevel_info, + "Initializing SDL Audio..." + ); + if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { rodeo_log( rodeo_logLevel_error, "Failed to initialize SDL Audio. SDL_Error: %s", SDL_GetError() ); + exit(EXIT_FAILURE); + } + rodeo_log( + rodeo_logLevel_info, + "Success initializing SDL Audio" + ); + rodeo_log( + rodeo_logLevel_info, + "Initializing SDL Mixer..." + ); + if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) + { + rodeo_log( + rodeo_logLevel_error, + "Failed to initialize SDL Mixer. SDL_Error: %s", + SDL_GetError() + ); } else { - Mix_AllocateChannels((int32_t)channels); + rodeo_log( + rodeo_logLevel_info, + "Success initializing SDL Mixer" + ); + Mix_AllocateChannels((int32_t)channels); /* irodeo_audio_channelPool_num = 1; //num_sound_pools; irodeo_audio_channelPool_size = channels; //size_sound_pools; -- cgit v1.2.3