From d2c3f612b3d7b0071e98e589777d495ba45eafe4 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sun, 29 Oct 2023 08:26:31 +0100 Subject: more sounds --- main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index ef9d26e..87ac283 100644 --- a/main.c +++ b/main.c @@ -77,6 +77,9 @@ void handle_args(int argc, char **argv) { } connect_to_server(ip, port); } + + log_info("STATE: GAMESTATE_PLAYING"); + global_state.state = GAMESTATE_PLAYING; } int main(int argc, char **argv) @@ -91,8 +94,13 @@ int main(int argc, char **argv) settings_set_number("USE_GPU", 1); if (Mix_OpenAudio(48000, AUDIO_F32SYS, 2, 2048) == 0) { - log_info("Audio system initialized."); - Mix_MasterVolume(MIX_MAX_VOLUME/4); + if (Mix_AllocateChannels(NUMBER_OF_AUDIO_CHANNELS) == 64) { + log_info("Audio system initialized."); + Mix_MasterVolume(MIX_MAX_VOLUME/4); + } + else { + log_info("Channel allocation failed."); + } } else { log_info("Audio failed."); @@ -102,7 +110,7 @@ int main(int argc, char **argv) bool did_handle_args = false; while(platform_keep_running(window)) { - if (global_asset_collection.done_loading_assets && !did_handle_args) { + if (global_asset_collection.done_loading_assets && !did_handle_args && global_state.state == GAMESTATE_LOADING_ASSETS) { handle_args(argc, argv); did_handle_args = true; } -- cgit v1.2.3-70-g09d2