Results 1 to 4 of 4

Thread: problem with phonon

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default problem with phonon

    Hi to all,
    I have some problem using the Phonon module. I would use it to play an audio file.
    This is the code I used.
    In my *.h file:
    Qt Code:
    1. Phonon::AudioOutput *audioOutput;
    2. Phonon::MediaObject *mediaObject;
    To copy to clipboard, switch view to plain text mode 
    Then in my *.cpp file:
    Qt Code:
    1. audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
    2. mediaObject = new Phonon::MediaObject(this);
    3. Phonon::Path path = Phonon::createPath(mediaObject, audioOutput);
    4.  
    5. mediaObject->setCurrentSource(Phonon::MediaSource(":/sounds/file.wav"));
    6. mediaObject->play();
    To copy to clipboard, switch view to plain text mode 
    When I execute the code I don't listen nothing. Instead if I try to play the file with the phonon demo there is no problem.
    Which can be the problem?

    Regards
    Franco Amato

  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with phonon

    I hope to get a reply,
    22 Views and no reply.
    Best Regards
    Franco Amato

  3. #3
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: problem with phonon

    Using qt resources can be tricky. Some classes require you to access resources by pre-pending a colon (':'), others by prepending a "qrc:". Try prepending accessing your resource via this: "qrc:/sounds/file.wav".

    Also, make certain that your resource is actually being built into your executable.
    Life without passion is death in disguise

  4. #4
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with phonon

    Quote Originally Posted by KShots View Post
    Using qt resources can be tricky. Some classes require you to access resources by pre-pending a colon (':'), others by prepending a "qrc:". Try prepending accessing your resource via this: "qrc:/sounds/file.wav".

    Also, make certain that your resource is actually being built into your executable.
    Hi I solved the problem using the fullpath instead of resources.
    Thank you
    Franco Amato

Similar Threads

  1. Replies: 2
    Last Post: 23rd March 2012, 00:51
  2. Problem using Phonon
    By Sismetic in forum Newbie
    Replies: 1
    Last Post: 1st September 2010, 14:33
  3. Phonon Installation Problem.
    By Rajeshsan in forum Installation and Deployment
    Replies: 0
    Last Post: 6th April 2010, 12:19
  4. problem with phonon
    By mismael85 in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2010, 20:25
  5. Problem with Phonon on Fedora 8
    By od in forum Qt Programming
    Replies: 0
    Last Post: 19th April 2009, 21:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.