From: notaz Date: Thu, 4 Oct 2012 23:00:26 +0000 (+0300) Subject: make sound reinitable X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=gpsp.git;a=commitdiff_plain;h=40a392b00d8a4b812a61956509f7379ca1f396bc make sound reinitable this will be used for Caanoo overclocking workaround --- diff --git a/main.c b/main.c index 96e6bb6..36901e3 100644 --- a/main.c +++ b/main.c @@ -314,7 +314,7 @@ int main(int argc, char *argv[]) } init_main(); - init_sound(); + init_sound(1); init_input(); diff --git a/sound.c b/sound.c index 9b21e6c..5593bbe 100644 --- a/sound.c +++ b/sound.c @@ -734,12 +734,18 @@ void sound_exit() sound_exit_flag = 1; SDL_CondSignal(sound_cv); SDL_CloseAudio(); + SDL_Delay(200); + SDL_DestroyMutex(sound_mutex); + sound_mutex = NULL; + SDL_DestroyCond(sound_cv); + sound_cv = NULL; } -void init_sound() +void init_sound(int need_reset) { SDL_AudioSpec sound_settings; + sound_exit_flag = 0; #ifdef PSP_BUILD audio_buffer_size = (audio_buffer_size_number * 1024) + 3072; #else @@ -779,7 +785,8 @@ void init_sound() init_noise_table(noise_table15, 32767, 14); init_noise_table(noise_table7, 127, 6); - reset_sound(); + if (need_reset) + reset_sound(); SDL_PauseAudio(0); } diff --git a/sound.h b/sound.h index 58d823b..e432cef 100644 --- a/sound.h +++ b/sound.h @@ -124,7 +124,7 @@ void sound_timer_queue32(u32 channel, u32 value); void sound_timer(fixed8_24 frequency_step, u32 channel); void sound_reset_fifo(u32 channel); void update_gbc_sound(u32 cpu_ticks); -void init_sound(); +void init_sound(int need_reset); void sound_write_mem_savestate(file_tag_type savestate_file); void sound_read_savestate(file_tag_type savestate_file);