Hi everyone,
I've been travelling between posts and documentation but haven't found a solution for the following problem.
I'm using Netbeans under Ubuntu and Qt 4.7.1.
I'm doing a small alarm clock application and having some problems with the sound.
When I compile and run from Netbeans, the sound works, but not when I run the executable file outside Netbeans.
I had the same problem with some images but it got fixed by using a resource file.
Here is my resource file :
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/up_arrow.png</file>
<file>icons/down_arrow.png</file>
<file>sounds/alarm_clock.wav</file>
</qresource>
</RCC>
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/up_arrow.png</file>
<file>icons/down_arrow.png</file>
<file>sounds/alarm_clock.wav</file>
</qresource>
</RCC>
To copy to clipboard, switch view to plain text mode
And here is how I play a sound using Phonon :
Phonon::MediaObject *music;
music = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource("sounds/alarm_clock.wav"));
music->play();
Phonon::MediaObject *music;
music = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource("sounds/alarm_clock.wav"));
music->play();
To copy to clipboard, switch view to plain text mode
Any help would be appreciated.
Added after 10 minutes:
Ok solution found
For those who might face this problem, here it goes;
Adding ":/" solves the problem :
music = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource(":/sounds/alarm_clock.wav"));
music = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource(":/sounds/alarm_clock.wav"));
To copy to clipboard, switch view to plain text mode
Should have read further... Sorry.
Bookmarks