Playing a SoundEffect from a QRC
-
Hi,
I'm trying, with Qt Mobility 1.1.1, to play a sound file from a QRC. All of my QML files are loading properly, so there shouldn't be an issue with the import paths. I try to load a wav file like this:
SoundEffect { id: a source: "hi.wav" }
If I do this, I can see that the status is 3 if I try to load from a QRC (and the wav won't play), but it is 2 if I leave my code/resources out of the qrc (and it runs just fine). Is there any special way of defining the source within a qrc? I've tried source: "qrc:hi.wav", source: "qrc:/hi.wav", source: "qrc://hi.wav", but nothing worked. Any help would be appreciated.
Thanks
-
Did you try ":/hi.wav"? That is what I would use in C++.
-
That should not be needed, should it? I mean: paths are supposed to be relative. For other QML files, you also just reference them by relative path. Why would a sound file for a sound effect be any different? The only time I use the :/ notation with QML, is when I load the main QML file in my QDeclarativeView...
-
Yeah, I tried ":/hi.wav" also and that didn't work either. I'm guessing there's a bug loading a wav file from a qrc, but I was just checking if there was something that I was doing wrong first. I agree with Andre that is "should" be just "hi.wav" as paths are supposed to be relative...
-
Argh, I just found this old bug from 4.6.2:
http://bugreports.qt.nokia.com/browse/QTBUG-9253
I don't really like the answer though ;-)
-
I don't know if this issue goes away, but there seems to be a plan to use something else than QSound. See this "QTMOBILITY-864":http://bugreports.qt.nokia.com/browse/QTMOBILITY-864