I am tidying up some old code that used QSound which does not work on Linux (well as least mine it doesn't). Options->sounds sets the sound file to be played for various events, so that different ones can be used for different events, or muted by a checkbox. The code compiles with no errors and runs. The sounds for events work for a while and then they stop. I haven't been through all the code to see where the functions are called from, but when the test in the options->sound is used, they play, they play for a while when using the program and then stop. The following is my code:
Code:
m_pPlayer = new QMediaPlayer(this); connect(m_pPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64))); //Set the volume m_pPlayer->setVolume(100); m_pPlayer->play(); disconnect(m_pPlayer, SIGNAL(triggered(bool)), this, SLOT(play())); // QSound::play(filename); not needed anymore as not using QSound
My questions are (remember I be an apprentice to c++ and Qt):
- is this code correct for the using this/these functions?
- where do I start looking for the problem (any ideas would be greatfully appreciated)?
