Browse Source

Pause music when window minimized

pull/19/head
Ray 10 years ago
parent
commit
7d0407c6a2
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/audio.c

+ 7
- 2
src/audio.c 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;
}
}

Loading…
Cancel
Save