diff --git a/src/engine/local_engine/localflop.cpp b/src/engine/local_engine/localflop.cpp index 0fef86af..cf555609 100755 --- a/src/engine/local_engine/localflop.cpp +++ b/src/engine/local_engine/localflop.cpp @@ -90,7 +90,7 @@ void LocalFlop::flopRun() { myHand->getGuiInterface()->refreshSet(); myHand->getGuiInterface()->refreshCash(); - myHand->getGuiInterface()->refreshAction(); + for(i=0; igetGuiInterface()->refreshAction(i,0); } myHand->switchRounds(); } diff --git a/src/engine/local_engine/localriver.cpp b/src/engine/local_engine/localriver.cpp index c0c07b6e..f964e977 100755 --- a/src/engine/local_engine/localriver.cpp +++ b/src/engine/local_engine/localriver.cpp @@ -92,7 +92,8 @@ void LocalRiver::riverRun() { myHand->getGuiInterface()->refreshSet(); myHand->getGuiInterface()->refreshCash(); - myHand->getGuiInterface()->refreshAction(); + for(i=0; igetGuiInterface()->refreshAction(i,0); } + myHand->switchRounds(); } diff --git a/src/engine/local_engine/localturn.cpp b/src/engine/local_engine/localturn.cpp index d7881f5a..82f17ecd 100755 --- a/src/engine/local_engine/localturn.cpp +++ b/src/engine/local_engine/localturn.cpp @@ -92,7 +92,7 @@ void LocalTurn::turnRun() { myHand->getGuiInterface()->refreshSet(); myHand->getGuiInterface()->refreshCash(); - myHand->getGuiInterface()->refreshAction(); + for(i=0; igetGuiInterface()->refreshAction(i,0); } myHand->switchRounds(); } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 2d4b68ff..aa19bd41 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -1063,6 +1063,10 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) { holeCardsArray[playerID][1]->setPixmap(onePix, FALSE); } } + + //play sounds if exist + mySDLPlayer->playSound(actionArray[playerAction].toStdString()); + } } @@ -1216,10 +1220,14 @@ void mainWindowImpl::refreshGameLabels(int round) { } void mainWindowImpl::refreshAll() { - + + int i; + refreshSet(); refreshButton(); - refreshAction(); + for(i=0; igetCurrentGame()->getPlayerArray()[i]->getMyAction()); + } refreshCash(); refreshGroupbox(); refreshPlayerName(); @@ -1228,8 +1236,12 @@ void mainWindowImpl::refreshAll() { void mainWindowImpl::refreshChangePlayer() { + int i; + refreshSet(); - refreshAction(); + for(i=0; igetCurrentGame()->getPlayerArray()[i]->getMyAction()); + } refreshCash(); } @@ -2499,7 +2511,9 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { if (event->key() == Qt::Key_F11) { switchRightToolBox(); } if (event->key() == Qt::Key_D) { setLabelArray[0]->startTimeOutAnimation(myConfig->readConfigInt("NetTimeOutPlayerAction")); } //f if (event->key() == Qt::Key_E) { setLabelArray[0]->stopTimeOutAnimation(); } //f - if (event->key() == Qt::Key_S) { if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound("dealtwocards"); } //s + if (event->key() == Qt::Key_S) { if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound("call"); } //s + if (event->key() == Qt::Key_A) { if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound("raise"); } //s + if (event->key() == Qt::Key_X) { if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound(""); } //s // if (event->key() == Qt::Key_W) { qApp->quit(); } //s if (event->key() == 16777249) { pushButton_break->click(); diff --git a/src/gui/qt/resources.qrc b/src/gui/qt/resources.qrc index 12127770..62cb73d4 100755 --- a/src/gui/qt/resources.qrc +++ b/src/gui/qt/resources.qrc @@ -75,6 +75,8 @@ resources/sounds/dealtwocards.wav + resources/sounds/call.wav + resources/sounds/raise.wav resources/fonts/VeraBd.ttf diff --git a/src/gui/qt/resources/sounds/call.wav b/src/gui/qt/resources/sounds/call.wav new file mode 100644 index 00000000..209f9018 Binary files /dev/null and b/src/gui/qt/resources/sounds/call.wav differ diff --git a/src/gui/qt/resources/sounds/raise.wav b/src/gui/qt/resources/sounds/raise.wav new file mode 100644 index 00000000..8123eccc Binary files /dev/null and b/src/gui/qt/resources/sounds/raise.wav differ diff --git a/src/gui/qt/sound/sdlplayer.cpp b/src/gui/qt/sound/sdlplayer.cpp index 84eaa0c9..d603a5c9 100644 --- a/src/gui/qt/sound/sdlplayer.cpp +++ b/src/gui/qt/sound/sdlplayer.cpp @@ -43,20 +43,27 @@ void SDLPlayer::initAudio() { void SDLPlayer::playSound(string audioString) { - audioDone(); +// QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav"); +// if(myFile.open(QIODevice::ReadOnly)) { +// +// audioDone(); +// +// QDataStream in(&myFile); +// Uint8 *myMem = new Uint8[(int)myFile.size()]; +// in.readRawData( (char*)myMem, (int)myFile.size() ); +// +// sound = Mix_QuickLoad_WAV( myMem ); +// +// currentChannel = Mix_PlayChannel(-1, sound,0); +// +// delete[] myMem; +// } +// else cout << "could not load " << audioString << ".wav" << endl; - QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav"); - if(!myFile.open(QIODevice::ReadOnly)) cout << "could not load wav" << endl; - - QDataStream in(&myFile); - Uint8 *myMem = new Uint8[(int)myFile.size()]; - in.readRawData( (char*)myMem, (int)myFile.size() ); - - sound = Mix_QuickLoad_WAV( myMem ); - - currentChannel = Mix_PlayChannel(0, sound,0); - - delete[] myMem; + //test + audioDone(); + sound = Mix_LoadWAV( QString(QString::fromStdString(audioString)+QString(".wav")).toStdString().c_str() ); + currentChannel = Mix_PlayChannel(-1, sound,0); }