sound free?

This commit is contained in:
doitux
2007-05-31 07:46:19 +00:00
parent 830e7dc6ee
commit 68a3abdc75
3 changed files with 48 additions and 23 deletions
+8 -5
View File
@@ -6138,6 +6138,9 @@
<property name="text" >
<string>Quit</string>
</property>
<property name="shortcut" >
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionAboutPokerth" >
<property name="text" >
@@ -6169,6 +6172,11 @@
</action>
</widget>
<customwidgets>
<customwidget>
<class>MyRightTabWidget</class>
<extends>QTabWidget</extends>
<header>myrighttabwidget.h</header>
</customwidget>
<customwidget>
<class>MyLeftTabWidget</class>
<extends>QTabWidget</extends>
@@ -6179,11 +6187,6 @@
<extends>QLabel</extends>
<header>mysetlabel.h</header>
</customwidget>
<customwidget>
<class>MyRightTabWidget</class>
<extends>QTabWidget</extends>
<header>myrighttabwidget.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>spinBox_set</tabstop>
+39 -17
View File
@@ -486,9 +486,6 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
int width = tempMetrics.width(tr("Stop"));
pushButton_break->setMinimumSize(width+10,20);
//ShortCuts
// QShortcut *startNewGameKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_N), this);
// connect( startNewGameKeys, SIGNAL(activated() ), actionNewGame, SLOT( trigger() ) );
//Clear Focus
groupBox_LeftToolBox->clearFocus();
@@ -521,6 +518,12 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
myWaitingForServerGameDialog = new waitForServerToStartGameDialogImpl(this);
myAboutPokerthDialog = new aboutPokerthImpl(this);
// //ShortCuts
// QShortcut *quitPokerTHKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_Q), this);
// connect( quitPokerTHKeys, SIGNAL(activated() ), actionQuit, SLOT( trigger() ) );
//Connects
connect(dealFlopCards0Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards1() ));
connect(dealFlopCards1Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards2() ));
@@ -638,16 +641,18 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
audio_buffers = 4096;
music = NULL;
SDL_Init(SDL_INIT_AUDIO);
if (myConfig->readConfigInt("PlaySoundEffects")) {
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
printf("Unable to open audio!\n");
exit(1);
}
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
//SOUNDTESTING
SDL_Init(SDL_INIT_AUDIO);
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
printf("Unable to open audio!\n");
exit(1);
}
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
//SOUNDTESTING
}
}
mainWindowImpl::~mainWindowImpl() {
@@ -869,8 +874,18 @@ void mainWindowImpl::callSettingsDialog() {
}
}
}
//Audio Clean?
if (myConfig->readConfigInt("PlaySoundEffects") == 0) { SDLMixerClean(); }
else {
// SDL_Init(SDL_INIT_AUDIO);
//
// if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
// printf("Unable to open audio!\n");
// exit(1);
// }
//
// Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
}
}
}
@@ -2519,7 +2534,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
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) { playSound(); } //s
if (event->key() == Qt::Key_W) { qApp->quit(); } //s
// if (event->key() == Qt::Key_W) { qApp->quit(); } //s
if (event->key() == 16777249) {
pushButton_break->click();
ctrlPressed = TRUE;
@@ -2610,6 +2625,15 @@ void mainWindowImpl::musicDone() {
music = NULL;
}
void mainWindowImpl::SDLMixerClean() {
//SOUND close
Mix_HaltMusic();
Mix_FreeMusic(music);
music = NULL;
// Mix_CloseAudio();
// SDL_Quit();
}
void mainWindowImpl::playSound() {
if(myConfig->readConfigInt("PlaySoundEffects")) {
@@ -2638,9 +2662,7 @@ void mainWindowImpl::quitPokerTH() {
mySession->terminateNetworkClient();
if (myServerGuiInterface.get()) myServerGuiInterface->getSession().terminateNetworkServer();
//SOUND close
Mix_CloseAudio();
SDL_Quit();
SDLMixerClean();
// cout << "PokerTH finished" << endl;
qApp->quit();
+1 -1
View File
@@ -253,9 +253,9 @@ public slots:
void userActionTimeOutReached();
//SOUND TESTING
void playSound();
void musicDone();
void SDLMixerClean();
void quitPokerTH();