Hy, I’m using Qt 5.0.2 and QMediaPlayer to play a wav sound, I’ve decided to stop trying using QSound or QSoundEffect, since they would simply not play the wav sound, and show no errors.
However, here’s the strange thing, if I start the program via QtCreator, no problem, QMediaPlayer works as expected, however, if I start it outside the QtCreator, it simply won’t play the sound!
I’m actually doing a fairly standar thing:
On the class constructor I start the sound:
(where _player is declared as QMediaPlayer *_player)
QString hornSound = QDir::currentPath().append("/horn.wav");
_player = new QMediaPlayer(this);
_player->setMedia(QUrl::fromLocalFile(hornSound));
and when I need to use it I use the play method:
_player->play();
Can anyone help me out on this? This is kinda urgent.
Thanks
↧