分类: LINUX
2006-05-26 10:21:09
|
提示: 调用SDL_CDName()可以获取和系统相关的CD-ROM驱动器名字。 |
例程:{ SDL_CD *cdrom; if ( SDL_CDNumDrives() > 0 ) { cdrom = SDL_CDOpen(0); if ( cdrom == NULL ) { fprintf(stderr, "Couldn't open default CD-ROM: %s\n" SDL_GetError()); return; } ... SDL_CDClose(cdrom); } } |
|
提示: 检查cdrom->tracks[track].type, ,与 SDL_AUDIO_TRACK 和 SDL_DATA_TRACK比较可以检测是音轨还是数据轨道。 |
例程:void PlayTrack(SDL_CD *cdrom, int track) { if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { SDL_CDPlayTracks(cdrom, track, 0, track+1, 0); } while ( SDL_CDStatus(cdrom) == CD_PLAYING ) { SDL_Delay(1000); } } |