void SoundManager::fadeOutMusic(const int ms) { if (!mPlayMusic) return; mCurrentMusicFile.clear(); if (!mInstalled) return; logger->log("SoundManager::fadeOutMusic() Fading-out (%i ms)", ms); if (mMusic && mFadeoutMusic) { Mix_FadeOutMusic(ms); // Note: The fadeOutCallBack handler will take care about freeing // the music file at fade out ending. } else { sFadingOutEnded = true; if (!mFadeoutMusic) haltMusic(); } }
void Sound::close() { if (!mInstalled) return; haltMusic(); logger->log("Sound::close() Shutting down sound..."); Mix_CloseAudio(); mInstalled = false; }
void Sound::fadeInMusic(const std::string &path, int ms) { mCurrentMusicFile = path; if (!mInstalled) return; haltMusic(); if ((mMusic = loadMusic(path.c_str()))) Mix_FadeInMusic(mMusic, -1, ms); // Loop forever }
void Sound::playMusic(const std::string &filename) { mCurrentMusicFile = filename; if (!mInstalled) return; haltMusic(); if ((mMusic = loadMusic(filename))) Mix_PlayMusic(mMusic, -1); // Loop forever }
void Sound::fadeInMusic(const std::string &fileName, int ms) { mCurrentMusicFile = fileName; if (!mInstalled || !mPlayMusic) return; haltMusic(); if (!fileName.empty()) { mMusic = loadMusic(fileName); if (mMusic) mMusic->play(-1, ms); } }
void SoundManager::playMusic(const std::string &fileName) { if (!mInstalled || !mPlayMusic) return; if (mCurrentMusicFile == fileName) return; mCurrentMusicFile = fileName; haltMusic(); if (!fileName.empty()) { mMusic = loadMusic(fileName); if (mMusic) mMusic->play(); } }
void stopAllChannels() { stopSound(); haltMusic(); }
void SoundManager::stopMusic() { haltMusic(); }
void Sound::stopMusic() { haltMusic(); }