phonon on symbian
i’m new to QT. i’m tring to develop my first app on my nokia 5800 xm.
I installed all sdk (Qt SDK 1.1) and tools needed by qt on my windows desktop.
Then i built a empty qt mobility project where i added only a button.
The project (built on windows) runs without errors on my nokia.
In my project, i want to take an audio stream from microphone device and send
it to an output audio device.
I understood that i can use phonon class for my scope.
I only added on my mainWindow.cpp (at the beginning):
- #include <phonon/AudioOutput>
..and on the button action i added:
- Phonon::AudioOutput* pAudioOutput;
- pAudioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this);
When i try to build the app i receive the following error:
warning: Can’t find following headers in User or System Include Paths:
“audiooutput.h”
but if i go in C:\QtSDK\Symbian\SDKs\Symbian1Qt473\include\phonon i can find the audiooutput.h
What is wrong in my environment?
my easy test project can be downloaded from www.tr3ma.com/Dati/test2.zip
11 replies
Wow… I just saw the same topic in Italian and used Google Translate to understand it :D
vinb suggestion is correct! I has able to build you demo project by adding this line to test2.pro :
- QT += core gui phonon
Best regards,
Leon
P.S.
Qt not QT :)
Thank you Bro,
Happy to know it’s not a dead forum.
now that it works,
i added the remaining part of the code in file mainWindow.cpp:
- #include <phonon/AudioOutput>
- #include <phonon/MediaObject>
- #include <phonon/MediaSource>
and in sub on_pushButton_clicked() i added:
- Phonon::AudioOutput* pAudioOutput;
- pAudioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this);
- Phonon::MediaObject* pMediaObject ;
- pMediaObject = new Phonon::MediaObject(this);
- Phonon::createPath(pMediaObject, pAudioOutput);
- Phonon::MediaSource mediaSource = Phonon::MediaSource(url);
- pMediaObject ->setCurrentSource( mediaSource);
- pMediaObject->play();
then i copied the file Scream.wav in the external memory (e:)
I verified that i can listen to this file on the default player of the phone.
And when i run the code, and press the button, the phone plays the wav.
Very good.
Now: How can i change the output device, choosing from available outputs? (for example in case i have 2 bluetooth headphone connected, and i want to stream a file only to one of these headphone).
I’ll study on this question.
Hi gaucho,
I am glad that the issue with audiooutput.h is solved.
Now: How can i change the output device, choosing from available outputs? (for example in case i have 2 bluetooth headphone connected, and i want to stream a file only to one of these headphone). I’ll study on this question.
May be such a question deserves a separate thread :) I am not sure that Qt have such capabilities but if you are developing an app for Symbian (after all the forum title is Mobile and Embedded :) ) you can use Symbian C++ code to make “audio output routing “:http://wiki.forum.nokia.com/index.php/Audio_Routing_API_–_Input_and_Output
Cheers,
Leon
Thank you Leon,
i found that article yesterday, but may be it’s not the right class to use,
because the possible routes are only:
- enum TAudioOutputPreference {
- ENoPreference, /// Used to indicate that the playing audio can be routed to
- /// any speaker. This is the default value for audio.
- EAll, /// Used to indicate that the playing audio should be routed
- /// to all speakers.
- ENoOutput, /// Used to indicate that the playing audio should not be routed
- /// to any output.
- EPrivate, /// Used to indicate that the playing audio should be routed to
- /// the default private speaker. A private speaker is one that
- /// can only be heard by one person.
- EPublic, /// Used to indicate that the playing audio should be routed to
- /// the default public speaker. A public speaker is one that can
- /// be heard by multiple people.
- };
i can’t read in that article, how to obtain and select available devices.
Maybe instead,
i can obtain available output devices with the following:
- QList<Phonon::AudioOutputDevice> audioOutputDevices = Phonon::BackendCapabilities::availableAudioOutputDevices();
i can’t read in that article, how to obtain and select
According to this article you can route the audio output to the default private speaker (EPrivate) and there should not be more that one default private speaker.
Maybe instead,
i can obtain available output devices with the following:@QList<Phonon::AudioOutputDevice> audioOutputDevices = Phonon::BackendCapabilities::availableAudioOutputDevices();@
Did you manage to obtain available devices using this approach?
Best regards,
Leon
I added to my project a combobox,
then i added the following include:
- #include < phonon/BackendCapabilities >
and, on window creation routine, the following code:
- QList<Phonon::AudioOutputDevice> devices = Phonon::BackendCapabilities::availableAudioOutputDevices();
- for (int i=0; i<devices.size(); i++){
- if (!devices[i].description().isEmpty()) {
- }
- ui->comboBox->addItem(itemText);
- }
- QList<Phonon::AudioOutputDevice> devices = Phonon::BackendCapabilities::availableAudioOutputDevices();
Let’s ignore the GUI for a second. How many devices does the QList contain when you connect bluetooth headphone?
Regards,
Leon
ok, if you know i can do these thigs i’ll try. (i’ll let you know). may be i remember it wrong, but it seems to me that multimedia kit doesn’t allow you to select the output device, but only the output “type”.
you can get the device list via:
QList<QAudioDeviceInfo> QAudioDeviceInfo::availableDevices ( QAudio::Mode mode )
and use QAudioOutput to do the play work. You can also specify a output format. The only disadvantage i think, is the API didn’t support setVolume function.
You must log in to post a reply. Not a member yet? Register here!




