* Sound related bug fixes from Thilo Schulz

This commit is contained in:
Tim Angus 2006-02-26 18:47:39 +00:00
parent c93d8fc185
commit 40a5ee007f
2 changed files with 19 additions and 2 deletions

View file

@ -412,7 +412,7 @@ where we read the whole stream at once.
void *S_OGG_CodecLoad(const char *filename, snd_info_t *info) void *S_OGG_CodecLoad(const char *filename, snd_info_t *info)
{ {
snd_stream_t *stream; snd_stream_t *stream;
unsigned char *buffer; byte *buffer;
int bytesRead; int bytesRead;
// check if input is valid // check if input is valid
@ -452,8 +452,9 @@ void *S_OGG_CodecLoad(const char *filename, snd_info_t *info)
// we don't even have read a single byte // we don't even have read a single byte
if(bytesRead <= 0) if(bytesRead <= 0)
{ {
Z_Free(buffer);
S_OGG_CodecCloseStream(stream); S_OGG_CodecCloseStream(stream);
return NULL; return NULL;
} }

View file

@ -1377,7 +1377,23 @@ void S_AL_StartBackgroundTrack( const char *intro, const char *loop )
// Queue the musicBuffers up // Queue the musicBuffers up
for(i = 0; i < NUM_MUSIC_BUFFERS; i++) for(i = 0; i < NUM_MUSIC_BUFFERS; i++)
{
S_AL_MusicProcess(musicBuffers[i]); S_AL_MusicProcess(musicBuffers[i]);
// check whether our stream still exists.
if(!mus_stream)
{
// there was an error in reading which resulted in a
// closed stream. We must bail out or we'll crash.
// deallocate everything we allocated so far:
qalDeleteBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
S_AL_MusicSourceFree();
return;
}
}
qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers); qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
// Set the initial gain property // Set the initial gain property