mikmod_build.h
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:25k
源码类别:

Windows CE

开发平台:

C/C++

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