QObject(parent)
{
- defaultsound_ = ":/defaultsound";
+ //THIS NEEDS TESTING: DOES IT REALLY CHANGE TUNE WHEN RESTARTING THE APPLICATION?
+
+ defaultsound_ = "/home/opt/KitchenAlert/Doorbell-old-tring-modified-multiplied-low-quality.mp3";
QString filename;
QSettings settings("KitchenAlert","KitchenAlert");
- settings.clear(); //REMOVE THIS AFTER TESTING!!!!!!
+ // settings.clear(); //REMOVE THIS AFTER TESTING!!!!!!
bool useDefaultSound = settings.value("UseDefaultSound",true).toBool();
qDebug() << "In AlertSound constructor UseDefaultSound is " << useDefaultSound;
pSound_ = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(filename));
}
-void AlertSound::play()
+AlertSound::~AlertSound()
{
+ if (pSound_ != NULL)
+ {
+ delete pSound_;
+ }
+}
+
+void AlertSound::play()
+{
+ pSound_->stop(); //Just testing if stopping the previous alert will prevent the jammming of the sound
pSound_->play();
qDebug() << "Sound should be played now";
}
pSound_->stop();
}
+
+
void AlertSound::setSound(QString filename)
{
QSettings settings("KitchenAlert","KitchenAlert");