I’ve been playing around and trying to get a CD to play. I got everything I thought I needed happening, and I’d hit play and I’d hear the mechanics of the CD starting, but no sound. So I retrenched and tried to make the minimal possible alterations to the demo program in order to play a CD.
This is what I did:
-
I altered the code in filenameComponentChanged, replacing
[i]AudioFormatReader* reader = formatManager.createReaderFor /i;
with
reader = AudioCDReader::createReaderForCD(0); -
Because I will later need the position of each track, I moved the declaration of reader to the private fields section, changing it to be:
AudioCDReader* reader; -
I went into the buttonClicked() routine and changed it to:
if (button == playButton)
{
transportSource.setPosition (reader->getPositionOfTrackStart(1));
transportSource.start();
}
So now, of course I have to choose a file in order to get item 1 to execute, but that’s fine for testing.
Then I click play. the call to getPositionOfTrackStart returns 7344120, which seems like a reasonable number. But the CD doesn’t start playing, the Stop button is disabled, and the UI says “stopped”.
What am I missing here?
Thanks for any light you can shed.
Warren