Before issuing a play command, suitable media should be present in the CD drive. The following status command will return TRUE if the disc contains CD-DA tracks that can be played by the CD audio device:
status mycd media present wait
The CD audio device operates only on discs that contain CD-DA tracks. If a disc contains no CD-DA tracks, then the MCIERR_INVALID_MEDIA error can be returned on any command that requires a CD-DA track format in order to complete. Example commands include play, seek, and the media present function of the status command.
Other pertinent information regarding the CD audio device can be obtained using the status command:
Query
The status command will also return the following information about the currently inserted media:
Query
Changing the Media
It is the responsibility of the application to ensure that the appropriate compact disc is in the CD drive if having a particular disc is essential to the application. For example, a CD player application might simply update its track and time displays if a new disc is inserted. Other applications might be so dependent on a specific disc that the user must be prompted to re-insert the appropriate disc. An application can choose to disable the manual eject button on the physical CD drive to prevent the disc from being changed.
capability mycd can lockeject wait. . . ** If the door can be locked, lock it! ** . . . set mycd door locked wait
If the drive does not support disabling the manual eject, then the application can check the disc identity by obtaining the UPC code (serial number) or the more general CD ID. The CD ID is an 8-byte identifier which can be obtained using the info command and is constructed from the following information:
info mycd ID wait
The UPC code is a serial number which has been assigned to a particular compact disc and can also be obtained using the info command, however not all disc manufacturers utilize a UPC code. The UPC code is represented as a binary coded decimal (BCD) number.
info mycd UPC wait
If a play is in progress and the manual eject button is pressed on the CD drive, the application will receive the MCIERR_DEVICE_NOT_READY error when the play command is aborted.