VisualC/external/include/mikmod.h
changeset 639 f8901a7ff3f1
parent 638 0ff9b7b8ba7b
child 640 a6ea4f0348a3
equal deleted inserted replaced
638:0ff9b7b8ba7b 639:f8901a7ff3f1
     1 /*	MikMod sound library
       
     2 	(c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
       
     3 	for complete list.
       
     4 
       
     5 	This library is free software; you can redistribute it and/or modify
       
     6 	it under the terms of the GNU Library General Public License as
       
     7 	published by the Free Software Foundation; either version 2 of
       
     8 	the License, or (at your option) any later version.
       
     9  
       
    10 	This program is distributed in the hope that it will be useful,
       
    11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13 	GNU Library General Public License for more details.
       
    14  
       
    15 	You should have received a copy of the GNU Library General Public
       
    16 	License along with this library; if not, write to the Free Software
       
    17 	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
       
    18 	02111-1307, USA.
       
    19 */
       
    20 
       
    21 /*==============================================================================
       
    22 
       
    23   $Id: mikmod.h.in,v 1.2 2004/06/01 16:43:45 raph Exp $
       
    24 
       
    25   MikMod sound library include file
       
    26 
       
    27 ==============================================================================*/
       
    28 
       
    29 #ifndef _MIKMOD_H_
       
    30 #define _MIKMOD_H_
       
    31 
       
    32 #include <stdio.h>
       
    33 #include <stdlib.h>
       
    34 
       
    35 #ifdef __cplusplus
       
    36 extern "C" {
       
    37 #endif
       
    38 
       
    39 /*
       
    40  * ========== Compiler magic for shared libraries
       
    41  */
       
    42 
       
    43 #if defined WIN32 && defined _DLL
       
    44 #ifdef DLL_EXPORTS
       
    45 #define MIKMODAPI __declspec(dllexport)
       
    46 #else
       
    47 #define MIKMODAPI __declspec(dllimport)
       
    48 #endif
       
    49 #else
       
    50 #define MIKMODAPI
       
    51 #endif
       
    52 
       
    53 /*
       
    54  *	========== Library version
       
    55  */
       
    56 
       
    57 #define LIBMIKMOD_VERSION_MAJOR 3L
       
    58 #define LIBMIKMOD_VERSION_MINOR 1L
       
    59 #define LIBMIKMOD_REVISION      10L
       
    60 
       
    61 #define LIBMIKMOD_VERSION \
       
    62 	((LIBMIKMOD_VERSION_MAJOR<<16)| \
       
    63 	 (LIBMIKMOD_VERSION_MINOR<< 8)| \
       
    64 	 (LIBMIKMOD_REVISION))
       
    65 
       
    66 MIKMODAPI extern long MikMod_GetVersion(void);
       
    67 
       
    68 /*
       
    69  *	========== Platform independent-type definitions
       
    70  */
       
    71 
       
    72 #ifdef WIN32
       
    73 #define WIN32_LEAN_AND_MEAN
       
    74 #include <windows.h>
       
    75 #include <io.h>
       
    76 #include <mmsystem.h>
       
    77 
       
    78 /* Avoid conflicts with windef.h */
       
    79 #define SBYTE   _mm_SBYTE
       
    80 #define UBYTE   _mm_UBYTE
       
    81 #define SWORD   _mm_SWORD
       
    82 #define UWORD   _mm_UWORD
       
    83 #define SLONG   _mm_SLONG
       
    84 #define ULONG   _mm_ULONG
       
    85 #define BOOL    _mm_BOOL
       
    86 
       
    87 #endif /* WIN32 */
       
    88 
       
    89 #if defined(__OS2__)||defined(__EMX__)
       
    90 #define INCL_DOSSEMAPHORES
       
    91 #include <os2.h>
       
    92 #else
       
    93 typedef char CHAR;
       
    94 #endif
       
    95 
       
    96 
       
    97 
       
    98 #if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(_LP64)
       
    99 /* 64 bit architectures */
       
   100 
       
   101 typedef signed char     SBYTE;      /* 1 byte, signed */
       
   102 typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
       
   103 typedef signed short    SWORD;      /* 2 bytes, signed */
       
   104 typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
       
   105 typedef signed int      SLONG;      /* 4 bytes, signed */
       
   106 typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
       
   107 typedef int             BOOL;       /* 0=false, <>0 true */
       
   108 
       
   109 #else
       
   110 /* 32 bit architectures */
       
   111 
       
   112 typedef signed char     SBYTE;      /* 1 byte, signed */
       
   113 typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
       
   114 typedef signed short    SWORD;      /* 2 bytes, signed */
       
   115 typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
       
   116 typedef signed long     SLONG;      /* 4 bytes, signed */
       
   117 typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
       
   118 typedef int             BOOL;       /* 0=false, <>0 true */
       
   119 #endif
       
   120 
       
   121 /*
       
   122  *	========== Error codes
       
   123  */
       
   124 
       
   125 enum {
       
   126 	MMERR_OPENING_FILE = 1,
       
   127 	MMERR_OUT_OF_MEMORY,
       
   128 	MMERR_DYNAMIC_LINKING,
       
   129 
       
   130 	MMERR_SAMPLE_TOO_BIG,
       
   131 	MMERR_OUT_OF_HANDLES,
       
   132 	MMERR_UNKNOWN_WAVE_TYPE,
       
   133 
       
   134 	MMERR_LOADING_PATTERN,
       
   135 	MMERR_LOADING_TRACK,
       
   136 	MMERR_LOADING_HEADER,
       
   137 	MMERR_LOADING_SAMPLEINFO,
       
   138 	MMERR_NOT_A_MODULE,
       
   139 	MMERR_NOT_A_STREAM,
       
   140 	MMERR_MED_SYNTHSAMPLES,
       
   141 	MMERR_ITPACK_INVALID_DATA,
       
   142 
       
   143 	MMERR_DETECTING_DEVICE,
       
   144 	MMERR_INVALID_DEVICE,
       
   145 	MMERR_INITIALIZING_MIXER,
       
   146 	MMERR_OPENING_AUDIO,
       
   147 	MMERR_8BIT_ONLY,
       
   148 	MMERR_16BIT_ONLY,
       
   149 	MMERR_STEREO_ONLY,
       
   150 	MMERR_ULAW,
       
   151 	MMERR_NON_BLOCK,
       
   152 
       
   153 	MMERR_AF_AUDIO_PORT,
       
   154 
       
   155 	MMERR_AIX_CONFIG_INIT,
       
   156 	MMERR_AIX_CONFIG_CONTROL,
       
   157 	MMERR_AIX_CONFIG_START,
       
   158 
       
   159 	MMERR_GUS_SETTINGS,
       
   160 	MMERR_GUS_RESET,
       
   161 	MMERR_GUS_TIMER,
       
   162 
       
   163 	MMERR_HP_SETSAMPLESIZE,
       
   164 	MMERR_HP_SETSPEED,
       
   165 	MMERR_HP_CHANNELS,
       
   166 	MMERR_HP_AUDIO_OUTPUT,
       
   167 	MMERR_HP_AUDIO_DESC,
       
   168 	MMERR_HP_BUFFERSIZE,
       
   169 
       
   170 	MMERR_OSS_SETFRAGMENT,
       
   171 	MMERR_OSS_SETSAMPLESIZE,
       
   172 	MMERR_OSS_SETSTEREO,
       
   173 	MMERR_OSS_SETSPEED,
       
   174 
       
   175 	MMERR_SGI_SPEED,
       
   176 	MMERR_SGI_16BIT,
       
   177 	MMERR_SGI_8BIT,
       
   178 	MMERR_SGI_STEREO,
       
   179 	MMERR_SGI_MONO,
       
   180 
       
   181 	MMERR_SUN_INIT,
       
   182 
       
   183 	MMERR_OS2_MIXSETUP,
       
   184 	MMERR_OS2_SEMAPHORE,
       
   185 	MMERR_OS2_TIMER,
       
   186 	MMERR_OS2_THREAD,
       
   187 
       
   188 	MMERR_DS_PRIORITY,
       
   189 	MMERR_DS_BUFFER,
       
   190 	MMERR_DS_FORMAT,
       
   191 	MMERR_DS_NOTIFY,
       
   192 	MMERR_DS_EVENT,
       
   193 	MMERR_DS_THREAD,
       
   194 	MMERR_DS_UPDATE,
       
   195 
       
   196 	MMERR_WINMM_HANDLE,
       
   197 	MMERR_WINMM_ALLOCATED,
       
   198 	MMERR_WINMM_DEVICEID,
       
   199 	MMERR_WINMM_FORMAT,
       
   200 	MMERR_WINMM_UNKNOWN,
       
   201 
       
   202 	MMERR_MAC_SPEED,
       
   203 	MMERR_MAC_START,
       
   204 
       
   205 	MMERR_MAX
       
   206 };
       
   207 
       
   208 /*
       
   209  *	========== Error handling
       
   210  */
       
   211 
       
   212 typedef void (MikMod_handler)(void);
       
   213 typedef MikMod_handler *MikMod_handler_t;
       
   214 
       
   215 MIKMODAPI extern int  MikMod_errno;
       
   216 MIKMODAPI extern BOOL MikMod_critical;
       
   217 MIKMODAPI extern char *MikMod_strerror(int);
       
   218 
       
   219 MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
       
   220 
       
   221 /*
       
   222  *	========== Library initialization and core functions
       
   223  */
       
   224 
       
   225 struct MDRIVER;
       
   226 
       
   227 MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
       
   228 
       
   229 MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
       
   230 MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
       
   231 MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
       
   232 
       
   233 MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
       
   234 MIKMODAPI extern void   MikMod_Exit(void);
       
   235 MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
       
   236 MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
       
   237 MIKMODAPI extern BOOL   MikMod_Active(void);
       
   238 MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
       
   239 MIKMODAPI extern void   MikMod_DisableOutput(void);
       
   240 MIKMODAPI extern void   MikMod_Update(void);
       
   241 
       
   242 MIKMODAPI extern BOOL   MikMod_InitThreads(void);
       
   243 MIKMODAPI extern void   MikMod_Lock(void);
       
   244 MIKMODAPI extern void   MikMod_Unlock(void);
       
   245 
       
   246 /*
       
   247  *	========== Reader, Writer
       
   248  */
       
   249 
       
   250 typedef struct MREADER {
       
   251 	BOOL (*Seek)(struct MREADER*,long,int);
       
   252 	long (*Tell)(struct MREADER*);
       
   253 	BOOL (*Read)(struct MREADER*,void*,size_t);
       
   254 	int  (*Get)(struct MREADER*);
       
   255 	BOOL (*Eof)(struct MREADER*);
       
   256 } MREADER;
       
   257 
       
   258 typedef struct MWRITER {
       
   259 	BOOL (*Seek)(struct MWRITER*,long,int);
       
   260 	long (*Tell)(struct MWRITER*);
       
   261 	BOOL (*Write)(struct MWRITER*,void*,size_t);
       
   262 	BOOL (*Put)(struct MWRITER*,int);
       
   263 } MWRITER;
       
   264 
       
   265 /*
       
   266  *	========== Samples
       
   267  */
       
   268 
       
   269 /* Sample playback should not be interrupted */
       
   270 #define SFX_CRITICAL 1
       
   271 
       
   272 /* Sample format [loading and in-memory] flags: */
       
   273 #define SF_16BITS       0x0001
       
   274 #define SF_STEREO       0x0002
       
   275 #define SF_SIGNED       0x0004
       
   276 #define SF_BIG_ENDIAN   0x0008
       
   277 #define SF_DELTA        0x0010
       
   278 #define SF_ITPACKED		0x0020
       
   279 
       
   280 #define	SF_FORMATMASK	0x003F
       
   281 
       
   282 /* General Playback flags */
       
   283 
       
   284 #define SF_LOOP         0x0100
       
   285 #define SF_BIDI         0x0200
       
   286 #define SF_REVERSE      0x0400
       
   287 #define SF_SUSTAIN      0x0800
       
   288 
       
   289 #define SF_PLAYBACKMASK	0x0C00
       
   290 
       
   291 /* Module-only Playback Flags */
       
   292 
       
   293 #define SF_OWNPAN		0x1000
       
   294 #define SF_UST_LOOP     0x2000
       
   295 
       
   296 #define SF_EXTRAPLAYBACKMASK	0x3000
       
   297 
       
   298 /* Panning constants */
       
   299 #define PAN_LEFT		0
       
   300 #define PAN_HALFLEFT 	64
       
   301 #define PAN_CENTER		128
       
   302 #define PAN_HALFRIGHT	192
       
   303 #define PAN_RIGHT		255
       
   304 #define PAN_SURROUND	512 /* panning value for Dolby Surround */
       
   305 
       
   306 typedef struct SAMPLE {
       
   307 	SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
       
   308 	ULONG  speed;       /* Base playing speed/frequency of note */
       
   309 	UBYTE  volume;      /* volume 0-64 */
       
   310 	UWORD  inflags;		/* sample format on disk */
       
   311 	UWORD  flags;       /* sample format in memory */
       
   312 	ULONG  length;      /* length of sample (in samples!) */
       
   313 	ULONG  loopstart;   /* repeat position (relative to start, in samples) */
       
   314 	ULONG  loopend;     /* repeat end */
       
   315 	ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
       
   316 	ULONG  susend;      /* sustain loop end                /      Yet! */
       
   317 
       
   318 	/* Variables used by the module player only! (ignored for sound effects) */
       
   319 	UBYTE  globvol;     /* global volume */
       
   320 	UBYTE  vibflags;    /* autovibrato flag stuffs */
       
   321 	UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
       
   322 	UBYTE  vibsweep;
       
   323 	UBYTE  vibdepth;
       
   324 	UBYTE  vibrate;
       
   325 	CHAR*  samplename;  /* name of the sample */
       
   326 
       
   327 	/* Values used internally only */
       
   328 	UWORD  avibpos;     /* autovibrato pos [player use] */
       
   329 	UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
       
   330 	ULONG  seekpos;     /* seek position in file */
       
   331 	SWORD  handle;      /* sample handle used by individual drivers */
       
   332 } SAMPLE;
       
   333 
       
   334 /* Sample functions */
       
   335 
       
   336 MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
       
   337 MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
       
   338 MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
       
   339 MIKMODAPI extern void   Sample_Free(SAMPLE*);
       
   340 MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
       
   341 
       
   342 MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
       
   343 MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
       
   344 MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
       
   345 MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
       
   346 MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
       
   347 MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
       
   348 MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
       
   349 MIKMODAPI extern void   Voice_Stop(SBYTE);
       
   350 MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
       
   351 MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
       
   352 MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
       
   353 
       
   354 /*
       
   355  *	========== Internal module representation (UniMod)
       
   356  */
       
   357 
       
   358 /*
       
   359 	Instrument definition - for information only, the only field which may be
       
   360 	of use in user programs is the name field
       
   361 */
       
   362 
       
   363 /* Instrument note count */
       
   364 #define INSTNOTES 120
       
   365 
       
   366 /* Envelope point */
       
   367 typedef struct ENVPT {
       
   368 	SWORD pos;
       
   369 	SWORD val;
       
   370 } ENVPT;
       
   371 
       
   372 /* Envelope point count */
       
   373 #define ENVPOINTS 32
       
   374 
       
   375 /* Instrument structure */
       
   376 typedef struct INSTRUMENT {
       
   377 	CHAR* insname;
       
   378 
       
   379 	UBYTE flags;
       
   380 	UWORD samplenumber[INSTNOTES];
       
   381 	UBYTE samplenote[INSTNOTES];
       
   382 
       
   383 	UBYTE nnatype;
       
   384 	UBYTE dca;              /* duplicate check action */
       
   385 	UBYTE dct;              /* duplicate check type */
       
   386 	UBYTE globvol;
       
   387 	UWORD volfade;
       
   388 	SWORD panning;          /* instrument-based panning var */
       
   389 
       
   390 	UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
       
   391 	UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
       
   392 	UBYTE rvolvar;          /* random volume varations (0 - 100%) */
       
   393 	UBYTE rpanvar;          /* random panning varations (0 - 100%) */
       
   394 
       
   395 	/* volume envelope */
       
   396 	UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
       
   397 	UBYTE volpts;
       
   398 	UBYTE volsusbeg;
       
   399 	UBYTE volsusend;
       
   400 	UBYTE volbeg;
       
   401 	UBYTE volend;
       
   402 	ENVPT volenv[ENVPOINTS];
       
   403 	/* panning envelope */
       
   404 	UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
       
   405 	UBYTE panpts;
       
   406 	UBYTE pansusbeg;
       
   407 	UBYTE pansusend;
       
   408 	UBYTE panbeg;
       
   409 	UBYTE panend;
       
   410 	ENVPT panenv[ENVPOINTS];
       
   411 	/* pitch envelope */
       
   412 	UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
       
   413 	UBYTE pitpts;
       
   414 	UBYTE pitsusbeg;
       
   415 	UBYTE pitsusend;
       
   416 	UBYTE pitbeg;
       
   417 	UBYTE pitend;
       
   418 	ENVPT pitenv[ENVPOINTS];
       
   419 } INSTRUMENT;
       
   420 
       
   421 struct MP_CONTROL;
       
   422 struct MP_VOICE;
       
   423 
       
   424 /*
       
   425 	Module definition
       
   426 */
       
   427 
       
   428 /* maximum master channels supported */
       
   429 #define UF_MAXCHAN	64
       
   430 
       
   431 /* Module flags */
       
   432 #define UF_XMPERIODS	0x0001 /* XM periods / finetuning */
       
   433 #define UF_LINEAR		0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
       
   434 #define UF_INST			0x0004 /* Instruments are used */
       
   435 #define UF_NNA			0x0008 /* IT: NNA used, set numvoices rather
       
   436 								  than numchn */
       
   437 #define UF_S3MSLIDES	0x0010 /* uses old S3M volume slides */
       
   438 #define UF_BGSLIDES		0x0020 /* continue volume slides in the background */
       
   439 #define UF_HIGHBPM		0x0040 /* MED: can use >255 bpm */
       
   440 #define UF_NOWRAP		0x0080 /* XM-type (i.e. illogical) pattern break
       
   441 								  semantics */
       
   442 #define UF_ARPMEM		0x0100 /* IT: need arpeggio memory */
       
   443 #define UF_FT2QUIRKS	0x0200 /* emulate some FT2 replay quirks */
       
   444 #define UF_PANNING		0x0400 /* module uses panning effects or have
       
   445 								  non-tracker default initial panning */
       
   446 
       
   447 typedef struct MODULE {
       
   448 	/* general module information */
       
   449 		CHAR*       songname;    /* name of the song */
       
   450 		CHAR*       modtype;     /* string type of module loaded */
       
   451 		CHAR*       comment;     /* module comments */
       
   452 
       
   453 		UWORD       flags;       /* See module flags above */
       
   454 		UBYTE       numchn;      /* number of module channels */
       
   455 		UBYTE       numvoices;   /* max # voices used for full NNA playback */
       
   456 		UWORD       numpos;      /* number of positions in this song */
       
   457 		UWORD       numpat;      /* number of patterns in this song */
       
   458 		UWORD       numins;      /* number of instruments */
       
   459 		UWORD       numsmp;      /* number of samples */
       
   460 struct  INSTRUMENT* instruments; /* all instruments */
       
   461 struct  SAMPLE*     samples;     /* all samples */
       
   462 		UBYTE       realchn;     /* real number of channels used */
       
   463 		UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
       
   464 
       
   465 	/* playback settings */
       
   466 		UWORD       reppos;      /* restart position */
       
   467 		UBYTE       initspeed;   /* initial song speed */
       
   468 		UWORD       inittempo;   /* initial song tempo */
       
   469 		UBYTE       initvolume;  /* initial global volume (0 - 128) */
       
   470 		UWORD       panning[UF_MAXCHAN]; /* panning positions */
       
   471 		UBYTE       chanvol[UF_MAXCHAN]; /* channel positions */
       
   472 		UWORD       bpm;         /* current beats-per-minute speed */
       
   473 		UWORD       sngspd;      /* current song speed */
       
   474 		SWORD       volume;      /* song volume (0-128) (or user volume) */
       
   475 
       
   476 		BOOL        extspd;      /* extended speed flag (default enabled) */
       
   477 		BOOL        panflag;     /* panning flag (default enabled) */
       
   478 		BOOL        wrap;        /* wrap module ? (default disabled) */
       
   479 		BOOL        loop;		 /* allow module to loop ? (default enabled) */
       
   480 		BOOL        fadeout;	 /* volume fade out during last pattern */
       
   481 
       
   482 		UWORD       patpos;      /* current row number */
       
   483 		SWORD       sngpos;      /* current song position */
       
   484 		ULONG       sngtime;     /* current song time in 2^-10 seconds */
       
   485 
       
   486 		SWORD       relspd;      /* relative speed factor */
       
   487 
       
   488 	/* internal module representation */
       
   489 		UWORD       numtrk;      /* number of tracks */
       
   490 		UBYTE**     tracks;      /* array of numtrk pointers to tracks */
       
   491 		UWORD*      patterns;    /* array of Patterns */
       
   492 		UWORD*      pattrows;    /* array of number of rows for each pattern */
       
   493 		UWORD*      positions;   /* all positions */
       
   494 
       
   495 		BOOL        forbid;      /* if true, no player update! */
       
   496 		UWORD       numrow;      /* number of rows on current pattern */
       
   497 		UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
       
   498 		UWORD       sngremainder;/* used for song time computation */
       
   499 
       
   500 struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
       
   501 struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
       
   502 
       
   503 		UBYTE       globalslide; /* global volume slide rate */
       
   504 		UBYTE       pat_repcrazy;/* module has just looped to position -1 */
       
   505 		UWORD       patbrk;      /* position where to start a new pattern */
       
   506 		UBYTE       patdly;      /* patterndelay counter (command memory) */
       
   507 		UBYTE       patdly2;     /* patterndelay counter (real one) */
       
   508 		SWORD       posjmp;      /* flag to indicate a jump is needed... */
       
   509 		UWORD		bpmlimit;	 /* threshold to detect bpm or speed values */
       
   510 } MODULE;
       
   511 
       
   512 /*
       
   513  *	========== Module loaders
       
   514  */
       
   515 
       
   516 struct MLOADER;
       
   517 
       
   518 MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
       
   519 MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
       
   520 MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
       
   521 
       
   522 MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
       
   523 MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
       
   524 MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
       
   525 MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
       
   526 MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
       
   527 MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
       
   528 MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
       
   529 MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
       
   530 MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
       
   531 MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
       
   532 MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
       
   533 MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
       
   534 MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
       
   535 MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
       
   536 MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
       
   537 MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
       
   538 MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
       
   539 MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
       
   540 
       
   541 /*
       
   542  *	========== Module player
       
   543  */
       
   544 
       
   545 MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
       
   546 MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
       
   547 MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
       
   548 MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
       
   549 MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
       
   550 MIKMODAPI extern void    Player_Free(MODULE*);
       
   551 MIKMODAPI extern void    Player_Start(MODULE*);
       
   552 MIKMODAPI extern BOOL    Player_Active(void);
       
   553 MIKMODAPI extern void    Player_Stop(void);
       
   554 MIKMODAPI extern void    Player_TogglePause(void);
       
   555 MIKMODAPI extern BOOL    Player_Paused(void);
       
   556 MIKMODAPI extern void    Player_NextPosition(void);
       
   557 MIKMODAPI extern void    Player_PrevPosition(void);
       
   558 MIKMODAPI extern void    Player_SetPosition(UWORD);
       
   559 MIKMODAPI extern BOOL    Player_Muted(UBYTE);
       
   560 MIKMODAPI extern void    Player_SetVolume(SWORD);
       
   561 MIKMODAPI extern MODULE* Player_GetModule(void);
       
   562 MIKMODAPI extern void    Player_SetSpeed(UWORD);
       
   563 MIKMODAPI extern void    Player_SetTempo(UWORD);
       
   564 MIKMODAPI extern void    Player_Unmute(SLONG,...);
       
   565 MIKMODAPI extern void    Player_Mute(SLONG,...);
       
   566 MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
       
   567 MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
       
   568 MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
       
   569 
       
   570 typedef void (MikMod_player)(void);
       
   571 typedef MikMod_player *MikMod_player_t;
       
   572 
       
   573 MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
       
   574 
       
   575 #define MUTE_EXCLUSIVE  32000
       
   576 #define MUTE_INCLUSIVE  32001
       
   577 
       
   578 /*
       
   579  *	========== Drivers
       
   580  */
       
   581 
       
   582 enum {
       
   583 	MD_MUSIC = 0,
       
   584 	MD_SNDFX
       
   585 };
       
   586 
       
   587 enum {
       
   588 	MD_HARDWARE = 0,
       
   589 	MD_SOFTWARE
       
   590 };
       
   591 
       
   592 /* Mixing flags */
       
   593 
       
   594 /* These ones take effect only after MikMod_Init or MikMod_Reset */
       
   595 #define DMODE_16BITS     0x0001 /* enable 16 bit output */
       
   596 #define DMODE_STEREO     0x0002 /* enable stereo output */
       
   597 #define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
       
   598 #define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
       
   599 #define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
       
   600 /* These take effect immediately. */
       
   601 #define DMODE_SURROUND   0x0100 /* enable surround sound */
       
   602 #define DMODE_INTERP     0x0200 /* enable interpolation */
       
   603 #define DMODE_REVERSE    0x0400 /* reverse stereo */
       
   604 
       
   605 struct SAMPLOAD;
       
   606 typedef struct MDRIVER {
       
   607 struct MDRIVER* next;
       
   608 	CHAR*       Name;
       
   609 	CHAR*       Version;
       
   610 
       
   611 	UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
       
   612 	UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
       
   613 
       
   614 	CHAR*       Alias;
       
   615 
       
   616 	void        (*CommandLine)      (CHAR*);
       
   617 	BOOL        (*IsPresent)        (void);
       
   618 	SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
       
   619 	void        (*SampleUnload)     (SWORD);
       
   620 	ULONG       (*FreeSampleSpace)  (int);
       
   621 	ULONG       (*RealSampleLength) (int,struct SAMPLE*);
       
   622 	BOOL        (*Init)             (void);
       
   623 	void        (*Exit)             (void);
       
   624 	BOOL        (*Reset)            (void);
       
   625 	BOOL        (*SetNumVoices)     (void);
       
   626 	BOOL        (*PlayStart)        (void);
       
   627 	void        (*PlayStop)         (void);
       
   628 	void        (*Update)           (void);
       
   629 	void		(*Pause)			(void);
       
   630 	void        (*VoiceSetVolume)   (UBYTE,UWORD);
       
   631 	UWORD       (*VoiceGetVolume)   (UBYTE);
       
   632 	void        (*VoiceSetFrequency)(UBYTE,ULONG);
       
   633 	ULONG       (*VoiceGetFrequency)(UBYTE);
       
   634 	void        (*VoiceSetPanning)  (UBYTE,ULONG);
       
   635 	ULONG       (*VoiceGetPanning)  (UBYTE);
       
   636 	void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
       
   637 	void        (*VoiceStop)        (UBYTE);
       
   638 	BOOL        (*VoiceStopped)     (UBYTE);
       
   639 	SLONG       (*VoiceGetPosition) (UBYTE);
       
   640 	ULONG       (*VoiceRealVolume)  (UBYTE);
       
   641 } MDRIVER;
       
   642 
       
   643 /* These variables can be changed at ANY time and results will be immediate */
       
   644 MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
       
   645 MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
       
   646 MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
       
   647 MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
       
   648 MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
       
   649 
       
   650 /* The variables below can be changed at any time, but changes will not be
       
   651    implemented until MikMod_Reset is called. A call to MikMod_Reset may result
       
   652    in a skip or pop in audio (depending on the soundcard driver and the settings
       
   653    changed). */
       
   654 MIKMODAPI extern UWORD md_device;      /* device */
       
   655 MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
       
   656 MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
       
   657 
       
   658 /* The following variable should not be changed! */
       
   659 MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
       
   660 
       
   661 /* Known drivers list */
       
   662 
       
   663 MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
       
   664 MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
       
   665 MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
       
   666 MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
       
   667 MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
       
   668 
       
   669 MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
       
   670 MIKMODAPI extern struct MDRIVER drv_sam9407;	/* Linux sam9407 driver */
       
   671 
       
   672 MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
       
   673 MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
       
   674 MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
       
   675 MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
       
   676 MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
       
   677 MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
       
   678 MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
       
   679 MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
       
   680 
       
   681 MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
       
   682 MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
       
   683 
       
   684 MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
       
   685 MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
       
   686 
       
   687 MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
       
   688 
       
   689 /*========== Virtual channel mixer interface (for user-supplied drivers only) */
       
   690 
       
   691 MIKMODAPI extern BOOL  VC_Init(void);
       
   692 MIKMODAPI extern void  VC_Exit(void);
       
   693 MIKMODAPI extern BOOL  VC_SetNumVoices(void);
       
   694 MIKMODAPI extern ULONG VC_SampleSpace(int);
       
   695 MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
       
   696 
       
   697 MIKMODAPI extern BOOL  VC_PlayStart(void);
       
   698 MIKMODAPI extern void  VC_PlayStop(void);
       
   699 
       
   700 MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
       
   701 MIKMODAPI extern void  VC_SampleUnload(SWORD);
       
   702 
       
   703 MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
       
   704 MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
       
   705 
       
   706 MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
       
   707 MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
       
   708 MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
       
   709 MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
       
   710 MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
       
   711 MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
       
   712 MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
       
   713 
       
   714 MIKMODAPI extern void  VC_VoiceStop(UBYTE);
       
   715 MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
       
   716 MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
       
   717 MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
       
   718 
       
   719 #ifdef __cplusplus
       
   720 }
       
   721 #endif
       
   722 
       
   723 #endif
       
   724 
       
   725 /* ex:set ts=4: */