# HG changeset patch # User koda # Date 1326845435 -3600 # Node ID 6225b838a63030d8743cff907be53ebfd10063fb # Parent 5bb48450b9782642741c388f43c7759076aab8d7 little hack for playing less sounds in frontend diff -r 5bb48450b978 -r 6225b838a630 QTfrontend/util/SDLInteraction.cpp --- a/QTfrontend/util/SDLInteraction.cpp Wed Jan 18 01:07:07 2012 +0100 +++ b/QTfrontend/util/SDLInteraction.cpp Wed Jan 18 01:10:35 2012 +0100 @@ -193,10 +193,11 @@ if (!m_soundMap->contains(soundFile)) m_soundMap->insert(soundFile, Mix_LoadWAV(soundFile.toLocal8Bit().constData())); - Mix_PlayChannel(-1, m_soundMap->value(soundFile), 0); + //FIXME: this is a hack, but works as long as we have few concurrent playing sounds + if (Mix_Playing(lastchannel) == false) + lastchannel = Mix_PlayChannel(-1, m_soundMap->value(soundFile), 0); } - void SDLInteraction::setMusicTrack(const QString & musicFile) { bool wasPlayingMusic = m_isPlayingMusic; diff -r 5bb48450b978 -r 6225b838a630 QTfrontend/util/SDLInteraction.h --- a/QTfrontend/util/SDLInteraction.h Wed Jan 18 01:07:07 2012 +0100 +++ b/QTfrontend/util/SDLInteraction.h Wed Jan 18 01:10:35 2012 +0100 @@ -59,6 +59,8 @@ QMap * m_soundMap; ///< maps sound file paths to channels + int lastchannel; ///< channel of the last music played + public: /** * @brief Returns reference to the singleton instance of this class.