home *** CD-ROM | disk | FTP | other *** search
- {
- ════════════════════════════════════════════════════════════════════════════
-
- Visionix CD-ROM Audio Library (VCDROM)
- Copyright 1991,92,93 Visionix
- ALL RIGHTS RESERVED
-
- ────────────────────────────────────────────────────────────────────────────
-
- Revision history in reverse chronological order:
-
- Initials Date Comment
- ──────── ──────── ────────────────────────────────────────────────────────
-
- lpg 03/15/93 Added Source Documentation
-
- mep 02/11/93 Cleaned up code for beta release
-
- jrt 02/08/93 Sync with beta 0.12 release
-
- jrt 12/07/92 Sync with beta 0.11 release
-
- jrt 11/21/92 Sync with beta 0.08
-
- jrt 09/15/92 First logged revision.
-
- ════════════════════════════════════════════════════════════════════════════
-
- INCOMPLETE FUNCTIONS
- --------------------
-
- VCD_LoadMSF
- VCD_GetCaps
- VCD_CheckForMethod
- VCD_Close
- VCD_GetDriveCaps
- VCD_GetNumDrives
- }
-
- Unit VCDROM;
-
-
- Uses
-
- VTypes,
- VGen,
- DOS;
-
- {────────────────────────────────────────────────────────────────────────────}
-
- Const
-
- cCdMethodMSCDEX = 1;
- cCdMethodSCSI2 = 2;
-
- Type
-
- TError = WORD;
-
- {-----}
-
- TCDLibCaps = RECORD
-
- A : BYTE;
-
- END;
-
- PCDLibCaps = ^TCDLibCaps;
-
- {-----}
-
- TCDDriveCaps = RECORD
-
- B : BYTE;
-
- END;
-
- PCDDriveCaps = ^TCDDriveCaps;
-
- {-----}
-
- TMSF = RECORD
-
- M : BYTE;
- S : BYTE;
- F : BYTE;
-
- END;
-
- PMSF = ^TMSF;
-
- {-----}
-
- TCDDriveInfo = RECORD
-
- Method : WORD;
-
- MethodBus : WORD;
- MethodUnit : WORD;
-
- END;
-
- {-----}
-
- TCDInstanceData = RECORD
-
- C : BYTE;
-
- DriveInfo : Array[1..8] of TCDDriveInfo;
-
- END;
-
- PCDInstanceData = ^TCDInstanceData;
-
- {-----}
-
- TCDHandle = PCDInstanceData;
-
- {-----}
-
- TCDRequestHeader = RECORD
-
- HeaderSize : BYTE;
- Subunit : BYTE;
- CommandCode : BYTE;
- Status : WORD;
- Reserved : Array[1..8] of BYTE;
-
- END;
-
- {────────────────────────────────────────────────────────────────────────────}
-
- {----------------}
- { Math Functions }
- {----------------}
-
- Procedure VCD_AddMSF( Value1 : TMSF;
- Value2 : TMSF;
- Var Result : TMSF );
-
- Procedure VCD_SubMSF( Value1 : TMSF;
- Value2 : TMSF;
- Var Result : TMSF );
-
- Function VCD_MSFtoBlock( MSF : TMSF ) : LONGINT;
-
- Procedure VCD_BlockToMSF( Block : LONGINT;
- Var MSF : TMSF );
-
- Function VCD_MSFtoTotalFrames( MSF : TMSF ) : LONGINT;
-
- Procedure VCD_TotalFramesToMSF( TotalFrames : LONGINT;
- Var MSF : TMSF );
-
- Procedure VCD_LoadMSF( Var MSF : TMSF;
- M : BYTE;
- S : BYTE;
- F : BYTE );
-
-
- {--------------------------}
- { Library/System functions }
- {--------------------------}
-
- Procedure VCD_GetCaps( Caps : PCDLibCaps );
-
- Function VCD_Open( Flags : WORD;
- MethodListStr : ST80 ) : TCDHandle;
-
- Procedure VCD_Close( Handle : TCDHandle );
-
- Procedure VCD_GetDriveCaps( Handle : TCDHandle;
- Drive : WORD;
- CDDriveCaps : PCDDriveCaps );
-
- Function VCD_GetNumDrives( Handle : TCDHandle ) : WORD;
-
-
- {--------------------}
- { CD Audio Functions }
- {--------------------}
-
- Function VCD_GetAudioDiskInfo( Handle : TCDHandle;
- Drive : WORD;
- Var FirstTrack : WORD;
- Var LastTrack : WORD;
- Var StartLeadOut : TMSF ) : TError;
-
- Function VCD_GetAudioTrackInfo( Handle : TCDHandle;
- Drive : WORD;
- Track : WORD;
- Var Start : TMSF;
- Var TrackConInfo : WORD ) : TError;
-
- Function VCD_GetAudioQChanInfo( Handle : TCDHandle;
- Drive : WORD;
- Var ConAdr : WORD;
- Var TrackNum : WORD;
- Var IndexNum : WORD;
- Var TrkRelTime : TMSF;
- Var DskRelTime : TMSF ) : TError;
-
- Function VCD_GetAudioStatusInfo( Handle : TCDHandle;
- Drive : WORD;
- Var AudioStatus : WORD;
- Var PlayStart : TMSF;
- Var PlayEnd : TMSF ) : TError;
-
- Function VCD_PlayMSFfor( Handle : TCDHandle;
- Drive : WORD;
- Start : TMSF;
- PlayFor : TMSF ) : TError;
-
- Function VCD_PlayMSFto( Handle : TCDHandle;
- Drive : WORD;
- Start : TMSF;
- PlayTo : TMSF ) : TError;
-
- Function VCD_Pause( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
- Function VCD_Stop( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
- Function VCD_Resume( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
-
-
- {────────────────────────────────────────────────────────────────────────────}
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_AddMSF( Value1 : TMSF;
- Value2 : TMSF;
- Var Result : TMSF );
-
- [PARAMETERS]
-
- Value1 1st Min/Sec/Frame Value
- Value2 2nd Min/Sec/Frame Value
- Result VAR Returned Min/Sec/Frame Sum
-
- [RETURNS]
-
- (Function : None)
- (VAR : [Result] Min/Sec/Frame Sum)
-
- [DESCRIPTION]
-
- Adds the 1st Min/Sec/Frame Value to the 2nd Min/Sec/Frame Value to
- produce the a new Min/Sec/Frame Value.
-
- Adds two Min/sec/frame values and puts the result in "Result".
-
-
- [SEE-ALSO]
-
- VCD_SubMSF
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_SubMSF( Value1 : TMSF;
- Value2 : TMSF;
- Var Result : TMSF );
-
- [PARAMETERS]
-
- Value1 1st Min/Sec/Frame Value
- Value2 2nd Min/Sec/Frame Value
- Result VAR Returned Min/Sec/Frame Difference
-
- [RETURNS]
-
- (Function : None)
- (VAR : [Result] Min/Sec/Frame Difference)
-
- [DESCRIPTION]
-
- Subtracts the 2nd Min/Sec/Frame Value from the 1st Min/Sec/Frame Value
- to produce the Difference (a new Min/Sec/Frame Value).
-
- Subs MSF "Value2" from MSF "value1" and puts result in "Result".
-
- [SEE-ALSO]
-
- VCD_AddMSF
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_MSFtoBlock( MSF : TMSF ) : LONGINT;
-
- [PARAMETERS]
-
- MSF Source Min/Sec/Frames Value
-
- [RETURNS]
-
- Total Blocks represented by Min/Sec/Frame Value.
-
- [DESCRIPTION]
-
- Converts a min/sec/frame address to a logical block address.
-
- [SEE-ALSO]
-
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_BlockToMSF( Block : LONGINT;
- Var MSF : TMSF );
-
- [PARAMETERS]
-
- Block Source Number of Blocks
- MSF VAR Returned Min/Sec/Frame Value
-
- [RETURNS]
-
- (Function : None)
- (VAR : [MSF] Min/Sec/Frame Value)
-
- [DESCRIPTION]
-
- Converts a Logical Block Address to a Min/Sec/Frame Address.
-
- [SEE-ALSO]
-
- VCD_MSFtoBlock
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_MSFtoTotalFrames( MSF : TMSF ) : LONGINT;
-
- [PARAMETERS]
-
- MSF Min/Sec/Frame Value
-
- [RETURNS]
-
- Total Frames from Min/Sec/Frames Value
-
- [DESCRIPTION]
-
- Converts a Min/Sec/Frames Value into the Total Number of Frames it
- represents.
-
- Converts a min/sec/frame value to a count of the total frames.
-
- [SEE-ALSO]
-
- VCD_TotalFramesToMSF
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_TotalFramesToMSF( TotalFrames : LONGINT;
- Var MSF : TMSF );
-
- [PARAMETERS]
-
- TotalFrames
- MSF VAR Returned Frames converted to Min/Sec/Frames
-
- [RETURNS]
-
- (Function : None)
- (VAR : [MSF] Frame converted to Min/Sec/Frames)
-
- [DESCRIPTION]
-
- Converts a Frames Value into Min/Sec/Frames.
-
- Converts a total frames value to a min/sec/frame value.
-
- [SEE-ALSO]
-
- VCD_MSFtoTotalFrames
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_LoadMSF( Var MSF : TMSF;
- M : BYTE;
- S : BYTE;
- F : BYTE );
-
- [PARAMETERS]
-
- MSF VAR Returned Min/Sec/Frame Value
- M Source Minutes
- S Source Seconds
- F Source Frames
-
- [RETURNS]
-
- (Function : None)
- (VAR : [MSF] Min/Sec/Frame Value)
-
- [DESCRIPTION]
-
- Converts time Values into Min/Sec/Frames
-
- Loads a min/sec/frame record with values.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_GetCaps( Caps : PCDLibCaps );
-
- [PARAMETERS]
-
- Caps Pointer to ?
-
- [RETURNS]
-
- (Function : None)
- (Ptr : [Caps] Pointer to ?)
-
- [DESCRIPTION]
-
- Gets the capabilities of the CD-rom lib in the current environment.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_CheckForMethod( Method : BYTE ) : BOOLEAN;
-
- [PARAMETERS]
-
- Method ?
-
- [RETURNS]
-
- [DESCRIPTION]
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_Open( Flags : WORD;
- MethodListStr : ST80 ) : TCDHandle;
-
- [PARAMETERS]
-
- Flags ?
- MethodListStr ?
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Opens an instance of the cd-rom library. "MethodListStr" should
- currently be 'MSCDEX'. "Flags" should be 0. Returns a Non-0 (NIL)
- handle if successfull, 0/NIL if failure.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_Close( Handle : TCDHandle );
-
- [PARAMETERS]
-
- Handle ?
-
- [RETURNS]
-
- (None)
-
- [DESCRIPTION]
-
- Closes an instance of the cd-rom library. The "Handle" should be a
- handle previously obtained from a call to VCD_Open.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Procedure VCD_GetDriveCaps( Handle : TCDHandle;
- Drive : WORD;
- CDDriveCaps : PCDDriveCaps );
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- CDDriveCaps Pointer to CD-ROM Drive Capacity Data
-
- [RETURNS]
-
- (Function : None)
- (Ptr : [CDDriveCaps] Pointer to CD-ROM Drive Capacity Data)
-
- [DESCRIPTION]
-
- Gets the capabilities of a specific cd-rom drive.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_GetNumDrives( Handle : TCDHandle ) : WORD;
-
- [PARAMETERS]
-
- Handle ?
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Returns the number of CD-rom drives installed in the system "Handle"
- should be a handle previously obtained from VCD_Open.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_GetAudioDiskInfo( Handle : TCDHandle;
- Drive : WORD;
- Var FirstTrack : WORD;
- Var LastTrack : WORD;
- Var StartLeadOut : TMSF ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- FirstTrack VAR Returned First Track Number
- LastTrack VAR Returned Last Track Number
- StartLeadOut VAR Returned Starting Lead Out Time
-
- [RETURNS]
-
- (Function : Status Code)
- (VAR : [FirstTrack] First Track Number)
- (VAR : [LastTrack] Last Track Number)
- (VAR : [StartLeadOut] Starting Lead Out Time)
-
- [DESCRIPTION]
-
- Gets a audio cd's disk information. Includes information on the first
- and last audio track on the disk, and the start of the lead out track
- (end of the audio) as a min/sec/frame value.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_GetAudioTrackInfo( Handle : TCDHandle;
- Drive : WORD;
- Track : WORD;
- Var Start : TMSF;
- Var TrackConInfo : WORD ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- Track ?
- Start VAR Returned Starting Time
- TrackConInfo VAR Returned ?
-
- [RETURNS]
-
- (Function : Status Code)
- (VAR : [Start] Starting Time)
- (VAR : [TrackConInfo] ?)
-
- [DESCRIPTION]
-
- Gets information about an audio track on a cd. "track" is the track
- number to get the information about. "Start" returns as the Min/sec/frame
- start time of the track. "TrackConInfo" are the track control info flags.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_GetAudioQChanInfo( Handle : TCDHandle;
- Drive : WORD;
- Var ConAdr : WORD;
- Var TrackNum : WORD;
- Var IndexNum : WORD;
- Var TrkRelTime : TMSF;
- Var DskRelTime : TMSF ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- ConAdr VAR Returned ?
- TrackNum VAR Returned Current Track Number
- IndexNum VAR Returned Current Index Number
- TrkRelTime VAR Returned Current Track Relative Time
- DskRelTime VAR Returned Current Disk Relative Time
-
- [RETURNS]
-
- (Function : Status Code)
- (VAR : [ConAdr] ?)
- (VAR : [TrackNum] Current Track Number)
- (VAR : [IndexNum] Current Index Number)
- (VAR : [TrkRelTime] Current Track Relative Time)
- (VAR : [DskRelTime] Current Disk Relative Time)
-
- [DESCRIPTION]
-
- Gets an audio tracks "Q-Channel" information from the currently playing
- track. The Q-Channel contains information about the currently playing
- audio track. The returned info includes "ConAdr" (not used), "TrackNum",
- the track number that is currently being played; "IndexNum" the index
- within the track that is being played; "TrkRelTime", the current
- min/sec/frame being played, relative to the start of the track; and
- "DskRelTime" which is the current min/sec/frame being played relative
- to the start of the disk.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_GetAudioStatusInfo( Handle : TCDHandle;
- Drive : WORD;
- Var AudioStatus : WORD;
- Var PlayStart : TMSF;
- Var PlayEnd : TMSF ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- AudioStatus VAR Returned CD-ROM Audio Status Code
- PlayStart VAR Returned Last Play Start Time
- PlayEnd VAR Returned Last Play End Time
-
- [RETURNS]
-
- (Function : Status Code)
- (VAR : [AudioStatus] CD-ROM Audio Status Code)
- (VAR : [PlayStart] Last Play Start Time)
- (VAR : [PlayEnd] Last Play End Time)
-
- [DESCRIPTION]
-
- Gets information about the currently "audio play". This info includes
- "AudioStatus" (TBD), "PlayStart", the min/sec/frame at which the current
- audio play operation started, and PlayEnd, the min/sec/frame at which
- the audio play operation will end. }
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_PlayMSFfor( Handle : TCDHandle;
- Drive : WORD;
- Start : TMSF;
- PlayFor : TMSF ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- Start Min/Sec/Frame to Start Playing From
- PlayFor Number of Min/Sec/Frame to Play
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Plays from a specified min/sec/frame for a specified number of
- mins/secs/frames.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_PlayMSFto( Handle : TCDHandle;
- Drive : WORD;
- Start : TMSF;
- PlayTo : TMSF ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
- Start Min/Sec/Frame to Start Playing from
- PlayTo Min/Sec/Frame to End Playing at
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Plays from a specified min/sec/frame to a specified min/sec/frame.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_Pause( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Pauses the audio play of a specified drive.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_Stop( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Stops the audio play of a specified drive.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-
- ──────────────────────────────────────────────────────────────────────────────
-
-
- [FUNCTION]
-
- Function VCD_Resume( Handle : TCDHandle;
- Drive : WORD ) : TError;
-
- [PARAMETERS]
-
- Handle ?
- Drive CD-ROM Drive Number
-
- [RETURNS]
-
- [DESCRIPTION]
-
- Resumes the audio play of a specified drive.
-
- [SEE-ALSO]
-
- [EXAMPLE]
-
-