Question

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.

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 issues

Was it helpful?

Solution

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:

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top