CD Functions
CD Functions
CD Functions
Function Synopsis
CD functions are specialized built-in services of FOCUS.FLL which allow the developer to control a CD player.
CD functions are using MCI functions to control the CD player. Most of the time, FOCUS.FLL is internally using the mciSendString() function which uses MCI commands.
How to use CD’s functions?
Prior to using any function you should make sure a CD player is attached to the PC. You can use CD_iscd() function to determine whether a CD player is attached to the system.
After checking, you must observe the following rules:
- Open the CD device (CD_open())
- Issue all functions you want to use
- Close the CD device when you no longer need it (you do not need to close the device necessarily).
Windows Control Panel
For the CD functions to work properly, you must ensure that a CD driver has been installed in the driver section of the Control Panel.
CD player device name
All CD functions are directed to the FWCD device that is the alias the CD_open() function gave to the CDAUDIO device. By default, you should use this alias (FWCD) if you desire to obtain tighter control on the device. This is also the name you need to use in the CD_command() function.
CD Functions
CD_bayope(): Opens the door and ejects CD media (if possible).
Syntax
CD_bayope() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_bayclo(): Retracts the tray and closes the door bay (if possible).
Syntax
CD_bayclo() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_caneje(): Can CD audio device eject the media?
Syntax
CD_caneje() lSuccess
Parameters
None.
Returns
lSuccess.T. if device can eject the disc tray; otherwise it returns .F..
CD_canpla(): Can CD audio device play the media?
Syntax
CD_canpla() lSuccess
Parameters
None.
Returns
lSuccess.T. if media can be played; otherwise it returns .F..
CD_close(): Closes CD device.
Syntax
CD_close() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_command(): Sends a MCI command string to the CD device open with CD_open().
Syntax
CD_command( szString ) .T.
Parameters
szStringcommand to be sent to the CD player.
Returns
.T.the function always returns .T..
Example
& FWCD is the alias that was given to the CDAUDIO.
CD_command( "play FWCD from 2 to 6" )
CD_curpos(): Returns the current position.
Syntax
CD_curpos() szPosition
Parameters
None.
Returns
szPositionposition in TMSF format (track, minute, second, frame).
CD_curtra(): Returns the current track.
Syntax
CD_curtra() szTrack
Parameters
None.
Returns
szTrackreturns the current track number as a string.
CD_end(): Moves to the end of audio data on the disc.
Syntax
CD_end() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_home(): Moves to the start of audio data on the disc.
Syntax
CD_home() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_iscd(): Is a CD-ROM attached to the computer?
Syntax
CD_iscd() lCDAttached
Parameters
None.
Returns
lCDAttached.T. if a CD is attached to computer; .F. otherwise.
CD_LastError(): Determines the last error that occurred within the CD_*() functions.
Alias
In fact, the CD_*() functions are implemented in the MCI.C source file because it belongs to this section. The same goes for VID_*() functions. Therefore, CD_LastError() is mapped to MCI_LastError(). The following functions are all synonyms:
CD_GetLastError(), CD_GetLastError(), VID_LastError(), VID_GetLastError(), MCI_LastError(), MCI_GetLastError())
Syntax
CD_LastError() szLastError
Parameters
None.
Returns
szLastErrorstring describing the last error that occurred using the CD_*() functions.
CD_LastVersion(): Returns the file stamp of CD_*() functions.
Remark
This function helps the developer identifying the last version of a set of functions. Sometimes the global version information of FOCUS.FLL (MIS_major() and MIS_minor()) does not help tracking down the changes in a project. Starting with version 6.0 of FOCUS.FLL, each source file has now an internal date and time stamp.
Syntax
CD_LastVersion() szLastVersion
Parameters
None.
Returns
szLastVersionif a string identifying the last version of the BMP functions. The string is similar to "C:\Focus\5.0\MCI.C-Mon Oct 19 15:55:22 1998".
CD_loff(): Disables output to the left audio channel.
Alias
CD_LeftOff()
Syntax
CD_loff() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_lon(): Enables output to the left audio channel.
Alias
CD_LeftOn()
Syntax
CD_lon() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_MediaPresent(): Returns .T. if a disc is inserted in the drive.
Syntax
CD_MediaPresent() lMediaIsThere
Parameters
None.
Returns
lMediaIsThere.T.if a disc is inserted in the disc tray and the door is closed; .F. if not.
CD_mode(): Returns a value indicating the current mode of the device.
Syntax
CD_mode() szStatus
Parameters
None.
Returns
szStatuscurrent device status.
Open
Paused
Playing
Seeking
Stopped
CD_msf(): Sets the current time format to MSF (minutes, seconds, frames).
Syntax
CD_msf() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_ms(): Sets the current time format to MS (milliseconds).
Syntax
CD_ms() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_off(): Disables audio output (mute).
Alias
CD_mute()
Syntax
CD_off() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_on(): Enables audio output (unmute).
Alias
CD_unmute()
Syntax
CD_on() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_open(): Opens CD device.
Special
Prior to issuing any CD function (except CD_iscd()), you need to make a call to CD_open() to ensure that the CDAUDIO device will be accessible. The CDAUDIO device is open assuming the TMSF format. It is given the CD alias ("open CDAUDIO alias FWCD").
Syntax
CD_open() lSuccess
Parameters
None.
Returns
lSuccesswas the attempt to open the CDAUDIO device successful or not?
CD_pause(): Pauses playing.
Syntax
CD_pause() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_play(): Plays CD tracks.
Syntax
CD_play() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_ready(): Determines whether the CD is ready.
Syntax
CD_ready() lSuccess
Parameters
None.
Returns
lSuccess.T. if CD ready to play; .F. if not.
CD_resume(): Resumes playback.
Syntax
CD_resume() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_roff(): Disables output to the right audio channel.
Alias
CD_RightOff()
Syntax
CD_roff() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_ron(): Enables output to the right audio channel.
Alias
CD_RightOn()
Syntax
CD_ron() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_seek(): Moves to the specified position.
Special
CD_seek() moves to given position according to the time format. At start-up, the CDAUDIO device is opened in the TMSF format (Track, minutes, seconds, frames). This setting will make CD_seek() to operate on tracks. If the time format is later set up to the MSF format, CD_seek() will then perform a sequential seek on minutes.
Syntax
CD_seek( szObject ) .T.
Parameters
szObjectobject to move to. szObject is depending on the time format.
Returns
.T.the function always returns .T..
CD_start(): Positions the disc at the starting position.
Syntax
CD_start() lSuccess
Parameters
None.
Returns
lSuccess.T.. if the function is successful; .F. otherwise.
CD_stop(): Stops playback.
Syntax
CD_stop() lSuccess
Parameters
None.
Returns
lSuccess.T.. if the function is successful; .F. otherwise.
CD_time(): Returns the current time format.
Syntax
CD_time() szFormat
Parameters
None.
Returns
szFormatcurrent time format. Normally, the TMSF format is used all in all the CD_*() functions but this default may be change via external services.
CD_tmsf(): Sets the current time format to TMSF.
Syntax
CD_tmsf() .T.
Parameters
None.
Returns
.T.the function always returns .T..
CD_totlen(): Returns the total length of disc.
Syntax
CD_totlen() szTime
Parameters
None.
Returns
szTimetotal length of the disc.
CD_tottra(): Returns the number of tracks on the disc.
Syntax
CD_tottra() szTrackCount
Parameters
None.
Returns
szTrackCountnumber of tracks (as a string).
CD_tralen(): Returns the length of a given track.
Syntax
CD_tralen( szTrackNo ) szLength
Parameters
szTrackNotrack number (as string) of which to obtain length.
Returns
szLengthlength of given track.
CD_trapos(): Returns the starting position of a given track.
Syntax
CD_trapos( szTrackNo ) szPosition
Parameters
szTrackNogiven track.
Returns
szPositionposition at which the given track starts.