diff options
-rw-r--r-- | src/audio.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/audio.c b/src/audio.c index 82d70f9..2690c61 100644 --- a/src/audio.c +++ b/src/audio.c @@ -63,12 +63,12 @@ static void audio_mix(void *data, Uint8 *stream8, int len) { if ( a->sounds[i].dpos == a->sounds[i].dlen ) { if ( a->sounds[i].repeat ) { a->sounds[i].dpos = 0; - if ( a->debug ) printf("AU: Looping sound %i at buffer offset %i/%i\n", i, j, len); + if ( a->debug ) printf("AU: Channel %i: Looping at buffer offset %i/%i\n", i, j, len); } else { a->sounds[i].inuse = 0; a->sounds[i].playing = 0; free(a->sounds[i].data); - if ( a->debug ) printf("AU: End of sound %i\n", i); + if ( a->debug ) printf("AU: Channel %i: End of data\n", i); break; } } @@ -112,11 +112,11 @@ static void audio_play_wav(AudioContext *a, char *filename, float volume, int re return; } a->sounds[idx].inuse = 1; - if ( a->debug ) printf("AU: Selected channel %i for sound '%s'\n", idx, filename); + if ( a->debug ) printf("AU: Channel %i: Selected this channel for sound '%s'\n", idx, filename); /* Load the sound file and convert it to 16-bit stereo at 44.1 kHz */ if ( SDL_LoadWAV(filename, &wave, &data, &dlen) == NULL ) { - fprintf(stderr, "Couldn't load %s: %s\n", filename, SDL_GetError()); + fprintf(stderr, "Couldn't load %s: (channel %i) %s\n", filename, idx, SDL_GetError()); return; } SDL_BuildAudioCVT(&cvt, wave.format, wave.channels, wave.freq, AUDIO_S16, 2, 44100); @@ -162,30 +162,30 @@ static void *audio_play_vorbis(void *add_void) { return NULL; } a->sounds[idx].inuse = 1; - if ( a->debug ) printf("AU: Selected channel %i for sound '%s'\n", idx, filename); + if ( a->debug ) printf("AU: Channel %i: Selected this channel for sound '%s'\n", idx, filename); err = ov_fopen(filename, &vf); if ( err != 0 ) { - fprintf(stderr, "Couldn't open Vorbis file '%s' (code %i,%i)\n", filename, err, errno); + fprintf(stderr, "Couldn't open Vorbis file '%s' (channel %i, code %i,%i)\n", filename, idx, err, errno); return NULL; } len = ov_pcm_total(&vf, -1); /* Length in samples 'per channel' */ - if ( a->debug ) printf("AU: Length is %i samples 'per channel'\n", len); + if ( a->debug ) printf("AU: Channel %i: Length is %i samples 'per channel'\n", idx, len); vi = ov_info(&vf,-1); - if ( a->debug ) printf("AU: %i channels, %li Hz\n", vi->channels, vi->rate); + if ( a->debug ) printf("AU: Channel %i: %i channels, %li Hz\n", idx, vi->channels, vi->rate); data = malloc(vi->channels*2*len); /* Two bytes per sample per channel */ offs = 0; finished = 0; - if ( a->debug ) printf("AU: Decoding Vorbis stream...\n"); + if ( a->debug ) printf("AU: Channel %i: Decoding Vorbis stream...\n", idx); while ( finished == 0 ) { long rval; rval = ov_read(&vf, data+offs, 2*2*len, 0, 2, 1, ¤t_section); if ( rval == 0 ) { finished = 1; } else if ( rval < 0 ) { - fprintf(stderr, "Vorbis stream error\n"); + fprintf(stderr, "Vorbis stream error (channel %i)\n", idx); } else { offs += rval; } @@ -212,7 +212,7 @@ static void *audio_play_vorbis(void *add_void) { free(add->filename); free(add); - if ( a->debug ) printf("AU: audio_play_vorbis dispatch thread completed.\n"); + if ( a->debug ) printf("AU: Channel %i: audio_play_vorbis dispatch thread completed.\n", idx); return NULL; } |