mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Pause all audio output when the game is unfocused
Some custom levels have their own custom music and sync that music to scripted cutscenes, which is actually pretty impressive. However, they've always run into a small thorn, which is that you can easily desync the music by unfocusing the game, because the audio will keep playing when the game is unfocused. This should remove that thorn by pausing the audio on unfocus, and resuming when focused, so that the music can no longer desync, but you can still pause the game by unfocusing it. This is yet another feature in VCE that hasn't been upstreamed until now.
This commit is contained in:
parent
2016ee1b60
commit
4bea40fc22
1 changed files with 6 additions and 0 deletions
|
@ -379,6 +379,9 @@ int main(int argc, char *argv[])
|
|||
game.infocus = key.isActive;
|
||||
if(!game.infocus)
|
||||
{
|
||||
Mix_Pause(-1);
|
||||
Mix_PauseMusic();
|
||||
|
||||
FillRect(graphics.backBuffer, 0x00000000);
|
||||
graphics.bprint(5, 110, "Game paused", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
|
||||
graphics.bprint(5, 120, "[click to resume]", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
|
||||
|
@ -390,6 +393,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
Mix_Resume(-1);
|
||||
Mix_ResumeMusic();
|
||||
|
||||
switch(game.gamestate)
|
||||
{
|
||||
case PRELOADER:
|
||||
|
|
Loading…
Reference in a new issue