views:

34

answers:

1

This is my code:

media_object_ = new Phonon::MediaObject(this);
fileName="./DemoEN2.wav";
media_object_->setCurrentSource(fileName);
media_object_->play();

I have the includes:

#include <Phonon/MediaObject>
#include <Phonon/MediaSource>
#include <phonon>

And:

Phonon::MediaObject *media_object_;
QString fileName;

When I run the .exe (/bin/folder) I can not listen the DemoEN2.wav (That is in the same /bin/ folder). There is no output.

My sound system works, and I can not see any apparent problem. Do you have any idea?

+3  A: 

You need to connect the media source to media output:

Phonon::MediaObject *media_object_;
Phonon::AudioOutput *audio_output_;

...

media_object_ = new Phonon::MediaObject(this);
fileName="./DemoEN2.wav";
media_object_->setCurrentSource(fileName);
audio_output_ = new Phonon::AudioOutput(Phonon::MusicCategory, this);
Phonon::createPath(media_object_, audio_output_);
media_object_->play();
Roku
Just perfect. Thanks :)
andofor