home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / linux / mikmod-3.000 / mikmod-3 / mikmod-3.1.2 / include / mikmod_internals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-07  |  18.0 KB  |  580 lines

  1. /*    MikMod sound library
  2.     (c) 1998 Miodrag Vallat and others - see file AUTHORS for complete list
  3.  
  4.     This library is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU Library General Public License as
  6.     published by the Free Software Foundation; either version 2 of
  7.     the License, or (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public
  15.     License along with this library; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. /*==============================================================================
  20.  
  21.   $Id: mikmod_internals.h,v 1.10 1998/12/07 06:00:31 miod Exp $
  22.  
  23.   MikMod sound library internal definitions
  24.  
  25. ==============================================================================*/
  26.  
  27. #ifndef _MIKMOD_INTERNALS_H
  28. #define _MIKMOD_INTERNALS_H
  29.  
  30. #include <mikmod.h>
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. /*========== More type definitions */
  37.  
  38. #if defined(__alpha)
  39.  
  40. typedef long        SLONGLONG;    /* 8 bytes, signed */
  41. #define HAS_64BIT_INT
  42.  
  43. #else
  44.  
  45. #if !defined(AIX)
  46. #ifdef __WATCOMC__
  47. typedef __int64        SLONGLONG;  /* 8 bytes, signed */
  48. #else
  49. typedef long long    SLONGLONG;  /* 8 bytes, signed */
  50. #endif
  51. #define HAS_64BIT_INT
  52. #endif
  53.  
  54. #endif
  55.  
  56. /*========== Error handling */
  57.  
  58. #define _mm_errno MikMod_errno
  59. #define _mm_critical MikMod_critical
  60. extern MikMod_handler_t _mm_errorhandler;
  61.  
  62. /*========== Memory allocation */
  63.  
  64. extern void* _mm_malloc(size_t);
  65. extern void* _mm_calloc(size_t,size_t);
  66.  
  67. /*========== Portable file I/O */
  68.  
  69. extern BOOL _mm_FileExists(CHAR *fname);
  70.  
  71. #define _mm_write_SBYTE(x,y) fputc((int)x,y)
  72. #define _mm_write_UBYTE(x,y) fputc((int)x,y)
  73.  
  74. #define _mm_read_SBYTE(x) (SBYTE)fgetc(x)
  75. #define _mm_read_UBYTE(x) (UBYTE)fgetc(x)
  76.  
  77. #define _mm_write_SBYTES(x,y,z) fwrite((void *)x,1,y,z)
  78. #define _mm_write_UBYTES(x,y,z) fwrite((void *)x,1,y,z)
  79. #define _mm_read_SBYTES(x,y,z)  fread((void *)x,1,y,z)
  80. #define _mm_read_UBYTES(x,y,z)  fread((void *)x,1,y,z)
  81.  
  82. #define _mm_rewind(x) _mm_fseek(x,0,SEEK_SET)
  83.  
  84. extern int  _mm_fseek(FILE*,long,int);
  85. extern void _mm_iobase_setcur(FILE*);
  86. extern void _mm_iobase_revert(void);
  87. extern long _mm_ftell(FILE*);
  88. extern FILE *_mm_fopen(CHAR*,CHAR*);
  89. extern void _mm_write_string(CHAR*,FILE*);
  90. extern int  _mm_read_string (CHAR*,int,FILE*);
  91.  
  92. extern SWORD _mm_read_M_SWORD(FILE*);
  93. extern SWORD _mm_read_I_SWORD(FILE*);
  94. extern UWORD _mm_read_M_UWORD(FILE*);
  95. extern UWORD _mm_read_I_UWORD(FILE*);
  96.  
  97. extern SLONG _mm_read_M_SLONG(FILE*);
  98. extern SLONG _mm_read_I_SLONG(FILE*);
  99. extern ULONG _mm_read_M_ULONG(FILE*);
  100. extern ULONG _mm_read_I_ULONG(FILE*);
  101.  
  102. extern int _mm_read_M_SWORDS(SWORD*,int,FILE*);
  103. extern int _mm_read_I_SWORDS(SWORD*,int,FILE*);
  104. extern int _mm_read_M_UWORDS(UWORD*,int,FILE*);
  105. extern int _mm_read_I_UWORDS(UWORD*,int,FILE*);
  106.  
  107. extern int _mm_read_M_SLONGS(SLONG*,int,FILE*);
  108. extern int _mm_read_I_SLONGS(SLONG*,int,FILE*);
  109. extern int _mm_read_M_ULONGS(ULONG*,int,FILE*);
  110. extern int _mm_read_I_ULONGS(ULONG*,int,FILE*);
  111.  
  112. extern void _mm_write_M_SWORD(SWORD,FILE*);
  113. extern void _mm_write_I_SWORD(SWORD,FILE*);
  114. extern void _mm_write_M_UWORD(UWORD,FILE*);
  115. extern void _mm_write_I_UWORD(UWORD,FILE*);
  116.  
  117. extern void _mm_write_M_SLONG(SLONG,FILE*);
  118. extern void _mm_write_I_SLONG(SLONG,FILE*);
  119. extern void _mm_write_M_ULONG(ULONG,FILE*);
  120. extern void _mm_write_I_ULONG(ULONG,FILE*);
  121.  
  122. extern void _mm_write_M_SWORDS(SWORD*,int,FILE*);
  123. extern void _mm_write_I_SWORDS(SWORD*,int,FILE*);
  124. extern void _mm_write_M_UWORDS(UWORD*,int,FILE*);
  125. extern void _mm_write_I_UWORDS(UWORD*,int,FILE*);
  126.  
  127. extern void _mm_write_M_SLONGS(SLONG*,int,FILE*);
  128. extern void _mm_write_I_SLONGS(SLONG*,int,FILE*);
  129. extern void _mm_write_M_ULONGS(ULONG*,int,FILE*);
  130. extern void _mm_write_I_ULONGS(ULONG*,int,FILE*);
  131.  
  132. /*========== Samples */
  133.  
  134. /* This is a handle of sorts attached to any sample registered with
  135.    SL_RegisterSample.  Generally, this only need be used or changed by the
  136.    loaders and drivers of mikmod. */
  137. typedef struct SAMPLOAD {
  138.     struct SAMPLOAD *next;
  139.  
  140.     ULONG   length;        /* length of sample (in samples!) */
  141.     ULONG   loopstart;     /* repeat position (relative to start, in samples) */
  142.     ULONG   loopend;       /* repeat end */
  143.     UWORD   infmt,outfmt;
  144.     int     scalefactor;
  145.     SAMPLE* sample;
  146.     FILE*   fp;
  147. } SAMPLOAD;
  148.  
  149. /*========== Sample and waves loading interface */
  150.  
  151. extern void      SL_HalveSample(SAMPLOAD*,int);
  152. extern void      SL_Sample8to16(SAMPLOAD*);
  153. extern void      SL_Sample16to8(SAMPLOAD*);
  154. extern void      SL_SampleSigned(SAMPLOAD*);
  155. extern void      SL_SampleUnsigned(SAMPLOAD*);
  156. extern BOOL      SL_LoadSamples(void);
  157. extern SAMPLOAD* SL_RegisterSample(SAMPLE*,int,FILE*);
  158. extern BOOL      SL_Load(void*,SAMPLOAD*,int);
  159. extern BOOL      SL_Init(SAMPLOAD*);
  160. extern void      SL_Exit(SAMPLOAD*);
  161.  
  162. /*========== Internal module representation (UniMod) interface */
  163.  
  164. /* number of notes in an octave */
  165. #define OCTAVE 12
  166.  
  167. /* The UniTrack stuff is generally for internal use only, but would be required
  168.    in making a tracker or a module player that scrolls pattern data. */
  169.  
  170. extern void   UniSetRow(UBYTE*);
  171. extern UBYTE  UniGetByte(void);
  172. extern UBYTE* UniFindRow(UBYTE*,UWORD);
  173. extern void   UniSkipOpcode(UBYTE);
  174. extern void   UniReset(void);
  175. extern void   UniWrite(UBYTE);
  176. extern void   UniNewline(void);
  177. extern UBYTE* UniDup(void);
  178. extern BOOL   UniInit(void);
  179. extern void   UniCleanup(void);
  180. extern void   UniInstrument(UBYTE);
  181. extern void   UniNote(UBYTE);
  182. extern void   UniPTEffect(UBYTE,UBYTE);
  183. extern void   UniVolEffect(UWORD,UBYTE);
  184.  
  185. /*========== Module Commands */
  186.  
  187. enum {
  188.     /* Simple note */
  189.     UNI_NOTE = 1,
  190.     /* Instrument change */
  191.     UNI_INSTRUMENT,
  192.     /* Protracker effects */
  193.     UNI_PTEFFECT0,
  194.     UNI_PTEFFECT1,
  195.     UNI_PTEFFECT2,
  196.     UNI_PTEFFECT3,
  197.     UNI_PTEFFECT4,
  198.     UNI_PTEFFECT5,
  199.     UNI_PTEFFECT6,
  200.     UNI_PTEFFECT7,
  201.     UNI_PTEFFECT8,
  202.     UNI_PTEFFECT9,
  203.     UNI_PTEFFECTA,
  204.     UNI_PTEFFECTB,
  205.     UNI_PTEFFECTC,
  206.     UNI_PTEFFECTD,
  207.     UNI_PTEFFECTE,
  208.     UNI_PTEFFECTF,
  209.     /* Scream Tracker effects */
  210.     UNI_S3MEFFECTA,
  211.     UNI_S3MEFFECTD,
  212.     UNI_S3MEFFECTE,
  213.     UNI_S3MEFFECTF,
  214.     UNI_S3MEFFECTI,
  215.     UNI_S3MEFFECTQ,
  216.     UNI_S3MEFFECTR,
  217.     UNI_S3MEFFECTT,
  218.     UNI_S3MEFFECTU, 
  219.     UNI_KEYOFF,
  220.     UNI_KEYFADE,
  221.     UNI_VOLEFFECTS,
  222.     /* Fast Tracker effects */
  223.     UNI_XMEFFECT4,
  224.     UNI_XMEFFECTA,
  225.     UNI_XMEFFECTE1,
  226.     UNI_XMEFFECTE2,
  227.     UNI_XMEFFECTEA,
  228.     UNI_XMEFFECTEB,
  229.     UNI_XMEFFECTG,
  230.     UNI_XMEFFECTH,
  231.     UNI_XMEFFECTL,
  232.     UNI_XMEFFECTP,
  233.     UNI_XMEFFECTX1,
  234.     UNI_XMEFFECTX2,
  235.     /* Impulse Tracker effects */
  236.     UNI_ITEFFECTG,     /* Porta to Note .. no kick=0; */
  237.     UNI_ITEFFECTH,     /* IT specific Vibrato */
  238.     UNI_ITEFFECTI,     /* IT tremor (xy not incremented) */
  239.     UNI_ITEFFECTM,     /* Set Channel Volume */
  240.     UNI_ITEFFECTN,     /* Slide / Fineslide Channel Volume */
  241.     UNI_ITEFFECTP,     /* Slide / Fineslide Channel Panning */
  242.     UNI_ITEFFECTU,     /* IT fine vibrato */
  243.     UNI_ITEFFECTW,     /* Slide / Fineslide Global volume */
  244.     UNI_ITEFFECTY,     /* The Satanic Panbrello */
  245.     UNI_ITEFFECTZ,     /* Resonant filters */
  246.     UNI_ITEFFECTS0,
  247.     /* UltraTracker effects */
  248.     UNI_ULTEFFECT9,    /* Sample fine offset */
  249.  
  250.     UNI_LAST
  251. };
  252.  
  253. /* IT / S3M Extended SS effects: */
  254. enum {
  255.     SS_GLISSANDO = 1,
  256.     SS_FINETUNE,
  257.     SS_VIBWAVE,
  258.     SS_TREMWAVE,
  259.     SS_PANWAVE,
  260.     SS_FRAMEDELAY,
  261.     SS_S7EFFECTS,
  262.     SS_PANNING,
  263.     SS_SURROUND,
  264.     SS_HIOFFSET,
  265.     SS_PATLOOP,
  266.     SS_NOTECUT,
  267.     SS_NOTEDELAY,
  268.     SS_PATDELAY
  269. };
  270.  
  271. /* IT Volume column effects */
  272. enum {
  273.     VOL_VOLUME = 1,
  274.     VOL_PANNING,
  275.     VOL_VOLSLIDE,
  276.     VOL_PITCHSLIDEDN,
  277.     VOL_PITCHSLIDEUP,
  278.     VOL_PORTAMENTO,
  279.     VOL_VIBRATO
  280. };
  281.  
  282. /* IT resonant filter information */
  283.  
  284. #define FILT_CUT      0x80
  285. #define FILT_RESONANT 0x81
  286.  
  287. typedef struct FILTER {
  288.     UBYTE filter,inf;
  289. } FILTER;
  290.  
  291. /*========== Instruments */
  292.  
  293. /* Instrument format flags */
  294. #define IF_OWNPAN       1
  295. #define IF_PITCHPAN     2
  296.  
  297. /* Envelope flags: */
  298. #define EF_ON           1
  299. #define EF_SUSTAIN      2
  300. #define EF_LOOP         4
  301. #define EF_VOLENV       8
  302.  
  303. /* New Note Action Flags */
  304. #define NNA_CUT         0
  305. #define NNA_CONTINUE    1
  306. #define NNA_OFF         2
  307. #define NNA_FADE        3
  308.  
  309. #define DCT_OFF         0
  310. #define DCT_NOTE        1                         
  311. #define DCT_SAMPLE      2                         
  312. #define DCT_INST        3           
  313.  
  314. #define DCA_CUT         0
  315. #define DCA_OFF         1
  316. #define DCA_FADE        2
  317.  
  318. #define KEY_KICK        0
  319. #define KEY_OFF         1
  320. #define KEY_FADE        2
  321. #define KEY_KILL        (KEY_OFF|KEY_FADE)
  322.  
  323. #define AV_IT           1   /* IT vs. XM vibrato info */
  324.  
  325. /*========== Playing */
  326.  
  327. #define POS_NONE        (-2) /* no loop position defined */
  328.  
  329. typedef struct ENVPR {
  330.     UBYTE  flg;          /* envelope flag */
  331.     UBYTE  pts;          /* number of envelope points */
  332.     UBYTE  susbeg;       /* envelope sustain index begin */
  333.     UBYTE  susend;       /* envelope sustain index end */
  334.     UBYTE  beg;          /* envelope loop begin */
  335.     UBYTE  end;          /* envelope loop end */
  336.     SWORD  p;            /* current envelope counter */
  337.     UWORD  a;            /* envelope index a */
  338.     UWORD  b;            /* envelope index b */
  339.     ENVPT* env;          /* envelope points */
  340. } ENVPR;
  341.  
  342. typedef struct MP_CONTROL {
  343.     INSTRUMENT* i;
  344.     SAMPLE*     s;
  345.     UBYTE       sample;       /* which sample number */
  346.     UBYTE       note;         /* the audible note as heard, direct rep of period */
  347.     SWORD       outvolume;    /* output volume (vol + sampcol + instvol) */
  348.     SBYTE       chanvol;      /* channel's "global" volume */
  349.     UWORD       fadevol;      /* fading volume rate */
  350.     SWORD       panning;      /* panning position */
  351.     UBYTE       kick;         /* if true = sample has to be restarted */
  352.     UBYTE       muted;        /* if set, channel not played */
  353.     UWORD       period;       /* period to play the sample at */
  354.     UBYTE       nna;          /* New note action type + master/slave flags */
  355.  
  356.     UBYTE       volflg;       /* volume envelope settings */
  357.     UBYTE       panflg;       /* panning envelope settings */
  358.     UBYTE       pitflg;       /* pitch envelope settings */
  359.  
  360.     UBYTE       keyoff;       /* if true = fade out and stuff */
  361.     SWORD       handle;       /* which sample-handle */
  362.     UBYTE       notedelay;    /* (used for note delay) */
  363.     SLONG       start;        /* The starting byte index in the sample */
  364.     UWORD        ultoffset;    /* fine sample offset memory */
  365.  
  366. struct MP_VOICE*slave;        /* Audio Slave of current effects control channel */
  367.     UBYTE       slavechn;     /* Audio Slave of current effects control channel */
  368.     UBYTE       anote;        /* the note that indexes the audible */
  369.     UBYTE        oldnote;
  370.     SWORD       ownper;
  371.     SWORD       ownvol;
  372.     UBYTE       dca;          /* duplicate check action */
  373.     UBYTE       dct;          /* duplicate check type */
  374.     UBYTE*      row;          /* row currently playing on this channel */
  375.     SBYTE       retrig;       /* retrig value (0 means don't retrig) */
  376.     ULONG       speed;        /* what finetune to use */
  377.     SWORD       volume;       /* amiga volume (0 t/m 64) to play the sample at */
  378.  
  379.     SBYTE       tmpvolume;    /* tmp volume */
  380.     UWORD       tmpperiod;    /* tmp period */
  381.     UWORD       wantedperiod; /* period to slide to (with effect 3 or 5) */
  382.     UBYTE       pansspd;      /* panslide speed */
  383.     UWORD       slidespeed;   /* */
  384.     UWORD       portspeed;    /* noteslide speed (toneportamento) */
  385.  
  386.     UBYTE       s3mtremor;    /* s3m tremor (effect I) counter */
  387.     UBYTE       s3mtronof;    /* s3m tremor ontime/offtime */
  388.     UBYTE       s3mvolslide;  /* last used volslide */
  389.     UBYTE       s3mrtgspeed;  /* last used retrig speed */
  390.     UBYTE       s3mrtgslide;  /* last used retrig slide */
  391.  
  392.     UBYTE       glissando;    /* glissando (0 means off) */
  393.     UBYTE       wavecontrol;
  394.  
  395.     SBYTE       vibpos;       /* current vibrato position */
  396.     UBYTE       vibspd;       /* "" speed */
  397.     UBYTE       vibdepth;     /* "" depth */
  398.  
  399.     SBYTE       trmpos;       /* current tremolo position */
  400.     UBYTE       trmspd;       /* "" speed */
  401.     UBYTE       trmdepth;     /* "" depth */
  402.  
  403.     UBYTE       fslideupspd;
  404.     UBYTE       fslidednspd;
  405.     UBYTE       fportupspd;   /* fx E1 (extra fine portamento up) data */
  406.     UBYTE       fportdnspd;   /* fx E2 (extra fine portamento dn) data */
  407.     UBYTE       ffportupspd;  /* fx X1 (extra fine portamento up) data */
  408.     UBYTE       ffportdnspd;  /* fx X2 (extra fine portamento dn) data */
  409.  
  410.     ULONG       hioffset;     /* last used high order of sample offset */
  411.     UWORD       soffset;      /* last used low order of sample-offset (effect 9) */
  412.  
  413.     UBYTE       sseffect;     /* last used Sxx effect */
  414.     UBYTE       ssdata;       /* last used Sxx data info */
  415.     UBYTE       chanvolslide; /* last used channel volume slide */
  416.  
  417.     UBYTE       panbwave;     /* current panbrello waveform */
  418.     UBYTE       panbpos;      /* current panbrello position */
  419.     SBYTE       panbspd;      /* "" speed */
  420.     UBYTE       panbdepth;    /* "" depth */
  421.  
  422.     UWORD       newsamp;      /* set to 1 upon a sample / inst change */
  423.     UBYTE       voleffect;    /* Volume Column Effect Memory as used by IT */
  424.     UBYTE       voldata;      /* Volume Column Data Memory */
  425.  
  426.     SWORD       pat_reppos;   /* patternloop position */
  427.     UWORD       pat_repcnt;   /* times to loop */
  428. } MP_CONTROL;
  429.  
  430. /* Used by NNA only player (audio control.  AUDTMP is used for full effects
  431.    control). */
  432. typedef struct MP_VOICE {
  433.     INSTRUMENT* i;
  434.     SAMPLE*     s;
  435.     UBYTE       sample;       /* which instrument number */
  436.  
  437.     SWORD       volume;       /* output volume (vol + sampcol + instvol) */
  438.     SWORD       panning;      /* panning position */
  439.     SBYTE       chanvol;      /* channel's "global" volume */
  440.     UWORD       fadevol;      /* fading volume rate */
  441.     UWORD       period;       /* period to play the sample at */
  442.  
  443.     UBYTE       volflg;       /* volume envelope settings */
  444.     UBYTE       panflg;       /* panning envelope settings */
  445.     UBYTE       pitflg;       /* pitch envelope settings */
  446.  
  447.     UBYTE       keyoff;       /* if true = fade out and stuff */
  448.     UBYTE       kick;         /* if true = sample has to be restarted */
  449.     UBYTE       note;         /* the audible note (as heard, direct rep of period) */
  450.     UBYTE       nna;          /* New note action type + master/slave flags */
  451.     SWORD       handle;       /* which sample-handle */
  452.     SLONG       start;        /* The start byte index in the sample */
  453.  
  454. /* Below here is info NOT in MP_CONTROL!! */
  455.     ENVPR       venv;
  456.     ENVPR       penv;
  457.     ENVPR       cenv;
  458.  
  459.     UWORD       avibpos;      /* autovibrato pos */
  460.     UWORD       aswppos;      /* autovibrato sweep pos */
  461.  
  462.     ULONG       totalvol;     /* total volume of channel (before global mixings) */
  463.  
  464.     BOOL        mflag;
  465.     SWORD       masterchn;
  466.     UWORD       masterperiod;
  467.  
  468.     MP_CONTROL* master;       /* index of "master" effects channel */
  469. } MP_VOICE;
  470.  
  471. /*========== Loaders */
  472.  
  473. typedef struct MLOADER {
  474. struct MLOADER* next;
  475.     CHAR*       type;
  476.     CHAR*       version;
  477.     BOOL        (*Init)(void);
  478.     BOOL        (*Test)(void);
  479.     BOOL        (*Load)(BOOL);
  480.     void        (*Cleanup)(void);
  481.     CHAR*       (*LoadTitle)(void);
  482. } MLOADER;
  483.  
  484. /* internal loader variables: */
  485. extern FILE*  modfp;
  486. extern UWORD  finetune[16];
  487. extern MODULE of;                  /* static unimod loading space */
  488. extern UWORD  npertab[7*OCTAVE];   /* used by the original MOD loaders */
  489.  
  490. extern SBYTE  remap[64];           /* for removing empty channels */
  491. extern UBYTE* poslookup;           /* lookup table for pattern jumps after blank
  492.                                       pattern removal */
  493. extern UBYTE  poslookupcnt;
  494.  
  495. extern BOOL   filters;             /* resonant filters in use */
  496. extern UBYTE  activemacro;         /* active midi macro number for Sxx,xx<80h */
  497. extern UBYTE  filtermacros[16];    /* midi macros settings */
  498. extern FILTER filtersettings[256]; /* computed filter settings */
  499.  
  500. /*========== Internal loader interface */
  501.  
  502. extern BOOL   ReadComment(UWORD);
  503. extern BOOL   ReadLinedComment(UWORD,UWORD);
  504. extern BOOL   AllocPositions(int);
  505. extern BOOL   AllocPatterns(void);
  506. extern BOOL   AllocTracks(void);
  507. extern BOOL   AllocInstruments(void);
  508. extern BOOL   AllocSamples(void);
  509. extern CHAR*  DupStr(CHAR*,UWORD);
  510.  
  511. extern void   S3MIT_ProcessCmd(UBYTE,UBYTE,BOOL);
  512.  
  513. /* used to convert c4spd to linear XM periods (IT loader). */
  514. extern UWORD  getlinearperiod(UBYTE,ULONG);
  515. extern ULONG  getfrequency(UBYTE,ULONG);
  516.  
  517. /*========== Player interface */
  518.  
  519. extern BOOL   Player_Init(MODULE*);
  520. extern void   Player_Exit(MODULE*);
  521. extern void   Player_HandleTick(void);
  522.  
  523. /*========== Drivers */
  524.  
  525. /* max. number of handles a driver has to provide. (not strict) */
  526. #define MAXSAMPLEHANDLES 384
  527.  
  528. /* These variables can be changed at ANY time and results will be immediate */
  529. extern UBYTE md_bpm;         /* current song / hardware BPM rate */
  530.  
  531. /* Variables below can be changed via MD_SetNumVoices at any time. However, a
  532.    call to MD_SetNumVoicess while the driver is active will cause the sound to
  533.    skip slightly. */
  534. extern UBYTE md_numchn;      /* number of song + sound effects voices */
  535. extern UBYTE md_sngchn;      /* number of song voices */
  536. extern UBYTE md_sfxchn;      /* number of sound effects voices */
  537. extern UBYTE md_hardchn;     /* number of hardware mixed voices */
  538. extern UBYTE md_softchn;     /* number of software mixed voices */
  539.  
  540. /* This is for use by the hardware drivers only.  It points to the registered
  541.    tickhandler function. */
  542. extern void (*md_player)(void);
  543.  
  544. extern SWORD  MD_SampleLoad(SAMPLOAD*,int);
  545. extern void   MD_SampleUnload(SWORD);
  546. extern ULONG  MD_SampleSpace(int);
  547. extern ULONG  MD_SampleLength(int,SAMPLE*);
  548.  
  549. /*========== Virtual channel mixer interface */
  550.  
  551. extern BOOL  VC_Init(void);
  552. extern void  VC_Exit(void);
  553. extern BOOL  VC_SetNumVoices(void);
  554. extern ULONG VC_SampleSpace(int);
  555. extern ULONG VC_SampleLength(int,SAMPLE*);
  556.  
  557. extern BOOL  VC_PlayStart(void);
  558. extern void  VC_PlayStop(void);
  559.  
  560. extern SWORD VC_SampleLoad(SAMPLOAD*,int);
  561. extern void  VC_SampleUnload(SWORD);
  562.  
  563. extern ULONG VC_WriteBytes(SBYTE*,ULONG);
  564. extern void  VC_SilenceBytes(SBYTE*,ULONG);
  565.  
  566. extern void  VC_VoiceSetVolume(UBYTE,UWORD);
  567. extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
  568. extern void  VC_VoiceSetPanning(UBYTE,ULONG);
  569. extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
  570.  
  571. extern void  VC_VoiceStop(UBYTE);
  572. extern BOOL  VC_VoiceStopped(UBYTE);
  573. extern SLONG VC_VoiceGetPosition(UBYTE);
  574. extern ULONG VC_VoiceRealVolume(UBYTE);
  575.  
  576. #ifdef __cplusplus
  577. }
  578. #endif
  579. #endif
  580.