home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / dsm.h < prev    next >
C/C++ Source or Header  |  1994-08-06  |  6KB  |  165 lines

  1. /*      DSM.H
  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. #ifndef __DSM_H
  15. #define __DSM_H
  16.  
  17.  
  18. #define VOLLEVELS 33
  19. #define VOLSHIFT 1
  20.  
  21.  
  22.  
  23.  
  24. /****************************************************************************\
  25. *       struct dsmChannel
  26. *       -----------------
  27. * Description:  DSM channel data
  28. \****************************************************************************/
  29.  
  30. typedef struct
  31. {
  32.     ushort      pos;                    /* mixing position */
  33.     ushort      posl;                   /* mixing position fraction */
  34.     ulong       rate;                   /* playing rate in Hz */
  35.     ushort      inst;                   /* instrument number */
  36.     uchar       *sample;                /* current sample data */
  37.     uchar       smpType;                /* current sample type */
  38.     uchar       smpPos;                 /* current sample position */
  39.     ushort      slength;                /* current sample length */
  40.     ushort      loopStart;              /* current sample loop start */
  41.     ushort      loopEnd;                /* current sample loop end */
  42.     uchar       looping;                /* 1 if current sample is looping */
  43.     uchar       instChanged;            /* 1 if instrument has been changed
  44.                                            (Amiga Loop Emulation) */
  45.     char        panning;                /* panning information */
  46.     uchar       volume;                 /* playing volume (0-64) */
  47.     uchar       muted;                  /* 1 if channel muted, 0 if not */
  48.     uchar       hasData;                /* 1 if channel has data to be played,
  49.                                            0 if not */
  50. } dsmChannel;
  51.  
  52.  
  53.  
  54. /****************************************************************************\
  55. *       struct dsmInstrument
  56. *       --------------------
  57. * Description:  DSM internal instrument structure
  58. \****************************************************************************/
  59.  
  60. typedef struct
  61. {
  62.     void        *sample;                /* pointer to sample data */
  63.     uchar       smpType;                /* sample type */
  64.     uchar       smpPos;                 /* sample position. see enum
  65.                                            dsmSmpPos */
  66.     ushort      slength;                /* sample length */
  67.     ushort      loopStart;              /* sample loop start */
  68.     ushort      loopEnd;                /* sample loop end */
  69.     uchar       volume;                 /* default playing volume */
  70.     uchar       looping;                /* 1 if looping sample, 0 if not */
  71.     uchar       inuse;                  /* 1 if sample is in use, 0 if not
  72.                                            (removed using dsmRemInstrument) */
  73. } dsmInstrument;
  74.  
  75.  
  76.  
  77. #ifdef __cplusplus
  78. extern "C" {
  79. #endif
  80.  
  81.  
  82.  
  83. /****************************************************************************\
  84. *      DSM functions. See documentation on Sound Device member functions
  85. \****************************************************************************/
  86.  
  87. int CALLING dsmInit(ushort mixRate, ushort mode);
  88. int CALLING dsmClose(void);
  89. int CALLING dsmOpenChannels(unsigned channels);
  90. int CALLING dsmCloseChannels(void);
  91. int CALLING dsmGetMixRate(ushort *mixRate);
  92. int CALLING dsmGetMode(ushort *mode);
  93. int CALLING dsmClearChannels(void);
  94. int CALLING dsmMute(int mute);
  95. int CALLING dsmPause(int pause);
  96. int CALLING dsmSetMasterVolume(uchar masterVolume);
  97. int CALLING dsmPlaySound(unsigned channel, ulong rate);
  98. int CALLING dsmStopSound(unsigned channel);
  99. int CALLING dsmSetRate(unsigned channel, ulong rate);
  100. int CALLING dsmGetRate(unsigned channel, ulong *rate);
  101. int CALLING dsmSetVolume(unsigned channel, uchar volume);
  102. int CALLING dsmSetInstrument(unsigned channel, ushort inst);
  103. int CALLING dsmSetPosition(unsigned channel, ushort pos);
  104. int CALLING dsmGetPosition(unsigned channel, ushort *pos);
  105. int CALLING dsmSetPanning(unsigned channel, short panning);
  106. int CALLING dsmGetPanning(unsigned channel, short *panning);
  107. int CALLING dsmMuteChannel(unsigned channel, int mute);
  108. int CALLING dsmAddInstrument(void far *sample, int smpType, ushort length,
  109.                      ushort loopStart, ushort loopEnd, uchar volume,
  110.                      int loop, ushort *instHandle);
  111. int CALLING dsmRemInstrument(ushort inst);
  112. int CALLING dsmSetUpdRate(ushort updRate);
  113. int CALLING dsmPlay(int *callMP);
  114.  
  115.  
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119.  
  120.  
  121.  
  122. extern dmaBuffer    dsmBuffer;          /* mixing buffer */
  123. extern ushort       dsmDMAPos;
  124.  
  125.  
  126. /****************************************************************************\
  127. *       enum dsmFunctIDs
  128. *       ----------------
  129. * Description:  ID numbers for DSM functions
  130. \****************************************************************************/
  131.  
  132. enum dsmFunctIDs
  133. {
  134.     ID_dsmInit = ID_dsm,
  135.     ID_dsmClose,
  136.     ID_dsmOpenChannels,
  137.     ID_dsmCloseChannels,
  138.     ID_dsmGetMixRate,
  139.     ID_dsmGetMode,
  140.     ID_dsmClearChannels,
  141.     ID_dsmMute,
  142.     ID_dsmPause,
  143.     ID_dsmSetMasterVolume,
  144.     ID_dsmPlaySound,
  145.     ID_dsmStopSound,
  146.     ID_dsmSetRate,
  147.     ID_dsmGetRate,
  148.     ID_dsmSetVolume,
  149.     ID_dsmSetInstrument,
  150.     ID_dsmSetPosition,
  151.     ID_dsmGetPosition,
  152.     ID_dsmSetPanning,
  153.     ID_dsmGetPanning,
  154.     ID_dsmMuteChannel,
  155.     ID_dsmAddInstrument,
  156.     ID_dsmRemInstrument,
  157.     ID_dsmSetUpdRate,
  158.     ID_dsmPlay,
  159.     ID_dsmMixData
  160. };
  161.  
  162.  
  163.  
  164. #endif
  165.