Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to play an audio-cd with Phonon?
QtWS25 Last Chance

How to play an audio-cd with Phonon?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.6k Views
  • 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.
  • M Offline
    M Offline
    MichealZ
    wrote on last edited by
    #1

    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));
    myMusic->play();
    @

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MichealZ
      wrote on last edited by
      #2

      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);
      myMediaController.setAutoplayTitles(true);
      myMediaController.setCurrentTitle(7);
      myMusic->play();
      @

      "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 cddareader.ax for your system (I used one from MPC HomeCinema Standalone Filters on http://sourceforge.net/projects/mpc-hc/files/)
      Open command line and execute regsvr32.exe cddareader.ax
      Reboot

      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

      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