home *** CD-ROM | disk | FTP | other *** search
- UNIT SBAPI;
-
-
- * Procedures and definitions in the SBAPI unit *
- * must USE the SBDRV unit and the DOS unit in *
- * your program *
-
- * Previous to the procedure definition is the equivalent INT 66 h *
- * call if you want to write your own interface. *
- * all these procedures in the unit are written in inline assembly language *
- * so it is unlikely that you could come up with a tighter interface unless *
- * you used INLINE macros or hand coded each individual call in assembler. *
-
-
- INTERFACE
-
-
- {
- C definition of sound structure and PASCAL derivative.
- all the sound procedures take a variable of this type as thier argument.
- (code was adapted from code for C)
- typedef struct
- {
- unsigned char far *sound; // Far address of audio data.
- unsigned int sndlen; // Length of audio sample.
- int far *IsPlaying; // Address of play status flag.
- int frequency; // Playback frequency.
- { SNDSTRUC; }
-
- TYPE SoundRec = RECORD
- SoundData : Pointer;
- SndLen : Word;
- IsPlaying : ^Integer;
- Frequency : Integer;
- END;
-
-
- VAR
- SBAvailable : BOOLEAN;
- { set to TRUE if a sound card is available. }
- { If this is false then the INT 66h vector is set to an IRET }
- { and all of these procedures return with no effect }
-
- PROCEDURE PlaySound(VAR TheSound : SoundRec);
- FUNCTION SoundPlaying : BOOLEAN ;
- FUNCTION AudioPendingStatus : INTEGER;
- PROCEDURE MassageAudio(VAR TheSound : SoundRec);
- PROCEDURE PlayMassagedAudio(VAR TheSound : SoundRec);
- PROCEDURE StopSound;
- PROCEDURE PostSound(VAR TheSound : SoundRec; VAR Result : INTEGER);
- FUNCTION DetectBlaster(VAR PortBase,IRQ : Word) : BOOLEAN;
-
- IMPLEMENTATION
-
-
- FUNCTION DetectBlaster(VAR PortBase,IRQ : Word) : Boolean; external;
-
-
- {Function #1: DigPlay, Play an 8 bit digitized sound.
-
- INPUT: AX = 688h Command number.
- DS:SI Point to a sound structure that
- describes the sound effect to be played.}
-
-
- PROCEDURE PlaySound(VAR TheSound : SoundRec); assembler;
-
- { INPUT: AX = 689h
- OUTPUT: AX = 0 No sound is playing.
- = 1 Sound effect currently playing.
- DX = 0 No sound is looping.
- = 1 A sound effect is looping.
- BX = version Starting with version 3.1, the BX register
- of the SoundStatus call will return the
- version number. The version number is in
- decimal, and multiplied times 100. Meaning
- a return of 310, is equal to version 3.10.
- Versions before 3.1, did not set the BX
- register to anything, so you should zero
- out the BX register before you check the
- version number. If the BX register is still
- zero, then the DigPak driver loaded is less
- than 3.1. }
-
- FUNCTION SoundPlaying : BOOLEAN ; ;
-
- { Function #3: MassageAudio, Preformat audio data into output hardware format.
-
- INPUT: AX = 68Ah
- DS:SI Point to address of sound structure. }
-
- PROCEDURE MassageAudio(VAR TheSound : SoundRec); assembler;
-
- { Function #4: DigPlay2, Play preformatted audio data.
-
- INPUT: AX = 68Bh
- DS:SI Point to address of sound structure.}
-
- PROCEDURE PlayMassagedAudio(VAR TheSound : SoundRec); assembler;
-
- {Function #8: StopSound, stop currently playing sound.
-
- INPUT: AX = 68Fh
- OUTPUT: None.
-
- Will cause any currently playing sound effect to be
- terminated. }
-
- PROCEDURE StopSound; assembler;
-
- {FUNCTION #14: PostAudioPending
-
- INPUT: AX = 695h
- DS:SI -> sound structure, preformated data.
-
- OUTPUT: AX = 0 Sound was started playing.
- AX = 1 Sound was posted as pending to play.
- AX = 2 Already a sound effect pending, this one not posted.}
-
-
- PROCEDURE PostSound(VAR TheSound : SoundRec; VAR Result : INTEGER);
-
-
- {FUNCTION #15: AudioPendingStatus
-
- INPUT: AX = 696h
-
- OUTPUT: AX = 0 No sound is playing.
- AX = 1 Sound playing, sound pending.
- AX = 2 Sound playing, no sound pending. }
-
- FUNCTION AudioPendingStatus : INTEGER;
-
- END.
-