diff options
author | Thomas White <taw27@cam.ac.uk> | 2009-03-16 16:09:21 +0000 |
---|---|---|
committer | Thomas White <taw27@cam.ac.uk> | 2009-03-16 16:09:21 +0000 |
commit | eac1474a8031ec367a9f21c367e65df9fe8b99fc (patch) | |
tree | f4e7a3d8a0063c149d00d83d4578e1fbc2bdae48 /src/audio.c | |
parent | 6ed7222f16f372b0e99faeb2a237b6a5db9d0016 (diff) |
Linewrap, brackets etc
Diffstat (limited to 'src/audio.c')
-rw-r--r-- | src/audio.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/audio.c b/src/audio.c index fd54041..3cb498b 100644 --- a/src/audio.c +++ b/src/audio.c @@ -43,8 +43,8 @@ static AudioContext *audio_context = NULL; -static void audio_mix(void *data, Uint8 *stream8, int len) { - +static void audio_mix(void *data, Uint8 *stream8, int len) +{ AudioContext *a = data; int j; Sint16 *stream = (Sint16 *)stream8; @@ -64,11 +64,10 @@ static void audio_mix(void *data, Uint8 *stream8, int len) { } } - } -void audio_trigger_moo() { - +void audio_trigger_moo() +{ AudioContext *a = audio_context; if ( a == NULL ) { @@ -89,12 +88,11 @@ void audio_trigger_moo() { if ( a->moo_pos == a->moo_len ) { a->moo_pos = 0; } - } /* SDL audio initial setup */ -void audio_setup() { - +void audio_setup() +{ AudioContext *a; SDL_AudioSpec fmt; SDL_AudioSpec wave; @@ -122,12 +120,15 @@ void audio_setup() { return; } - if ( SDL_LoadWAV(DATADIR"/openmoocow/moo.wav", &wave, &data, &dlen) == NULL ) { - fprintf(stderr, "Couldn't load moo sound: %s\n", SDL_GetError()); + if ( SDL_LoadWAV(DATADIR"/openmoocow/moo.wav", &wave, &data, &dlen) + == NULL ) { + fprintf(stderr, "Couldn't load moo sound: %s\n", + SDL_GetError()); free(a); return; } - SDL_BuildAudioCVT(&cvt, wave.format, wave.channels, wave.freq, AUDIO_S16, 1, 44100); + SDL_BuildAudioCVT(&cvt, wave.format, wave.channels, wave.freq, + AUDIO_S16, 1, 44100); cvt.buf = malloc(dlen*cvt.len_mult); if ( cvt.buf == NULL ) { fprintf(stderr, "Not enough memory to convert audio \n"); @@ -146,11 +147,10 @@ void audio_setup() { audio_context = a; SDL_PauseAudio(0); - } -void audio_shutdown() { - +void audio_shutdown() +{ AudioContext *a = audio_context; if ( a == NULL ) return; @@ -159,5 +159,4 @@ void audio_shutdown() { /* Now this can be freed */ free(a); - } |