diff --git a/data/sounds/default/blinds_raises_level1.wav b/data/sounds/default/blinds_raises_level1.wav new file mode 100644 index 00000000..b834e78c Binary files /dev/null and b/data/sounds/default/blinds_raises_level1.wav differ diff --git a/data/sounds/default/blinds_raises_level2.wav b/data/sounds/default/blinds_raises_level2.wav new file mode 100644 index 00000000..e6661118 Binary files /dev/null and b/data/sounds/default/blinds_raises_level2.wav differ diff --git a/data/sounds/default/blinds_raises_level3.wav b/data/sounds/default/blinds_raises_level3.wav new file mode 100644 index 00000000..18f09dd8 Binary files /dev/null and b/data/sounds/default/blinds_raises_level3.wav differ diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 80195aa4..aeef9f6e 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -43,6 +43,7 @@ #include "configfile.h" #include "sdlplayer.h" +#include "soundevents.h" #include "gametablestylereader.h" #include "carddeckstylereader.h" #include @@ -76,6 +77,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) //Sound mySDLPlayer = new SDLPlayer(myConfig); + mySoundEventHandler = new SoundEvents(myConfig, this); // Init game table style myGameTableStyle = new GameTableStyleReader(myConfig, this); diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 9977a1a3..988c0538 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -50,6 +50,7 @@ class GameTableStyleReader; class CardDeckStyleReader; class SDLPlayer; +class SoundEvents; enum SeatState { SEAT_UNDEFINED, SEAT_ACTIVE, SEAT_AUTOFOLD, SEAT_STAYONTABLE, SEAT_CLEAR }; @@ -63,9 +64,13 @@ public: ~gameTableImpl(); boost::shared_ptr getSession(); + SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; } + SoundEvents* getMySoundEventHandler() const{ + return mySoundEventHandler; + } ChatTools* getMyChat() const { return myChat; } @@ -405,6 +410,7 @@ private: //Sound SDLPlayer *mySDLPlayer; + SoundEvents *mySoundEventHandler; QString myAppDataPath; int distributePotAnimCounter; diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 85ef4f6a..98bd5c0c 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -21,6 +21,7 @@ #include "gametableimpl.h" #include "startwindowimpl.h" #include "configfile.h" +#include "soundevents.h" #include @@ -247,7 +248,9 @@ void GuiWrapper::logNewGameHandMsg(int gameID, int handID) } void GuiWrapper::logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) { + myW->getMySoundEventHandler()->blindsWereSet(sbSet); myGuiLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str())); + } void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main) { diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 83cd74c7..a5766258 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -3349,13 +3349,7 @@ p, li { white-space: pre-wrap; } - - - 9 - - - 6 - + @@ -3513,109 +3507,109 @@ p, li { white-space: pre-wrap; } - - - - - - - 0 - 0 - - - - true - - - 5 - - - false - - - true - - - - Log File - - - - - - - - - - Preview: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - Export as HTML - - - - :/gfx/text-html.png:/gfx/text-html.png - - - - - - - Export as txt - - - - :/gfx/text-plain.png:/gfx/text-plain.png - - - - - - - Save as ... - - - - :/gfx/filesave.png:/gfx/filesave.png - - - - - - - Delete - - - - :/gfx/editdelete.png:/gfx/editdelete.png - - - - - + + + + + + + 0 + 0 + + + + true + + + 5 + + + false + + + true + + + + Log File + + + + + + + + + + Preview: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Export as HTML + + + + :/gfx/text-html.png:/gfx/text-html.png + + + + + + + Export as txt + + + + :/gfx/text-plain.png:/gfx/text-plain.png + + + + + + + Save as ... + + + + :/gfx/filesave.png:/gfx/filesave.png + + + + + + + Delete + + + + :/gfx/editdelete.png:/gfx/editdelete.png + + + + + @@ -3753,7 +3747,6 @@ p, li { white-space: pre-wrap; } comboBox_logInterval lineEdit_logDir pushButton_openLogDir - treeWidget_logFiles pushButton_exportLogHtml pushButton_exportLogTxt pushButton_saveLogAs diff --git a/src/gui/qt/sound/soundevents.cpp b/src/gui/qt/sound/soundevents.cpp index 4d008966..44b3f054 100644 --- a/src/gui/qt/sound/soundevents.cpp +++ b/src/gui/qt/sound/soundevents.cpp @@ -1,8 +1,46 @@ #include "sdlplayer.h" #include "configfile.h" +#include "gametableimpl.h" +#include "session.h" +#include "game.h" #include "soundevents.h" -SoundEvents::SoundEvents(ConfigFile *c): myConfig(c) +SoundEvents::SoundEvents(ConfigFile *c, gameTableImpl *w): myConfig(c), myW(w) { mySDLPlayer = new SDLPlayer(myConfig); } + +SoundEvents::~SoundEvents() +{ + mySDLPlayer->deleteLater(); +} + +void SoundEvents::blindsWereSet(int sB) +{ + int currentGameId = myW->getSession()->getCurrentGame()->getMyGameID(); + if(currentGameId != lastGameId) + { + lastSBLevel = 0; + lastSBValue = sB; + lastGameId = currentGameId; + } + + if(sB > lastSBValue) { + + lastSBValue = sB; + ++lastSBLevel; + + if(lastSBLevel == 1 || lastSBLevel == 2) + { + mySDLPlayer->playSound("blinds_raises_level1", 0); + } + if(lastSBLevel == 3 || lastSBLevel == 4) + { + mySDLPlayer->playSound("blinds_raises_level2", 0); + } + if(lastSBLevel >= 5) + { + mySDLPlayer->playSound("blinds_raises_level3", 0); + } + } +} diff --git a/src/gui/qt/sound/soundevents.h b/src/gui/qt/sound/soundevents.h index 1ab51d9d..e3efbb96 100644 --- a/src/gui/qt/sound/soundevents.h +++ b/src/gui/qt/sound/soundevents.h @@ -3,14 +3,24 @@ class SDLPlayer; class ConfigFile; +class gameTableImpl; class SoundEvents { public: - SoundEvents(ConfigFile*); + SoundEvents(ConfigFile*, gameTableImpl*); + ~SoundEvents(); + + void blindsWereSet(int sB); + + private: SDLPlayer *mySDLPlayer; + gameTableImpl *myW; ConfigFile *myConfig; + unsigned int lastSBValue; + unsigned int lastSBLevel; + unsigned int lastGameId; };