From e9addb5a5e072b28eecfa1739ae38d67b68a2b23 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 28 Dec 2013 12:30:46 +0100 Subject: Added smooth transition in music - issue #205 --- src/sound/oalsound/alsound.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/sound/oalsound/alsound.h') diff --git a/src/sound/oalsound/alsound.h b/src/sound/oalsound/alsound.h index 2fdcff5..cd3bdd5 100644 --- a/src/sound/oalsound/alsound.h +++ b/src/sound/oalsound/alsound.h @@ -31,10 +31,17 @@ #include #include +#include #include +struct OldMusic { + Channel* music; + float fadeTime; + float currentTime; +}; + class ALSound : public CSoundInterface { public: @@ -65,11 +72,11 @@ public: bool StopAll(); bool MuteAll(bool bMute); - bool PlayMusic(int rank, bool bRepeat); - bool PlayMusic(const std::string &filename, bool bRepeat); + bool PlayMusic(int rank, bool bRepeat, float fadeTime=5.0f); + bool PlayMusic(const std::string &filename, bool bRepeat, float fadeTime=5.0f); bool RestartMusic(); void SuspendMusic(); - void StopMusic(); + void StopMusic(float fadeTime=5.0f); bool IsPlayingMusic(); private: @@ -86,6 +93,7 @@ private: std::map m_music; std::map m_channels; Channel *m_currentMusic; + std::list m_oldMusic; Math::Vector m_eye; Math::Vector m_lookat; }; -- cgit v1.2.3-1-g7c22