Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Phonon on symbian
Qt 6.11 is out! See what's new in the release blog

Phonon on symbian

Scheduled Pinned Locked Moved Mobile and Embedded
12 Posts 4 Posters 8.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gaucho
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vinb
      wrote on last edited by
      #2

      Hi put this in your pro file please:
      Qt += core gui phonon

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #3

        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 :)

        http://anavi.org/

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gaucho
          wrote on last edited by
          #4

          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);
                QString url= QString("e:\\Scream.wav");
                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.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leon.anavi
            wrote on last edited by
            #5

            Hi gaucho,

            I am glad that the issue with audiooutput.h is solved.

            [quote author="gaucho" date="1304086502"]
            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.
            [/quote]

            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

            http://anavi.org/

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gaucho
              wrote on last edited by
              #6

              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:

              @QListPhonon::AudioOutputDevice audioOutputDevices = Phonon::BackendCapabilities::availableAudioOutputDevices();@

              1 Reply Last reply
              0
              • L Offline
                L Offline
                leon.anavi
                wrote on last edited by
                #7

                [quote author="gaucho" date="1304154523"]i can't read in that article, how to obtain and select[/quote]

                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.
                [quote author="gaucho" date="1304154523"]
                Maybe instead,
                i can obtain available output devices with the following:

                @QListPhonon::AudioOutputDevice audioOutputDevices = Phonon::BackendCapabilities::availableAudioOutputDevices();@[/quote]

                Did you manage to obtain available devices using this approach?

                Best regards,
                Leon

                http://anavi.org/

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gaucho
                  wrote on last edited by
                  #8

                  I added to my project a combobox,
                  then i added the following include:
                  @#include < phonon/BackendCapabilities > @
                  and, on window creation routine, the following code:
                  @ QListPhonon::AudioOutputDevice devices = Phonon::BackendCapabilities::availableAudioOutputDevices();

                      for (int i=0; i<devices.size(); i++){
                          QString itemText = devices[i].name();
                          if (!devices[i].description().isEmpty()) {
                              itemText += QString::fromLatin1(" (%1)").arg(devices[i].description());
                          }
                          ui->comboBox->addItem(itemText);
                      }@
                      The combobox populates with only one value, even if i connect a bluetooth headphone.
                      
                      Am i doing something wrong? why i can't obtain 2 output devices?
                      
                      Thank you. 
                  
                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    leon.anavi
                    wrote on last edited by
                    #9

                    @QListPhonon::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

                    http://anavi.org/

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Chuck Gao
                      wrote on last edited by
                      #10

                      hi, gaucho, you can try multimediakit.It's more convenient on Symbian development

                      Chuck

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        gaucho
                        wrote on last edited by
                        #11

                        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".

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          Chuck Gao
                          wrote on last edited by
                          #12

                          [quote author="gaucho" date="1305642401"]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".[/quote]

                          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.

                          Chuck

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved