diff --git a/rwengine/include/audio/MADStream.hpp b/rwengine/include/audio/MADStream.hpp index bd789d20..cef1cacb 100644 --- a/rwengine/include/audio/MADStream.hpp +++ b/rwengine/include/audio/MADStream.hpp @@ -49,6 +49,7 @@ public: ~MADStream(); bool openFromFile(const std::string& loc); + void play(); }; #endif diff --git a/rwengine/include/audio/SoundManager.hpp b/rwengine/include/audio/SoundManager.hpp index 63d15eeb..3639d2b2 100644 --- a/rwengine/include/audio/SoundManager.hpp +++ b/rwengine/include/audio/SoundManager.hpp @@ -25,6 +25,7 @@ public: bool playBackground(const std::string& fileName); bool loadMusic(const std::string& name, const std::string& fileName); + void playMusic(const std::string& name); void pause(bool p); diff --git a/rwengine/src/audio/MADStream.cpp b/rwengine/src/audio/MADStream.cpp index 6ac1e0c5..f88b20fa 100644 --- a/rwengine/src/audio/MADStream.cpp +++ b/rwengine/src/audio/MADStream.cpp @@ -148,3 +148,8 @@ bool MADStream::openFromFile(const std::string& loc) return true; } + +void MADStream::play() +{ + alCheck(alSourcePlay(alSource)); +} diff --git a/rwengine/src/audio/SoundManager.cpp b/rwengine/src/audio/SoundManager.cpp index cf15fc95..ca465321 100644 --- a/rwengine/src/audio/SoundManager.cpp +++ b/rwengine/src/audio/SoundManager.cpp @@ -132,6 +132,10 @@ bool SoundManager::loadMusic(const std::string& name, const std::string& fileNam musics.emplace(std::piecewise_construct, std::forward_as_tuple(name), std::forward_as_tuple()); return musics[name].openFromFile(fileName); } +void SoundManager::playMusic(const std::string& name) +{ + musics[name].play(); +} void SoundManager::pause(bool p) {