home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / prg / dsik205 / dsik.dat / INCLUDE / AUDIO.INC < prev    next >
Text File  |  1995-04-10  |  9KB  |  352 lines

  1. ;/***************************************************************************
  2. ;*
  3. ;*                   Digital Sound Interface Kit (DSIK)
  4. ;*                            Version 2.00
  5. ;*
  6. ;*                           by Carlos Hasan
  7. ;*
  8. ;* Filename:     audio.inc
  9. ;* Version:      Revision 1.1
  10. ;*
  11. ;* Language:     Turbo Assembler 4.0 (Ideal Mode)
  12. ;* Environment:  IBM PC (DOS/4GW)
  13. ;*
  14. ;* Description:  Audio Interface assembly header file.
  15. ;*
  16. ;* Revision History:
  17. ;* ----------------
  18. ;*
  19. ;* Revision 1.1  95/01/13  22:43:26  chv
  20. ;* Now can be assembled using TASM 3.2 or later
  21. ;*
  22. ;* Revision 1.0  94/12/28  14:32:41  chv
  23. ;* Initial revision
  24. ;*
  25. ;***************************************************************************/
  26.  
  27. pushstate
  28.  
  29. ; Misc defines
  30.  
  31. MAXVOICES       =   32
  32. MAXTRACKS       =   16
  33. MAXSAMPLES      =   256
  34. MAXORDERS       =   128
  35. MINPERIOD       =   28
  36. MAXPERIOD       =   6848
  37. MIDCPERIOD      =   428
  38. MIDCFREQ        =   8363
  39.  
  40. ; Soundcards ID values
  41.  
  42. ID_NONE         =   0
  43. ID_SB           =   1
  44. ID_SB201        =   2
  45. ID_SBPRO        =   3
  46. ID_SB16         =   4
  47. ID_PAS          =   5
  48. ID_PASPLUS      =   6
  49. ID_PAS16        =   7
  50. ID_WSS          =   8
  51. ID_GUS          =   9
  52. ID_DEBUG        =   255
  53.  
  54. ; Soundcards capabilities bit flags
  55.  
  56. AF_8BITS        =   00000000b
  57. AF_16BITS       =   00000001b
  58. AF_MONO         =   00000000b
  59. AF_STEREO       =   00000010b
  60. AF_NODRAM       =   00000000b
  61. AF_DRAM         =   00000100b
  62.  
  63. ; Stereo panning values
  64.  
  65. PAN_LEFT        =   000h
  66. PAN_MIDDLE      =   040h
  67. PAN_RIGHT       =   080h
  68. PAN_SURROUND    =   0A4h
  69.  
  70. ; Internal lowlevel audio messages bitflags
  71.  
  72. AM_SAMPLE       =   00000001b
  73. AM_KEYON        =   00000010b
  74. AM_KEYOFF       =   00000100b
  75. AM_VOLUME       =   00001000b
  76. AM_BALANCE      =   00010000b
  77. AM_SETCTL       =   00100000b
  78. AM_GETCTL       =   01000000b
  79. AM_PAUSE        =   10000000b
  80.  
  81. ; Music playing status values
  82.  
  83. PS_STOPPED      =   0
  84. PS_PLAYING      =   1
  85. PS_PAUSED       =   2
  86.  
  87. ; Music pattern break modes
  88.  
  89. PB_NONE         =   0
  90. PB_BREAK        =   1
  91. PB_JUMP         =   2
  92. PB_HOLD         =   3
  93. PB_TRACE        =   4
  94.  
  95. ; RIFF/DSMF block identifier values
  96.  
  97. ID_RIFF         =   46464952h
  98. ID_DSMF         =   464D5344h
  99. ID_SONG         =   474E4F53h
  100. ID_INST         =   54534E49h
  101. ID_PATT         =   54544150h
  102.  
  103. ; RIFF/WAVE block identifier values
  104.  
  105. ID_WAVE         =   45564157h
  106. ID_FMT          =   20746D66h
  107. ID_DATA         =   61746164h
  108.  
  109. ; RIFF/DSMF INST digital samples bit flags
  110.  
  111. SF_LOOPED       =   00000001b
  112. SF_UNSIGNED     =   00000000b
  113. SF_SIGNED       =   00000010b
  114. SF_8BITS        =   00000000b
  115. SF_16BITS       =   00000100b
  116. SF_DELTA        =   01000000b
  117. SF_LIBRARY      =   10000000b
  118.  
  119. ; RIFF/WAVE sample format
  120.  
  121. WAVE_FMT_PCM    =   1
  122.  
  123. ; Error values
  124.  
  125. ERR_OK          =   0
  126. ERR_FORMAT      =   1
  127. ERR_NOFILE      =   2
  128. ERR_FILEIO      =   3
  129. ERR_NOMEM       =   4
  130. ERR_NODRAM      =   5
  131.  
  132. ; Internal lowlevel audio drivers structure
  133.  
  134. struc Driver
  135.     Magic           dd      ?
  136.     Next            dd      ?
  137.     ID              db      ?
  138.     Modes           db      ?
  139.     DriverName      db      32 dup (?)
  140.     Port            dw      ?
  141.     IrqLine         db      ?
  142.     DmaChannel      db      ?
  143.     MinRate         dw      ?
  144.     MaxRate         dw      ?
  145.     BufferLength    dw      ?
  146.     ProcTablePtr    dd      ?
  147.     DriverPtr       dd      ?
  148.     ParmTablePtr    dd      ?
  149. ends Driver
  150.  
  151. ; Internal soundcards configuration structure
  152.  
  153. struc SoundCard
  154.     ID              db      ?
  155.     Modes           db      ?
  156.     Port            dw      ?
  157.     IrqLine         db      ?
  158.     DmaChannel      db      ?
  159.     SampleRate      dw      ?
  160.     DriverName      db      16 dup (?)
  161. ends SoundCard
  162.  
  163. ; RIFF file and block headers structures
  164.  
  165. struc RiffHeader
  166.     ID              dd      ?
  167.     FileLength      dd      ?
  168.     FileType        dd      ?
  169. ends RiffHeader
  170.  
  171. struc RiffBlock
  172.     ID              dd      ?
  173.     BlockLength     dd      ?
  174. ends RiffBlock
  175.  
  176. ; RIFF/WAVE fmt block structure
  177.  
  178. struc WaveFmt
  179.     Format          dw      ?
  180.     Channels        dw      ?
  181.     SampleRate      dd      ?
  182.     BytesPerSecond  dd      ?
  183.     BlockAlign      dw      ?
  184.     BitsPerSample   dw      ?
  185. ends WaveFmt
  186.  
  187. ; RIFF/DSMF SONG block structure
  188.  
  189. struc Song
  190.     ModuleName      db      28 dup (?)
  191.     FileVersion     dw      ?
  192.     Flags           dw      ?
  193.     OrderPos        dw      ?
  194.     ReStart         dw      ?
  195.     NumOrders       dw      ?
  196.     NumSamples      dw      ?
  197.     NumPatterns     dw      ?
  198.     NumTracks       dw      ?
  199.     GlobalVolume    db      ?
  200.     MasterVolume    db      ?
  201.     InitTempo       db      ?
  202.     InitBPM         db      ?
  203.     ChanMap         db      MAXTRACKS dup (?)
  204.     Orders          db      MAXORDERS dup (?)
  205. ends Song
  206.  
  207. ; RIFF/DSMF INST block structure
  208.  
  209. struc Sample
  210.     FileName        db      13 dup (?)
  211.     Flags           dw      ?
  212.     Volume          db      ?
  213.     SampleLength    dd      ?
  214.     LoopStart       dd      ?
  215.     LoopEnd         dd      ?
  216.     DataPtr         dd      ?
  217.     Rate            dw      ?
  218.     Voice           dw      ?
  219.     SampleName      db      28 dup (?)
  220. ends Sample
  221.  
  222. ; RIFF/DSMF PATT block structure
  223.  
  224. struc Pattern
  225.     PtnLength       dw      ?
  226.     PtnData         db      ?
  227. ends Pattern
  228.  
  229. ; Internal RIFF/DSMF music module structure
  230.  
  231. struc DSM
  232.     Header          Song    ?
  233.     Samples         dd      ?
  234.     Patterns        dd      ?
  235. ends DSM
  236.  
  237. ; Internal music structures
  238.  
  239. struc MTrk
  240.     Note            db      ?
  241.     SampleNo        db      ?
  242.     Volume          db      ?
  243.     Balance         db      ?
  244.     Effect          dw      ?
  245.     Rate            dw      ?
  246.     VUMeter         db      ?
  247.     Flags           db      ?
  248.     Reserved        db      38 dup (?)
  249. ends MTrk
  250.  
  251. struc MHdr
  252.     MusicVolume     dd      ?
  253.     SoundVolume     dd      ?
  254.     Tracks          MTrk    MAXVOICES dup (?)
  255.     NumTracks       db      ?
  256.     NumVoices       db      ?
  257.     OrderPos        db      ?
  258.     OrderLen        db      ?
  259.     ReStart         db      ?
  260.     PattNum         db      ?
  261.     PattRow         db      ?
  262.     BreakFlag       db      ?
  263.     Tempo           db      ?
  264.     TempoCount      db      ?
  265.     BPM             db      ?
  266.     SyncMark        db      ?
  267.     Status          db      ?
  268.     DriverStatus    db      ?
  269.     PattPtr         dd      ?
  270.     SongPtr         dd      ?
  271. ends MHdr
  272.  
  273. ; External lowlevel audio drivers
  274.  
  275. codeseg
  276.  
  277. global SBDriver:Driver
  278. global PASDriver:Driver
  279. global WSSDriver:Driver
  280. global GUSDriver:Driver
  281.  
  282. macro dRegisterDrivers
  283.     lea     eax,[SBDriver]
  284.     call    dRegisterDriver
  285.     lea     eax,[PASDriver]
  286.     call    dRegisterDriver
  287.     lea     eax,[WSSDriver]
  288.     call    dRegisterDriver
  289.     lea     eax,[GUSDriver]
  290.     call    dRegisterDriver
  291. endm
  292.  
  293. ; Global error variable
  294.  
  295. dataseg
  296.  
  297. global dError:dword
  298. global dErrorMsg:dword
  299.  
  300. ; Audio interface API prototypes
  301.  
  302. codeseg
  303.  
  304. global  dRegisterDriver:proc
  305. global  dGetDriverStruc:proc
  306. global  dGetDriverFlags:proc
  307. global  dInit:proc
  308. global  dDone:proc
  309. global  dPoll:proc
  310. global  dSetupVoices:proc
  311. global  dMemAlloc:proc
  312. global  dMemFree:proc
  313. global  dMemAvail:proc
  314. global  dSetMusicVolume:proc
  315. global  dSetSoundVolume:proc
  316. global  dPlayMusic:proc
  317. global  dPlayPatterns:proc
  318. global  dStopMusic:proc
  319. global  dPauseMusic:proc
  320. global  dResumeMusic:proc
  321. global  dGetMusicStatus:proc
  322. global  dGetMusicStruc:proc
  323. global  dPlayVoice:proc
  324. global  dStopVoice:proc
  325. global  dSetVoiceFreq:proc
  326. global  dSetVoiceVolume:proc
  327. global  dSetVoiceBalance:proc
  328. global  dGetVoicePos:proc
  329. global  dGetVoiceStatus:proc
  330.  
  331. global  dAutoDetect:proc
  332. global  dLoadModule:proc
  333. global  dFreeModule:proc
  334. global  dLoadSample:proc
  335. global  dFreeSample:proc
  336. global  dLoadModuleFile:proc
  337. global  dLoadSampleFile:proc
  338. global  dLoadSetup:proc
  339. global  dSaveSetup:proc
  340.  
  341. ; Include the sound system AUDIO.LIB static-link library file
  342.  
  343. includelib "audio.lib"
  344.  
  345. ;[]------------------------------------------------------------------------[]
  346. ; Register calling conventions used by the API routines: The parameters
  347. ; are passed using the EAX, EDX, EBX and ECX registers, all the registers
  348. ; are preserved except the accumulator when it is used to return values.
  349. ;[]------------------------------------------------------------------------[]
  350.  
  351. popstate
  352.