浏览代码

Pause music when window minimized

pull/19/head
Ray 10 年前
父节点
当前提交
7d0407c6a2
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. +7
    -2
      src/audio.c

+ 7
- 2
src/audio.c 查看文件

@ -574,6 +574,7 @@ void PauseMusicStream(void)
{ {
TraceLog(INFO, "Pausing music stream"); TraceLog(INFO, "Pausing music stream");
alSourcePause(currentMusic.source); alSourcePause(currentMusic.source);
musicEnabled = false;
} }
} }
@ -581,10 +582,14 @@ void PauseMusicStream(void)
void ResumeMusicStream(void) void ResumeMusicStream(void)
{ {
// Resume music playing... if music available! // 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); alSourcePlay(currentMusic.source);
musicEnabled = true;
} }
} }

正在加载...
取消
保存