home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / sdevice.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-06  |  7KB  |  216 lines

  1. {*      SDEVICE.PAS
  2.  *
  3.  * Sound Device definitions
  4.  *
  5.  * Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6.  *
  7.  * This file is part of the MIDAS Sound System, and may only be
  8.  * used, modified and distributed under the terms of the MIDAS
  9.  * Sound System license, LICENSE.TXT. By continuing to use,
  10.  * modify or distribute this file you indicate that you have
  11.  * read the license and understand and accept it fully.
  12. *}
  13.  
  14. unit    SDevice;
  15.  
  16.  
  17. interface
  18.  
  19.  
  20. const
  21.     SMPMAX = 65519;                     { max sample length (65536-16 - 1) }
  22.     MAXINSTS = 256;                     { maximum number of instruments }
  23.  
  24.  
  25.  
  26. {****************************************************************************\
  27. *       enum smpTypes
  28. *       -------------
  29. * Description:  Sample types
  30. \****************************************************************************}
  31.  
  32. const
  33.     smpNone = 0;                        { no sample }
  34.     smp8bit = 1;                        { 8-bit unsigned sample }
  35.  
  36.  
  37.  
  38. {****************************************************************************\
  39. *       enum sdPanning
  40. *       --------------
  41. * Description:  Sound Device panning values. Legal values range from
  42. *               panLeft to panRight, in steps of 1, plus panSurround.
  43. *               Surround sound is played from middle if surround is not
  44. *               enabled.
  45. \****************************************************************************}
  46.  
  47. const
  48.     panLeft = -64;                      { left speaker }
  49.     panMiddle = 0;                      { middle (both speakers) }
  50.     panRight = 64;                      { right speaker }
  51.     panSurround = $80;                  { surround sound }
  52.  
  53.  
  54.  
  55.  
  56. {****************************************************************************\
  57. *       enum sdSmpPos
  58. *       -------------
  59. * Description:  Sample positions in memory
  60. \****************************************************************************}
  61.  
  62. const
  63.     sdSmpNone = 0;                  { no sample }
  64.     sdSmpConv = 1;                  { conventional memory }
  65.     sdSmpEMS = 2;                   { EMS }
  66.  
  67.  
  68.  
  69. {****************************************************************************\
  70. *       enum sdStatus
  71. *       -------------
  72. * Description:  SoundDevice status
  73. \****************************************************************************}
  74.  
  75. const
  76.     sdUnInitialized = 0;
  77.     sdOK = 1;
  78.  
  79.  
  80.  
  81. {****************************************************************************\
  82. *       enum sdMode
  83. *       -----------
  84. * Description:  Possible SoundDevice output modes
  85. \****************************************************************************}
  86.  
  87. const
  88.     sdMono = 1;                         { mono }
  89.     sdStereo = 2;                       { stereo }
  90.  
  91.     sd8bit = 4;                         { 8-bit output }
  92.     sd16bit = 8;                        { 16-bit output }
  93.  
  94.     sdLowQ = 16;                        { low quality mixing }
  95.     sdNormalQ = 32;                     { normal quality mixing }
  96.     sdHighQ = 64;                       { high quality mixing }
  97.  
  98.  
  99.  
  100. {****************************************************************************\
  101. *       struct SoundDevice
  102. *       ------------------
  103. * Description:  SoundDevice structure. See SDEVICE.TXT for documentation
  104. \****************************************************************************}
  105.  
  106.     { Sound Device function pointer types: }
  107. type
  108.     Pinteger = ^integer;
  109.     Pword = ^word;
  110.     Plongint = ^longint;
  111.  
  112.     sdDetect = function(result : Pinteger) : integer;
  113.     sdInit = function(mixRate, mode : word) : integer;
  114.     sdClose = function : integer;
  115.     sdGetMixRate = function(mixRate : Pword) : integer;
  116.     sdGetMode = function(mode : Pword) : integer;
  117.     sdOpenChannels = function(channels : word) : integer;
  118.     sdCloseChannels = function : integer;
  119.     sdClearChannels = function : integer;
  120.     sdMute = function(mute : integer) : integer;
  121.     sdPause = function(pause : integer) : integer;
  122.     sdSetMasterVolume = function(masterVolume : byte) : integer;
  123.     sdPlaySound = function(channel : word; rate : longint) : integer;
  124.     sdStopSound = function(channel : word) : integer;
  125.     sdSetRate = function(channel : word; rate : longint) : integer;
  126.     sdGetRate = function(channel : word; rate : Plongint) : integer;
  127.     sdSetVolume = function(channel : word; volume : byte) : integer;
  128.     sdSetInstrument = function(channel : word; inst : word) : integer;
  129.     sdSetPosition = function(channel : word; pos : word) : integer;
  130.     sdGetPosition = function(channel : word; pos : Pword) : integer;
  131.     sdSetPanning = function(channel : word; panning : integer) : integer;
  132.     sdGetPanning = function(channel : word; panning : Pinteger) : integer;
  133.     sdMuteChannel = function(channel : word; mute : integer) : integer;
  134.     sdAddInstrument = function(sample : pointer; smpType : integer;
  135.         length, loopStart, loopEnd : word; volume : byte; loop : integer;
  136.         instHandle : Pword) : integer;
  137.     sdRemInstrument = function(inst : word) : integer;
  138.     sdSetUpdRate = function(updRate : word) : integer;
  139.     sdPlay = function(callMP : Pinteger) : integer;
  140.  
  141.  
  142.     { actual Sound Device structure: }
  143.  
  144.     SoundDevice = Record
  145.         tempoPoll : word;               { poll to tempo? }
  146.         ioPort : word;                  { I/O port number }
  147.         IRQ : byte;                     { IRQ number }
  148.         DMA : byte;                     { DMA channel number }
  149.         status : word;                  { Sound Device status }
  150.         modes : word;                   { Possible output modes, bitfield.
  151.                                           See enum sdModes. }
  152.         ID : ^char;                     { Pointer to Sound Device ID string,
  153.                                           ASCIIZ }
  154.  
  155.         Detect : sdDetect;
  156.         Init : sdInit;
  157.         Close : sdClose;
  158.         GetMixRate : sdGetMixRate;
  159.         GetMode : sdGetMode;
  160.         OpenChannels : sdOpenChannels;
  161.         CloseChannels : sdCloseChannels;
  162.         ClearChannels : sdClearChannels;
  163.         Mute : sdMute;
  164.         Pause : sdPause;
  165.         SetMasterVolume : sdSetMasterVolume;
  166.         PlaySound : sdPlaySound;
  167.         StopSound : sdStopSound;
  168.         SetRate : sdSetRate;
  169.         GetRate : sdGetRate;
  170.         SetVolume : sdSetVolume;
  171.         SetInstrument : sdSetInstrument;
  172.         SetPosition : sdSetPosition;
  173.         GetPosition : sdGetPosition;
  174.         SetPanning : sdSetPanning;
  175.         GetPanning : sdGetPanning;
  176.         MuteChannel : sdMuteChannel;
  177.         AddInstrument : sdAddInstrument;
  178.         RemInstrument : sdRemInstrument;
  179.         SetUpdRate : sdSetUpdRate;
  180.         Play : sdPlay;
  181.     end;
  182.  
  183.     PSoundDevice = ^SoundDevice;
  184.  
  185.  
  186.  
  187. { Sound Device structures: }
  188.  
  189. procedure GUS;                          { Gravis UltraSound Sound Device }
  190. procedure PAS;                          { Pro Audio Spectrum series SD }
  191. procedure WSS;                          { Windows Sound System SD }
  192. procedure SB;                           { Sound Blaster series SD }
  193. procedure NSND;                         { No Sound Sound Device }
  194.  
  195.  
  196.  
  197. implementation
  198.  
  199.  
  200. USES  Errors, mGlobals, mMem, DMA, DSM;
  201.  
  202.  
  203. procedure GUS; external;
  204. {$L GUS.OBJ}
  205. procedure PAS; external;
  206. {$L PAS.OBJ}
  207. procedure WSS; external;
  208. {$L WSS.OBJ}
  209. procedure SB; external;
  210. {$L SB.OBJ}
  211. procedure NSND; external;
  212. {$L NSND.OBJ}
  213.  
  214.  
  215. END.
  216.