Switch to PlayChannel so as not to interrupt background music.
authornemo
Tue, 09 Feb 2010 01:50:36 +0000 (2010-02-09)
changeset 2774 a4fd9eacd286
parent 2773 e94f240a8a41
child 2775 3445ce5e9c79
Switch to PlayChannel so as not to interrupt background music.
QTfrontend/chatwidget.cpp
QTfrontend/pages.cpp
--- a/QTfrontend/chatwidget.cpp	Tue Feb 09 01:47:50 2010 +0000
+++ b/QTfrontend/chatwidget.cpp	Tue Feb 09 01:50:36 2010 +0000
@@ -119,7 +119,7 @@
 
 void HWChatWidget::nickAdded(const QString& nick)
 {
-    Mix_Music *sound;
+    Mix_Chunk *sound;
     QDir tmpdir;
 
 	QListWidgetItem * item = new QListWidgetItem(nick);
@@ -130,8 +130,8 @@
        sdli->SDLMusicInit();
        tmpdir.cd(datadir->absolutePath());
        tmpdir.cd("Sounds/");
-       sound = Mix_LoadMUS(QString(tmpdir.absolutePath() + "/switchhog.ogg").toLocal8Bit().constData());
-       Mix_PlayMusic(sound, 0);
+       sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/switchhog.ogg").toLocal8Bit().constData());
+       Mix_PlayChannel(-1, sound, 0);
     }
 }
 
--- a/QTfrontend/pages.cpp	Tue Feb 09 01:47:50 2010 +0000
+++ b/QTfrontend/pages.cpp	Tue Feb 09 01:50:36 2010 +0000
@@ -306,7 +306,7 @@
 
 void PageEditTeam::testSound()
 {
-	Mix_Music *sound;
+	Mix_Chunk *sound;
 	QDir tmpdir;
 	mySdli->SDLMusicInit();
 	
@@ -315,8 +315,8 @@
 	tmpdir.cd(CBVoicepack->currentText());
 	QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
 	if (list.size()) {
-		sound = Mix_LoadMUS(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
-		Mix_PlayMusic(sound, 0);
+		sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
+		Mix_PlayChannel(-1, sound, 0);
 	}
 }