diff --git a/lib/sound/track.c b/lib/sound/track.c index 577a97605..bdcc1e885 100644 --- a/lib/sound/track.c +++ b/lib/sound/track.c @@ -262,7 +262,7 @@ BOOL sound_LoadTrackFromFile(char szFileName[]) // ======================================================================================================================= // ======================================================================================================================= // -BOOL sound_ReleaseTrack( TRACK *psTrack ) +void sound_ReleaseTrack( TRACK *psTrack ) { //~~~~~~~~~~~ SDWORD iTrack; @@ -282,7 +282,7 @@ BOOL sound_ReleaseTrack( TRACK *psTrack ) } sound_FreeTrack( psTrack ); - return TRUE; + FREE( psTrack ); } //* diff --git a/lib/sound/track.h b/lib/sound/track.h index 206a6703a..3d8ad6311 100644 --- a/lib/sound/track.h +++ b/lib/sound/track.h @@ -117,7 +117,7 @@ BOOL sound_LoadTrackFromFile(char szFileName[]); TRACK * sound_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize); BOOL sound_SetTrackVals( TRACK *psTrack, BOOL bLoop, SDWORD iTrack, SDWORD iVol, SDWORD iPriority, SDWORD iAudibleRadius); -BOOL sound_ReleaseTrack( TRACK * psTrack ); +void sound_ReleaseTrack( TRACK * psTrack ); void sound_StopTrack( AUDIO_SAMPLE *psSample ); void sound_PauseTrack( AUDIO_SAMPLE *psSample ); diff --git a/src/data.c b/src/data.c index 8d620f58d..5350154fa 100644 --- a/src/data.c +++ b/src/data.c @@ -989,36 +989,23 @@ void dataTexPageRelease(void *pData) /* Load an audio file */ BOOL dataAudioLoad(char *pBuffer, UDWORD size, void **ppData) { - TRACK *psTrack; + // If audio is disabled or a track can't be constructed the return value will be NULL + *ppData = audio_LoadTrackFromBuffer( pBuffer, size ); - if ( audio_Disabled() == TRUE ) - { - *ppData = NULL; - return TRUE; - } - else if ( (psTrack = audio_LoadTrackFromBuffer( pBuffer, size )) == NULL ) - { + if (*ppData == NULL) return FALSE; - } - - /* save track data */ - *ppData = psTrack; return TRUE; } void dataAudioRelease( void *pData ) { - if (audio_Disabled() == FALSE) - { - TRACK *psTrack = (TRACK *) pData; + TRACK *psTrack = (TRACK *) pData; - ASSERT( PTRVALID(psTrack, sizeof(TRACK)), - "dataAudioRelease: invalid track pointer" ); + ASSERT( PTRVALID(psTrack, sizeof(TRACK)), + "dataAudioRelease: invalid track pointer" ); - audio_ReleaseTrack( psTrack ); - FREE( psTrack ); - } + audio_ReleaseTrack( psTrack ); } @@ -1294,6 +1281,3 @@ BOOL dataInitLoadFuncs(void) return TRUE; } - - -