How to play an audio-cd with Phonon?

  • I am trying to play an audio CD with phonon under Windows. I use Qt 4.8.0.

    I run a code like:
    QString filepath = QString("E:\")
    myMusic = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(Phonon::Cd, filepath));

    There are any errors in the log window and any sound either. The disk does not spin in drive too.
    I have tried a simple drive letter "E:\" and a path like "E:\Track01.cda".
    So is there an option to play audio CD with phonon? If it is, how can I select proper track?

    P.S. mp3 is played without problems so all other parts of my code is ok. Also I use USB cdrom drive, but that should't be the issue.

  • Ok, I think I have solved this issue. Currently I have code like this:

    Phonon::MediaObject *myMusic = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource Phonon::Cd, QString("E:\")));
    Phonon::MediaController myMediaController(myMusic);

    "E:" is my cd-drive with inserted audio cd and I play the track #8 (track count starts from zero).

    Other issue on my Windows 7 system was Phonon warning:
    @unable to load the TOC from the CD@

    This issue is related to Phonon Windows backend. Some Windows systems do not have CDDA codecs (or what is that thing is) installed. In this case Phonon application will not play Audio CD discs. You won't see any errors (except from above) and there won't be any cd drive activity.

    To fix this issue you should:
    Dowload proper for your system (I used one from MPC HomeCinema Standalone Filters on
    Open command line and execute regsvr32.exe

    This code is tested on WinXP x86 and Win7 x64. Linux machine have played audio cd without problems (with different path of cource)

    Hope this information will be useful

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.