Sound and the using of the Resource system
-
This post was split off from "this discussion":http://developer.qt.nokia.com/forums/viewthread/4453/ on certification; Andre
A huge desire to develop Qt and it's usages further!
It has all of potential to grow.
For example:
a) When they add support QSound class can read .wav files embedded into executable ( Qt Resources)?
b) How can I put any .txt file into Resources ( embbed ) and read it via QFile?
Pavel -
Yes, just use qt-creator's qrc editor or edit the file by hand to add in any file that you like.
In your app just pass in a path prefixed with a ":" to access the file from the compiled in resources. ie:
@
QFile file( ":/path/to/my/sound.wav" );
if ( !file.open( QIODevice::ReadOnly ) )
return;// Play the file...
@ -
[quote author="Pavel Mazniker" date="1300194760"]Hey!
I specially ask when QSound() will open wav files from resources?
That is the question when QSound class will work with .wav files from resource system.[/quote]
Probably the answer is "never". It is documented that QSound does not support loading from resources. QSound is not marked as such, but AFAIK it is basically deprecated. Use QtMultimedia or Phonon instead.