X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fsound.c;h=2fe510b4115479f815d32e3a4d347df286dc9989;hb=2bb81ea2565c3627c954b5c37326db89b0048472;hp=ab925241120c2e8c22b05234ae1d90ede8edff79;hpb=a2115940e7643dcb1b87286f3d19fe95f7b79bd3;p=flatwaifu.git diff --git a/src/sound.c b/src/sound.c index ab92524..2fe510b 100644 --- a/src/sound.c +++ b/src/sound.c @@ -21,8 +21,8 @@ */ #include "glob.h" -#include "files.h" #include "sound.h" +#include "error.h" #include #include @@ -31,15 +31,13 @@ short snd_vol = 50; -int snddisabled = 1; - -struct { +static int snddisabled = 1; +static struct { snd_t *s; Mix_Chunk *c; } chunks[NUM_CHUNKS]; -void S_init(void) -{ +void S_init (void) { if (!SDL_WasInit(SDL_INIT_AUDIO)) { if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { fprintf(stderr, "\nUnable to initialize audio: %s\n", SDL_GetError()); @@ -71,15 +69,15 @@ void S_init(void) S_volume(snd_vol); } -void S_done(void) -{ +void S_done (void) { free_chunks(); - Mix_CloseAudio(); - SDL_QuitSubSystem(SDL_INIT_AUDIO); + if (SDL_WasInit(SDL_INIT_AUDIO)) { + Mix_CloseAudio(); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + } } -Mix_Chunk * get_chunk(snd_t *s, int r, int v) -{ +static Mix_Chunk *get_chunk (snd_t *s, int r, int v) { int i, fi = -1; for(i=0; i128) snd_vol=128; @@ -147,8 +141,7 @@ void S_volume(int v) Mix_Volume(-1, snd_vol); } -void S_wait() -{ +void S_wait (void) { if (snddisabled) return; while (Mix_Playing(-1)) { SDL_Delay(10);