1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Add pause(), pauseef(), and resumeef() to musicclass

musicclass already had a resume() function for music.

These are just wrappers around the appropriate SDL_mixer functions, to
avoid direct function calls to the mixer API. So if we ever need to do
something with all callers of pausing and resuming in the future, or we
switch to a different audio backend, the work is already done for us.

Also it just looks cleaner to be calling our musicclass function instead
of doing a direct API call to the mixer.
This commit is contained in:
Misa 2021-04-02 12:07:19 -07:00 committed by Ethan Lee
parent 92b3c0b413
commit 6d3a73c540
2 changed files with 18 additions and 0 deletions

View file

@ -264,6 +264,11 @@ void musicclass::fadein(void)
resume(3000); // 3000 ms fadein
}
void musicclass::pause(void)
{
Mix_PauseMusic();
}
void musicclass::haltdasmusik(void)
{
Mix_HaltMusic();
@ -391,3 +396,13 @@ void musicclass::playef(int t)
fprintf(stderr, "Unable to play WAV file: %s\n", Mix_GetError());
}
}
void musicclass::pauseef(void)
{
Mix_Pause(-1);
}
void musicclass::resumeef(void)
{
Mix_Resume(-1);
}

View file

@ -17,6 +17,7 @@ public:
void play(int t, const double position_sec = 0.0, const int fadein_ms = 3000);
void resume(const int fadein_ms = 0);
void pause(void);
void haltdasmusik(void);
void silencedasmusik(void);
void setfadeamount(const int fade_ms);
@ -33,6 +34,8 @@ public:
int resumesong;
void playef(int t);
void pauseef(void);
void resumeef(void);
std::vector<SoundTrack> soundTracks;
std::vector<MusicTrack> musicTracks;