home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / sound / digpak / sbapi.int < prev    next >
Encoding:
Text File  |  1994-02-21  |  4.0 KB  |  135 lines

  1. UNIT SBAPI;
  2.  
  3.  
  4. *  Procedures and definitions in the SBAPI unit *
  5. *  must USE the SBDRV unit and the DOS unit in  *
  6. *  your program                                 *
  7.  
  8. * Previous to the procedure definition is the equivalent INT 66 h *
  9. * call if you want to write your own interface. *
  10. * all these procedures in the unit are written in inline assembly language *
  11. * so it is unlikely that you could come up with a tighter interface unless *
  12. * you used INLINE macros or hand coded each individual call in assembler.  *
  13.  
  14.  
  15. INTERFACE
  16.  
  17.  
  18. {
  19.   C definition of sound structure and PASCAL derivative.
  20.   all the sound procedures take a variable of this type as thier argument.
  21.   (code was adapted from code for C)
  22.   typedef struct
  23.  {
  24.     unsigned char far *sound; // Far address of audio data.
  25.     unsigned int     sndlen;  // Length of audio sample.
  26.     int far *IsPlaying;       // Address of play status flag.
  27.     int     frequency;        // Playback frequency.
  28. { SNDSTRUC; }
  29.  
  30. TYPE SoundRec = RECORD
  31.         SoundData : Pointer;
  32.         SndLen    : Word;
  33.         IsPlaying : ^Integer;
  34.         Frequency : Integer;
  35.         END;
  36.    
  37.  
  38. VAR     
  39.  SBAvailable : BOOLEAN;
  40.        { set to TRUE if a sound card is available. }
  41.        { If this is false then the INT 66h vector is set to an IRET } 
  42.        { and all of these procedures return with no effect }
  43.  
  44. PROCEDURE PlaySound(VAR TheSound : SoundRec);
  45. FUNCTION SoundPlaying : BOOLEAN ;
  46. FUNCTION AudioPendingStatus : INTEGER;
  47. PROCEDURE MassageAudio(VAR TheSound : SoundRec);
  48. PROCEDURE PlayMassagedAudio(VAR TheSound : SoundRec);
  49. PROCEDURE StopSound;
  50. PROCEDURE PostSound(VAR TheSound : SoundRec; VAR Result : INTEGER);
  51. FUNCTION DetectBlaster(VAR PortBase,IRQ : Word)  : BOOLEAN;
  52.  
  53. IMPLEMENTATION
  54.  
  55.  
  56. FUNCTION DetectBlaster(VAR PortBase,IRQ : Word) : Boolean; external;
  57.  
  58.  
  59. {Function #1: DigPlay, Play an 8 bit digitized sound.
  60.  
  61.     INPUT:  AX = 688h    Command number.
  62.         DS:SI        Point to a sound structure that
  63.                  describes the sound effect to be played.}
  64.  
  65.  
  66. PROCEDURE PlaySound(VAR TheSound : SoundRec); assembler;
  67.  
  68. {       INPUT:  AX = 689h
  69.     OUTPUT: AX = 0       No sound is playing.
  70.            = 1       Sound effect currently playing.
  71.         DX = 0       No sound is looping.
  72.            = 1       A sound effect is looping.
  73.         BX = version Starting with version 3.1, the BX register
  74.                  of the SoundStatus call will return the
  75.                  version number.  The version number is in
  76.                  decimal, and multiplied times 100.  Meaning
  77.                  a return of 310, is equal to version 3.10.
  78.                  Versions before 3.1, did not set the BX
  79.                  register to anything, so you should zero
  80.                  out the BX register before you check the
  81.                  version number.  If the BX register is still
  82.                  zero, then the DigPak driver loaded is less
  83.                  than 3.1. }
  84.  
  85. FUNCTION SoundPlaying : BOOLEAN ; ;
  86.  
  87. { Function #3: MassageAudio, Preformat audio data into output hardware format.
  88.  
  89.     INPUT:  AX = 68Ah
  90.         DS:SI        Point to address of sound structure. }
  91.  
  92. PROCEDURE MassageAudio(VAR TheSound : SoundRec); assembler;
  93.  
  94. { Function #4: DigPlay2, Play preformatted audio data.
  95.  
  96.     INPUT:  AX = 68Bh
  97.         DS:SI        Point to address of sound structure.}
  98.  
  99. PROCEDURE PlayMassagedAudio(VAR TheSound : SoundRec); assembler;
  100.  
  101. {Function #8: StopSound, stop currently playing sound.
  102.  
  103.     INPUT: AX = 68Fh
  104.     OUTPUT: None.
  105.  
  106.           Will cause any currently playing sound effect to be
  107.           terminated. }
  108.  
  109. PROCEDURE StopSound; assembler;
  110.  
  111. {FUNCTION #14: PostAudioPending
  112.  
  113.     INPUT: AX = 695h
  114.            DS:SI -> sound structure, preformated data.
  115.  
  116.     OUTPUT: AX = 0  Sound was started playing.
  117.         AX = 1  Sound was posted as pending to play.
  118.         AX = 2  Already a sound effect pending, this one not posted.}
  119.  
  120.  
  121. PROCEDURE PostSound(VAR TheSound : SoundRec; VAR Result : INTEGER); 
  122.  
  123.  
  124. {FUNCTION #15: AudioPendingStatus
  125.  
  126.     INPUT:  AX = 696h
  127.  
  128.     OUTPUT: AX = 0 No sound is playing.
  129.         AX = 1 Sound playing, sound pending.
  130.         AX = 2 Sound playing, no sound pending. }
  131.  
  132. FUNCTION AudioPendingStatus : INTEGER; 
  133.  
  134. END.
  135.