All sounds are now only played if sound output is on (even the ping in network game). Audio is only initialized if it is enabled. Fixed double sounds in network games. Simplified fading out cards on fold.
This commit is contained in:
@@ -97,8 +97,6 @@ void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); }
|
||||
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
||||
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
||||
|
||||
void GuiWrapper::fadeOutHumanPlayerCards() { myW->signalFadeOutHumanPlayerCards(); }
|
||||
|
||||
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
||||
void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); }
|
||||
|
||||
@@ -96,8 +96,6 @@ public:
|
||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||
void logPlayerWinGame(std::string playerName, int gameID);
|
||||
|
||||
void fadeOutHumanPlayerCards();
|
||||
|
||||
void SignalNetClientConnect(int actionID);
|
||||
void SignalNetClientGameInfo(int actionID);
|
||||
void SignalNetClientError(int errorID, int osErrorID);
|
||||
|
||||
@@ -629,9 +629,6 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(this, SIGNAL(signalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
|
||||
connect(this, SIGNAL(signalNetServerPlayerLeft(QString)), myStartNetworkGameDialog, SLOT(removePlayer(QString)));
|
||||
|
||||
connect(this, SIGNAL(signalFadeOutHumanPlayerCards()), this, SLOT( fadeOutHumanPlayerCards()));
|
||||
|
||||
|
||||
//Sound
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
|
||||
@@ -841,8 +838,9 @@ void mainWindowImpl::callSettingsDialog() {
|
||||
}
|
||||
}
|
||||
}
|
||||
//Audio Clean?
|
||||
if (myConfig->readConfigInt("PlaySoundEffects") == 0) { mySDLPlayer->audioDone(); }
|
||||
// Re-init audio.
|
||||
mySDLPlayer->closeAudio();
|
||||
mySDLPlayer->initAudio();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1078,13 +1076,16 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||
actionLabelArray[playerID]->setPixmap(QPixmap(":/actions/resources/graphics/actions/action_"+actionArray[playerAction]+".png"));
|
||||
|
||||
//play sounds if exist
|
||||
if(myConfig->readConfigInt("PlaySoundEffects")) mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
|
||||
mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
|
||||
}
|
||||
|
||||
if (playerAction == 1) {
|
||||
// groupBoxArray[i]->setDisabled(TRUE);
|
||||
|
||||
if(playerID != 0) {
|
||||
if (playerAction == 1) { // FOLD
|
||||
|
||||
if (playerID == 0) {
|
||||
holeCardsArray[0][0]->startFadeOut(10);
|
||||
holeCardsArray[0][1]->startFadeOut(10);
|
||||
}
|
||||
else {
|
||||
holeCardsArray[playerID][0]->setPixmap(onePix, FALSE);
|
||||
holeCardsArray[playerID][1]->setPixmap(onePix, FALSE);
|
||||
}
|
||||
@@ -1584,12 +1585,6 @@ void mainWindowImpl::myFold(){
|
||||
currentHand->getPlayerArray()[0]->setMyAction(1);
|
||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||
|
||||
if (!mySession->isNetworkClientRunning())
|
||||
{
|
||||
holeCardsArray[0][0]->startFadeOut(10);
|
||||
holeCardsArray[0][1]->startFadeOut(10);
|
||||
}
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
@@ -1809,7 +1804,8 @@ void mainWindowImpl::myActionDone() {
|
||||
// TODO: Should not call in networking game.
|
||||
disableMyButtons();
|
||||
|
||||
nextPlayerAnimation();
|
||||
if (!mySession->isNetworkClientRunning())
|
||||
nextPlayerAnimation();
|
||||
}
|
||||
|
||||
void mainWindowImpl::nextPlayerAnimation() {
|
||||
@@ -2646,12 +2642,6 @@ void mainWindowImpl::networkGameModification() {
|
||||
|
||||
}
|
||||
|
||||
void mainWindowImpl::fadeOutHumanPlayerCards() {
|
||||
|
||||
holeCardsArray[0][0]->startFadeOut(10);
|
||||
holeCardsArray[0][1]->startFadeOut(10);
|
||||
}
|
||||
|
||||
void mainWindowImpl::closeEvent(QCloseEvent *event) { quitPokerTH(); }
|
||||
|
||||
void mainWindowImpl::quitPokerTH() {
|
||||
|
||||
@@ -129,8 +129,6 @@ signals:
|
||||
void signalNetServerPlayerJoined(QString playerName);
|
||||
void signalNetServerPlayerLeft(QString playerName);
|
||||
|
||||
void signalFadeOutHumanPlayerCards();
|
||||
|
||||
public slots:
|
||||
|
||||
void initGui(int speed);
|
||||
@@ -270,8 +268,6 @@ public slots:
|
||||
void localGameModification();
|
||||
void networkGameModification();
|
||||
|
||||
void fadeOutHumanPlayerCards();
|
||||
|
||||
void quitPokerTH();
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using namespace std;
|
||||
SDLPlayer::SDLPlayer(ConfigFile *c)
|
||||
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
|
||||
{
|
||||
SDL_Init(SDL_INIT_AUDIO);
|
||||
initAudio();
|
||||
}
|
||||
|
||||
@@ -25,21 +26,23 @@ SDLPlayer::SDLPlayer(ConfigFile *c)
|
||||
SDLPlayer::~SDLPlayer()
|
||||
{
|
||||
closeAudio();
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
void SDLPlayer::initAudio() {
|
||||
|
||||
audio_rate = 44100;
|
||||
audio_format = AUDIO_S16; /* 16-bit stereo */
|
||||
audio_channels = 2;
|
||||
audio_buffers = 4096;
|
||||
sound = NULL;
|
||||
if (myConfig->readConfigInt("PlaySoundEffects"))
|
||||
{
|
||||
audio_rate = 44100;
|
||||
audio_format = AUDIO_S16; /* 16-bit stereo */
|
||||
audio_channels = 2;
|
||||
audio_buffers = 4096;
|
||||
sound = NULL;
|
||||
|
||||
SDL_Init(SDL_INIT_AUDIO);
|
||||
|
||||
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
||||
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||
audioEnabled = 1;
|
||||
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
||||
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||
audioEnabled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,5 +124,4 @@ void SDLPlayer::closeAudio() {
|
||||
audioDone();
|
||||
Mix_CloseAudio();
|
||||
}
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user