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

  1. {*      DSM.PAS
  2.  *
  3.  * Digital Sound Mixer, v1.11
  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.  
  15. unit DSM;
  16.  
  17.  
  18. interface
  19.  
  20.  
  21. const
  22.     VOLLEVELS = 33;
  23.     VOLSHIFT = 1;
  24.  
  25.  
  26.  
  27. {****************************************************************************\
  28. *       struct dsmChannel
  29. *       -----------------
  30. * Description:  DSM channel data
  31. \****************************************************************************}
  32.  
  33. type
  34.     dsmChannel = Record
  35.         pos : word;                     { mixing position }
  36.         posl : word;                    { mixing position fraction }
  37.         rate : longint;                 { playing rate in Hz }
  38.         inst : word;                    { instrument number }
  39.         sample : pointer;               { current sample data }
  40.         smpType : byte;                 { current sample type }
  41.         smpPos : byte;                  { current sample position }
  42.         slength : word;                 { current sample length }
  43.         loopStart : word;               { current sample loop start }
  44.         loopEnd : word;                 { current sample loop end }
  45.         looping : byte;                 { 1 if current sample is looping }
  46.         instChanged : byte;             { 1 if instrument has been changed
  47.                                           (Amiga Loop Emulation) }
  48.         panning : byte;                 { panning information }
  49.         volume : byte;                  { playing volume (0-64) }
  50.         muted : byte;                   { 1 if channel muted, 0 if not }
  51.         hasData : byte;                 { 1 if channel has data to be played,
  52.                                           0 if not }
  53.     end;
  54.  
  55.  
  56.  
  57. {****************************************************************************\
  58. *       struct dsmInstrument
  59. *       --------------------
  60. * Description:  DSM internal instrument structure
  61. \****************************************************************************}
  62.  
  63. type
  64.     dsmInstrument = Record
  65.         sample : pointer;                   { pointer to sample data }
  66.         smpType : byte;                     { sample type }
  67.         smpPos : byte;                      { sample position. see enum
  68.                                               dsmSmpPos }
  69.         slength : word;                     { sample length }
  70.         loopStart : word;                   { sample loop start }
  71.         loopEnd : word;                     { sample loop end }
  72.         volume : byte;                      { default playing volume }
  73.         looping : byte;                     { 1 if looping sample, 0 if not }
  74.         inuse : byte;                       { 1 if sample is in use, 0 if not
  75.                                             (removed using dsmRemInstrument) }
  76.     end;
  77.  
  78.  
  79. {****************************************************************************\
  80. *      DSM functions. See documentation on Sound Device member functions
  81. \****************************************************************************}
  82.  
  83. type
  84.     Pinteger = ^integer;
  85.     Pword = ^word;
  86.     Plongint = ^longint;
  87.  
  88. function dsmInit(mixRate, mode : word) : integer;
  89. function dsmClose : integer;
  90. function dsmGetMixRate(mixRate : Pword) : integer;
  91. function dsmGetMode(mode : Pword) : integer;
  92. function dsmOpenChannels(channels : word) : integer;
  93. function dsmCloseChannels : integer;
  94. function dsmClearChannels : integer;
  95. function dsmMute(mute : integer) : integer;
  96. function dsmPause(pause : integer) : integer;
  97. function dsmSetMasterVolume(masterVolume : byte) : integer;
  98. function dsmPlaySound(channel : word; rate : longint) : integer;
  99. function dsmStopSound(channel : word) : integer;
  100. function dsmSetRate(channel : word; rate : longint) : integer;
  101. function dsmGetRate(channel : word; rate : Plongint) : integer;
  102. function dsmSetVolume(channel : word; volume : byte) : integer;
  103. function dsmSetInstrument(channel : word; inst : word) : integer;
  104. function dsmSetPosition(channel : word; pos : word) : integer;
  105. function dsmGetPosition(channel : word; pos : Pword) : integer;
  106. function dsmSetPanning(channel : word; panning : integer) : integer;
  107. function dsmGetPanning(channel : word; panning : Pinteger) : integer;
  108. function dsmMuteChannel(channel : word; mute : integer) : integer;
  109. function dsmAddInstrument(sample : pointer; smpType : integer;
  110.     length, loopStart, loopEnd : word; volume : byte; loop : integer;
  111.     instHandle : Pword) : integer;
  112. function dsmRemInstrument(inst : word) : integer;
  113. function dsmSetUpdRate(updRate : word) : integer;
  114. function dsmPlay(callMP : Pinteger) : integer;
  115.  
  116.  
  117. var dsmBuffer : array[0..32] of byte;   { DSM mixing buffer. Ugly, but the
  118.                                           dmaBuffer struct is not available }
  119.     dsmDMAPos : word;
  120.  
  121.  
  122.  
  123. implementation
  124.  
  125. uses Errors, mGlobals, mMem, EMS, DMA;
  126.  
  127.  
  128. function dsmInit(mixRate, mode : word) : integer; external;
  129. function dsmClose : integer; external;
  130. function dsmGetMixRate(mixRate : Pword) : integer; external;
  131. function dsmGetMode(mode : Pword) : integer; external;
  132. function dsmOpenChannels(channels : word) : integer; external;
  133. function dsmCloseChannels : integer; external;
  134. function dsmClearChannels : integer; external;
  135. function dsmMute(mute : integer) : integer; external;
  136. function dsmPause(pause : integer) : integer; external;
  137. function dsmSetMasterVolume(masterVolume : byte) : integer; external;
  138. function dsmPlaySound(channel : word; rate : longint) : integer; external;
  139. function dsmStopSound(channel : word) : integer; external;
  140. function dsmSetRate(channel : word; rate : longint) : integer; external;
  141. function dsmGetRate(channel : word; rate : Plongint) : integer; external;
  142. function dsmSetVolume(channel : word; volume : byte) : integer; external;
  143. function dsmSetInstrument(channel : word; inst : word) : integer; external;
  144. function dsmSetPosition(channel : word; pos : word) : integer; external;
  145. function dsmGetPosition(channel : word; pos : Pword) : integer; external;
  146. function dsmSetPanning(channel : word; panning : integer) : integer; external;
  147. function dsmGetPanning(channel : word; panning : Pinteger) : integer;
  148.     external;
  149. function dsmMuteChannel(channel : word; mute : integer) : integer; external;
  150. function dsmAddInstrument(sample : pointer; smpType : integer;
  151.     length, loopStart, loopEnd : word; volume : byte; loop : integer;
  152.     instHandle : Pword) : integer; external;
  153. function dsmRemInstrument(inst : word) : integer; external;
  154. function dsmSetUpdRate(updRate : word) : integer; external;
  155. function dsmPlay(callMP : Pinteger) : integer; external;
  156.  
  157. {$L DSM.OBJ}
  158.  
  159.  
  160. END.
  161.