Sdl ejects the tray reading this chapter
05 FO SDL chapter 05 10/21/02 10:27 AM Page 134
134 | 5. |
---|
Now you have enough information to be able to look at the contents of a CD. Example program FOSDL5_4 on the CD shows how you might do this. It shows how many tracks are on the CD and lists each track’s information.
And now you’re actually going to play a CD. There are two different functions that you can use to do this. The first one is called SDL_CDPlay.
This function takes a pointer to an SDL_CD structure that contains the information about the CD you are using. The return value is 0 for success and -1 for failure.
In FOSDL5_5, I have created a small application that will randomly shuffle the songs on a CD. It’s actually a pretty neat little program and a low-memory footprint compared to commercial programs that do the same thing. Check it out on the CD-ROM. (I’m actually using the program as I’m writing this.)