aboutsummaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c29
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);
-
}