1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-279 Checked in a fix for sound issue on Windows: should now be OK on both Windows and Linux. Someone either send me a mac, or test on their own to confirm it's ok on that platform too!

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2477 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-01-18 18:05:51 +00:00 committed by edouard
parent 9758026d5a
commit 30d8fcd2b0
3 changed files with 22 additions and 19 deletions

View File

@ -404,11 +404,14 @@ void SoundNotifyPlugin::stateChanged(Phonon::State newstate, Phonon::State oldst
qDebug() << "New State: " << newstate; qDebug() << "New State: " << newstate;
#endif #endif
#ifndef Q_OS_WIN
// This is a hack to force Linux to wait until the end of the // This is a hack to force Linux to wait until the end of the
// wav file before moving to the next in the queue // wav file before moving to the next in the queue.
// I wish I did not have to go through a #define, but I did not
// manage to make this work on both platforms any other way!
if (phonon.mo->totalTime()>0) if (phonon.mo->totalTime()>0)
phonon.mo->setTransitionTime(phonon.mo->totalTime()); phonon.mo->setTransitionTime(phonon.mo->totalTime());
#endif
if((newstate == Phonon::PausedState) || if((newstate == Phonon::PausedState) ||
(newstate == Phonon::StoppedState)) (newstate == Phonon::StoppedState))
{ {

View File

@ -101,28 +101,28 @@ QString NotifyPluginConfiguration::parseNotifyMessage()
// generate queue of sound files to play // generate queue of sound files to play
notifyMessageList.clear(); notifyMessageList.clear();
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+ getCurrentLanguage()+"/"+getSound1()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound1()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + getCurrentLanguage()+"/"+getSound1()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound1()+".wav"));
else else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "default/"+getSound2()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound1()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "default/"+getSound1()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound1()+".wav"));
if(getSound2()!="") if(getSound2()!="")
{ {
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + getCurrentLanguage()+"/"+getSound2()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound2()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + getCurrentLanguage()+"/"+getSound2()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/" + getCurrentLanguage()+"/"+getSound2()+".wav"));
else else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "default/"+getSound2()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound2()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "default/"+getSound2()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath() + "/default/"+getSound2()+".wav"));
} }
if(getSound3()!="") if(getSound3()!="")
{ {
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+getCurrentLanguage()+"/"+getSound3()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+ "/" + getCurrentLanguage()+"/"+getSound3()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+getCurrentLanguage()+"/"+getSound3()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+ "/" + getCurrentLanguage()+"/"+getSound3()+".wav"));
else else
if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+"default/"+getSound3()+".wav"))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+getSound3()+".wav")))
notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+"default/"+getSound3()+".wav")); notifyMessageList.append(QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+getSound3()+".wav"));
} }
switch(str1.at(0).toAscii()) switch(str1.at(0).toAscii())
@ -204,12 +204,12 @@ QString NotifyPluginConfiguration::parseNotifyMessage()
} }
foreach(QString fileName,numberFiles) { foreach(QString fileName,numberFiles) {
fileName+=".wav"; fileName+=".wav";
QString filePath = getSoundCollectionPath()+ QDir::toNativeSeparators(getCurrentLanguage()+"/"+fileName); QString filePath = QDir::toNativeSeparators(getSoundCollectionPath()+"/"+ getCurrentLanguage()+"/"+fileName);
if(QFile::exists(filePath)) if(QFile::exists(filePath))
notifyMessageList.insert(position++,getSoundCollectionPath()+ QDir::toNativeSeparators(getCurrentLanguage()+"/"+fileName)); notifyMessageList.insert(position++,QDir::toNativeSeparators(getSoundCollectionPath()+ "/"+getCurrentLanguage()+"/"+fileName));
else { else {
if(QFile::exists(getSoundCollectionPath()+QDir::toNativeSeparators("default/"+fileName))) if(QFile::exists(QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+fileName)))
notifyMessageList.insert(position++,getSoundCollectionPath()+QDir::toNativeSeparators("default/"+fileName)); notifyMessageList.insert(position++,QDir::toNativeSeparators(getSoundCollectionPath()+"/default/"+fileName));
else { else {
notifyMessageList.clear(); notifyMessageList.clear();
break; // if no some of *.wav files, then don't play number! break; // if no some of *.wav files, then don't play number!

View File

@ -71,7 +71,7 @@ public:
QString getObjectField() const { return objectField; } QString getObjectField() const { return objectField; }
void setObjectField(QString text) { objectField = text; } void setObjectField(QString text) { objectField = text; }
QString getSoundCollectionPath() const { return soundCollectionPath; } QString getSoundCollectionPath() const { return soundCollectionPath; }
void setSoundCollectionPath(QString text) { soundCollectionPath = text; } void setSoundCollectionPath(QString text) { soundCollectionPath = text; }
QString getCurrentLanguage() const { return currentLanguage; } QString getCurrentLanguage() const { return currentLanguage; }