Pause music when window minimized

This commit is contained in:
Ray 2015-01-21 00:12:54 +01:00
parent c00cd38b01
commit 7d0407c6a2

View File

@ -574,6 +574,7 @@ void PauseMusicStream(void)
{
TraceLog(INFO, "Pausing music stream");
alSourcePause(currentMusic.source);
musicEnabled = false;
}
}
@ -581,10 +582,14 @@ void PauseMusicStream(void)
void ResumeMusicStream(void)
{
// Resume music playing... if music available!
if (musicEnabled)
ALenum state;
alGetSourcei(currentMusic.source, AL_SOURCE_STATE, &state);
if (state == AL_PAUSED)
{
TraceLog(INFO, "Resume music stream");
TraceLog(INFO, "Resuming music stream");
alSourcePlay(currentMusic.source);
musicEnabled = true;
}
}