Results 1 to 3 of 3

Thread: playing mp3 files via QT

  1. #1
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default playing mp3 files via QT

    hello,

    i asking this question to everybody out there having experience in playing mp3 files via qt:
    1) is this possible at all (what class does that?)
    2) if yes, is it possible to change pitch and speed while playing ?

    thnx.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: playing mp3 files via QT

    Qt Code:
    1. Phonon::MediaObject *music =
    2. Phonon::createPlayer(Phonon::MusicCategory,
    3. Phonon::MediaSource("/path/mysong.mp3"));
    4. music->play();
    To copy to clipboard, switch view to plain text mode 

    http://doc.qt.nokia.com/latest/phonon-overview.html

    http://phonon.kde.org/

  3. #3
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: playing mp3 files via QT

    wow, thnx.
    but unfortunately this seems to be not available for
    mingw qt:

    http://doc.qt.nokia.com/latest/phono...talling-phonon


    Added after 24 minutes:


    ok, my last posting might be wrong:
    i can compile the following code within qt-creator with setting QT+= phonon to project file:

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3.  
    4. #include <QtGui/QApplication>
    5. #include <Phonon/VideoPlayer>
    6. using namespace Phonon;
    7.  
    8. int main(int argc, char *argv[])
    9. {
    10. QApplication a(argc, argv);
    11.  
    12. MediaSource m("test.avi");
    13. VideoPlayer *player = new VideoPlayer(Phonon::VideoCategory, 0);
    14. QObject::connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
    15. player->play(m);
    16.  
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 

    but nothing happens (file exists and is in right place)
    Last edited by kerim; 21st April 2011 at 13:37.

Similar Threads

  1. Playing multiple audio files with Phonon
    By MartinWalter in forum Qt Programming
    Replies: 0
    Last Post: 23rd December 2010, 11:19
  2. Playing 2 wav files continously
    By HanyM.Magdy in forum Qt Programming
    Replies: 3
    Last Post: 5th October 2010, 16:11
  3. QSound problem playing different wav files
    By couker in forum Qt Programming
    Replies: 6
    Last Post: 16th September 2009, 20:38
  4. Playing Media files in Qt 4
    By sar_van81 in forum Qt Programming
    Replies: 2
    Last Post: 18th December 2007, 05:53
  5. Playing mpegs
    By lewis in forum Qt Programming
    Replies: 9
    Last Post: 21st July 2006, 16:21

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.