Hi all,
I'm trying to play a simple audio file with phonon, but the sound doesn't work. The compilation process is ok, and the phonon linking is ok too.
MyClass
::MyClass(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
Phonon::MediaObject *mediaObject;
Phonon::AudioOutput *audioOutput;
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mediaObject = new Phonon::MediaObject(this);
audioOutput->setVolume(0.5);
Phonon::createPath(mediaObject, audioOutput);
mediaObject
->setCurrentSource
(QString("vai.wav") );
mediaObject->play();
}
MyClass::MyClass(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
Phonon::MediaObject *mediaObject;
Phonon::AudioOutput *audioOutput;
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mediaObject = new Phonon::MediaObject(this);
audioOutput->setVolume(0.5);
Phonon::createPath(mediaObject, audioOutput);
mediaObject->setCurrentSource(QString("vai.wav") );
mediaObject->play();
}
To copy to clipboard, switch view to plain text mode
My development environment is windows7 + VS2010 + QT 4.7.
There's last one thing: the path audio file is correct and it's in the same directory the generated executable.
Thanks all so much...
Bookmarks