mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-13 00:24:10 +00:00
Fix OpenAL music stop issues using stream stop code
S_AL_StopBackgroundTrack would sometimes generate AL errors. S_AL_MusicSourceFree needs to kill source or next track may have short looping buffer.
This commit is contained in:
parent
6d5041a960
commit
3d69ae9995
1 changed files with 11 additions and 5 deletions
|
@ -1876,6 +1876,7 @@ static void S_AL_MusicSourceFree( void )
|
||||||
{
|
{
|
||||||
// Release the output musicSource
|
// Release the output musicSource
|
||||||
S_AL_SrcUnlock(musicSourceHandle);
|
S_AL_SrcUnlock(musicSourceHandle);
|
||||||
|
S_AL_SrcKill(musicSourceHandle);
|
||||||
musicSource = 0;
|
musicSource = 0;
|
||||||
musicSourceHandle = -1;
|
musicSourceHandle = -1;
|
||||||
}
|
}
|
||||||
|
@ -1908,17 +1909,22 @@ S_AL_StopBackgroundTrack
|
||||||
static
|
static
|
||||||
void S_AL_StopBackgroundTrack( void )
|
void S_AL_StopBackgroundTrack( void )
|
||||||
{
|
{
|
||||||
|
int numBuffers;
|
||||||
|
|
||||||
if(!musicPlaying)
|
if(!musicPlaying)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop playing
|
// Stop playing
|
||||||
qalSourceStop(musicSource);
|
qalSourceStop(musicSource);
|
||||||
|
|
||||||
// De-queue the musicBuffers
|
// Un-queue any buffers, and delete them
|
||||||
qalSourceUnqueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
|
qalGetSourcei( musicSource, AL_BUFFERS_PROCESSED, &numBuffers );
|
||||||
|
while( numBuffers-- )
|
||||||
// Destroy the musicBuffers
|
{
|
||||||
qalDeleteBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
|
ALuint buffer;
|
||||||
|
qalSourceUnqueueBuffers(musicSource, 1, &buffer);
|
||||||
|
qalDeleteBuffers(1, &buffer);
|
||||||
|
}
|
||||||
|
|
||||||
// Free the musicSource
|
// Free the musicSource
|
||||||
S_AL_MusicSourceFree();
|
S_AL_MusicSourceFree();
|
||||||
|
|
Loading…
Reference in a new issue