FS#12756 by Marek Salaba - update Czech translation
[maemo-rb.git] / apps / plugins / mikmod / mikmod.h
bloba1c201f6d25b3246283137ddd032f5982deb81b0
1 /* MikMod sound library
2 (c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
3 for complete list.
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.
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.
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.
21 /*==============================================================================
23 $Id: mikmod.h.in,v 1.3 2005/03/30 19:09:21 realtech Exp $
25 MikMod sound library include file
27 ==============================================================================*/
29 #ifndef _MIKMOD_H_
30 #define _MIKMOD_H_
32 #include <stdio.h>
33 #include <stdlib.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 #include "mikmod_supp.h"
42 * ========== Compiler magic for shared libraries
45 #if defined WIN32 && defined _DLL
46 #ifdef DLL_EXPORTS
47 #define MIKMODAPI __declspec(dllexport)
48 #else
49 #define MIKMODAPI __declspec(dllimport)
50 #endif
51 #else
52 #define MIKMODAPI
53 #endif
56 * ========== Library version
59 #define LIBMIKMOD_VERSION_MAJOR 3L
60 #define LIBMIKMOD_VERSION_MINOR 2L
61 #define LIBMIKMOD_REVISION 0L
63 #define LIBMIKMOD_VERSION \
64 ((LIBMIKMOD_VERSION_MAJOR<<16)| \
65 (LIBMIKMOD_VERSION_MINOR<< 8)| \
66 (LIBMIKMOD_REVISION))
68 MIKMODAPI extern long MikMod_GetVersion(void);
71 * ========== Platform independent-type definitions
73 #if 0
74 #ifdef WIN32
75 #define WIN32_LEAN_AND_MEAN
76 #include <windows.h>
77 #include <io.h>
78 #include <mmsystem.h>
79 #endif
81 #if defined(__OS2__)||defined(__EMX__)
82 #define INCL_DOSSEMAPHORES
83 #include <os2.h>
84 #else
85 typedef char CHAR;
86 #endif
87 #endif
89 typedef char CHAR;
92 #if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(__powerpc64__)
93 /* 64 bit architectures */
95 typedef signed char SBYTE; /* 1 byte, signed */
96 typedef unsigned char UBYTE; /* 1 byte, unsigned */
97 typedef signed short SWORD; /* 2 bytes, signed */
98 typedef unsigned short UWORD; /* 2 bytes, unsigned */
99 typedef signed int SLONG; /* 4 bytes, signed */
100 typedef unsigned int ULONG; /* 4 bytes, unsigned */
101 //typedef int BOOL; /* 0=false, <>0 true */
103 #else
104 /* 32 bit architectures */
106 typedef signed char SBYTE; /* 1 byte, signed */
107 typedef unsigned char UBYTE; /* 1 byte, unsigned */
108 typedef signed short SWORD; /* 2 bytes, signed */
109 typedef unsigned short UWORD; /* 2 bytes, unsigned */
110 typedef signed long SLONG; /* 4 bytes, signed */
111 #if !defined(__OS2__)&&!defined(__EMX__)&&!defined(WIN32)
112 typedef unsigned long ULONG; /* 4 bytes, unsigned */
113 //typedef int BOOL; /* 0=false, <>0 true */
114 #endif
115 #endif
118 * ========== Error codes
121 enum {
122 MMERR_OPENING_FILE = 1,
123 MMERR_OUT_OF_MEMORY,
124 MMERR_DYNAMIC_LINKING,
126 MMERR_SAMPLE_TOO_BIG,
127 MMERR_OUT_OF_HANDLES,
128 MMERR_UNKNOWN_WAVE_TYPE,
130 MMERR_LOADING_PATTERN,
131 MMERR_LOADING_TRACK,
132 MMERR_LOADING_HEADER,
133 MMERR_LOADING_SAMPLEINFO,
134 MMERR_NOT_A_MODULE,
135 MMERR_NOT_A_STREAM,
136 MMERR_MED_SYNTHSAMPLES,
137 MMERR_ITPACK_INVALID_DATA,
139 MMERR_DETECTING_DEVICE,
140 MMERR_INVALID_DEVICE,
141 MMERR_INITIALIZING_MIXER,
142 MMERR_OPENING_AUDIO,
143 MMERR_8BIT_ONLY,
144 MMERR_16BIT_ONLY,
145 MMERR_STEREO_ONLY,
146 MMERR_ULAW,
147 MMERR_NON_BLOCK,
149 MMERR_AF_AUDIO_PORT,
151 MMERR_AIX_CONFIG_INIT,
152 MMERR_AIX_CONFIG_CONTROL,
153 MMERR_AIX_CONFIG_START,
155 MMERR_GUS_SETTINGS,
156 MMERR_GUS_RESET,
157 MMERR_GUS_TIMER,
159 MMERR_HP_SETSAMPLESIZE,
160 MMERR_HP_SETSPEED,
161 MMERR_HP_CHANNELS,
162 MMERR_HP_AUDIO_OUTPUT,
163 MMERR_HP_AUDIO_DESC,
164 MMERR_HP_BUFFERSIZE,
166 MMERR_OSS_SETFRAGMENT,
167 MMERR_OSS_SETSAMPLESIZE,
168 MMERR_OSS_SETSTEREO,
169 MMERR_OSS_SETSPEED,
171 MMERR_SGI_SPEED,
172 MMERR_SGI_16BIT,
173 MMERR_SGI_8BIT,
174 MMERR_SGI_STEREO,
175 MMERR_SGI_MONO,
177 MMERR_SUN_INIT,
179 MMERR_OS2_MIXSETUP,
180 MMERR_OS2_SEMAPHORE,
181 MMERR_OS2_TIMER,
182 MMERR_OS2_THREAD,
184 MMERR_DS_PRIORITY,
185 MMERR_DS_BUFFER,
186 MMERR_DS_FORMAT,
187 MMERR_DS_NOTIFY,
188 MMERR_DS_EVENT,
189 MMERR_DS_THREAD,
190 MMERR_DS_UPDATE,
192 MMERR_WINMM_HANDLE,
193 MMERR_WINMM_ALLOCATED,
194 MMERR_WINMM_DEVICEID,
195 MMERR_WINMM_FORMAT,
196 MMERR_WINMM_UNKNOWN,
198 MMERR_MAC_SPEED,
199 MMERR_MAC_START,
201 MMERR_OSX_UNKNOWN_DEVICE,
202 MMERR_OSX_BAD_PROPERTY,
203 MMERR_OSX_UNSUPPORTED_FORMAT,
204 MMERR_OSX_SET_STEREO,
205 MMERR_OSX_BUFFER_ALLOC,
206 MMERR_OSX_ADD_IO_PROC,
207 MMERR_OSX_DEVICE_START,
208 MMERR_OSX_PTHREAD,
210 MMERR_DOSWSS_STARTDMA,
211 MMERR_DOSSB_STARTDMA,
213 MMERR_MAX
217 * ========== Error handling
220 typedef void (MikMod_handler)(void);
221 typedef MikMod_handler *MikMod_handler_t;
223 MIKMODAPI extern int MikMod_errno;
224 MIKMODAPI extern int MikMod_critical;
225 MIKMODAPI extern char *MikMod_strerror(int);
227 MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
230 * ========== Library initialization and core functions
233 struct MDRIVER;
235 MIKMODAPI extern void MikMod_RegisterAllDrivers(void);
237 MIKMODAPI extern CHAR* MikMod_InfoDriver(void);
238 MIKMODAPI extern void MikMod_RegisterDriver(struct MDRIVER*);
239 MIKMODAPI extern int MikMod_DriverFromAlias(CHAR*);
240 MIKMODAPI extern struct MDRIVER *MikMod_DriverByOrdinal(int);
242 MIKMODAPI extern int MikMod_Init(CHAR*);
243 MIKMODAPI extern void MikMod_Exit(void);
244 MIKMODAPI extern int MikMod_Reset(CHAR*);
245 MIKMODAPI extern int MikMod_SetNumVoices(int,int);
246 MIKMODAPI extern int MikMod_Active(void);
247 MIKMODAPI extern int MikMod_EnableOutput(void);
248 MIKMODAPI extern void MikMod_DisableOutput(void);
249 MIKMODAPI extern void MikMod_Update(void);
251 MIKMODAPI extern int MikMod_InitThreads(void);
252 MIKMODAPI extern void MikMod_Lock(void);
253 MIKMODAPI extern void MikMod_Unlock(void);
255 MIKMODAPI extern void* MikMod_malloc(size_t);
256 MIKMODAPI extern void* MikMod_realloc(void *, size_t);
257 MIKMODAPI extern void* MikMod_calloc(size_t,size_t);
258 MIKMODAPI extern void MikMod_free(void*);
261 * ========== Reader, Writer
264 typedef struct MREADER {
265 int (*Seek)(struct MREADER*,long,int);
266 long (*Tell)(struct MREADER*);
267 int (*Read)(struct MREADER*,void*,size_t);
268 int (*Get)(struct MREADER*);
269 int (*Eof)(struct MREADER*);
270 long iobase;
271 long prev_iobase;
272 } MREADER;
274 typedef struct MWRITER {
275 int (*Seek)(struct MWRITER*,long,int);
276 long (*Tell)(struct MWRITER*);
277 int (*Write)(struct MWRITER*,void*,size_t);
278 int (*Put)(struct MWRITER*,int);
279 } MWRITER;
282 * ========== Samples
285 /* Sample playback should not be interrupted */
286 #define SFX_CRITICAL 1
288 /* Sample format [loading and in-memory] flags: */
289 #define SF_16BITS 0x0001
290 #define SF_STEREO 0x0002
291 #define SF_SIGNED 0x0004
292 #define SF_BIG_ENDIAN 0x0008
293 #define SF_DELTA 0x0010
294 #define SF_ITPACKED 0x0020
296 #define SF_FORMATMASK 0x003F
298 /* General Playback flags */
300 #define SF_LOOP 0x0100
301 #define SF_BIDI 0x0200
302 #define SF_REVERSE 0x0400
303 #define SF_SUSTAIN 0x0800
305 #define SF_PLAYBACKMASK 0x0C00
307 /* Module-only Playback Flags */
309 #define SF_OWNPAN 0x1000
310 #define SF_UST_LOOP 0x2000
312 #define SF_EXTRAPLAYBACKMASK 0x3000
314 /* Panning constants */
315 #define PAN_LEFT 0
316 #define PAN_HALFLEFT 64
317 #define PAN_CENTER 128
318 #define PAN_HALFRIGHT 192
319 #define PAN_RIGHT 255
320 #define PAN_SURROUND 512 /* panning value for Dolby Surround */
322 typedef struct SAMPLE {
323 SWORD panning; /* panning (0-255 or PAN_SURROUND) */
324 ULONG speed; /* Base playing speed/frequency of note */
325 UBYTE volume; /* volume 0-64 */
326 UWORD inflags; /* sample format on disk */
327 UWORD flags; /* sample format in memory */
328 ULONG length; /* length of sample (in samples!) */
329 ULONG loopstart; /* repeat position (relative to start, in samples) */
330 ULONG loopend; /* repeat end */
331 ULONG susbegin; /* sustain loop begin (in samples) \ Not Supported */
332 ULONG susend; /* sustain loop end / Yet! */
334 /* Variables used by the module player only! (ignored for sound effects) */
335 UBYTE globvol; /* global volume */
336 UBYTE vibflags; /* autovibrato flag stuffs */
337 UBYTE vibtype; /* Vibratos moved from INSTRUMENT to SAMPLE */
338 UBYTE vibsweep;
339 UBYTE vibdepth;
340 UBYTE vibrate;
341 CHAR* samplename; /* name of the sample */
343 /* Values used internally only */
344 UWORD avibpos; /* autovibrato pos [player use] */
345 UBYTE divfactor; /* for sample scaling, maintains proper period slides */
346 ULONG seekpos; /* seek position in file */
347 SWORD handle; /* sample handle used by individual drivers */
348 void (*onfree)(void *ctx); /* called from Sample_Free if not NULL */
349 void *ctx; /* context passed to previous function*/
350 } SAMPLE;
352 /* Sample functions */
354 MIKMODAPI extern SAMPLE *Sample_LoadRaw(CHAR *,ULONG rate, ULONG channel, ULONG flags);
355 MIKMODAPI extern SAMPLE *Sample_LoadRawFP(int fp,ULONG rate,ULONG channel, ULONG flags);
356 MIKMODAPI extern SAMPLE *Sample_LoadRawMem(const char *buf, int len, ULONG rate, ULONG channel, ULONG flags);
357 MIKMODAPI extern SAMPLE *Sample_LoadRawGeneric(MREADER*reader,ULONG rate, ULONG channel, ULONG flags);
359 MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
360 MIKMODAPI extern SAMPLE *Sample_LoadFP(int);
361 MIKMODAPI extern SAMPLE *Sample_LoadMem(const char *buf, int len);
362 MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
363 MIKMODAPI extern void Sample_Free(SAMPLE*);
364 MIKMODAPI extern SBYTE Sample_Play(SAMPLE*,ULONG,UBYTE);
366 MIKMODAPI extern void Voice_SetVolume(SBYTE,UWORD);
367 MIKMODAPI extern UWORD Voice_GetVolume(SBYTE);
368 MIKMODAPI extern void Voice_SetFrequency(SBYTE,ULONG);
369 MIKMODAPI extern ULONG Voice_GetFrequency(SBYTE);
370 MIKMODAPI extern void Voice_SetPanning(SBYTE,ULONG);
371 MIKMODAPI extern ULONG Voice_GetPanning(SBYTE);
372 MIKMODAPI extern void Voice_Play(SBYTE,SAMPLE*,ULONG);
373 MIKMODAPI extern void Voice_Stop(SBYTE);
374 MIKMODAPI extern int Voice_Stopped(SBYTE);
375 MIKMODAPI extern SLONG Voice_GetPosition(SBYTE);
376 MIKMODAPI extern ULONG Voice_RealVolume(SBYTE);
379 * ========== Internal module representation (UniMod)
383 Instrument definition - for information only, the only field which may be
384 of use in user programs is the name field
387 /* Instrument note count */
388 #define INSTNOTES 120
390 /* Envelope point */
391 typedef struct ENVPT {
392 SWORD pos;
393 SWORD val;
394 } ENVPT;
396 /* Envelope point count */
397 #define ENVPOINTS 32
399 /* Instrument structure */
400 typedef struct INSTRUMENT {
401 CHAR* insname;
403 UBYTE flags;
404 UWORD samplenumber[INSTNOTES];
405 UBYTE samplenote[INSTNOTES];
407 UBYTE nnatype;
408 UBYTE dca; /* duplicate check action */
409 UBYTE dct; /* duplicate check type */
410 UBYTE globvol;
411 UWORD volfade;
412 SWORD panning; /* instrument-based panning var */
414 UBYTE pitpansep; /* pitch pan separation (0 to 255) */
415 UBYTE pitpancenter; /* pitch pan center (0 to 119) */
416 UBYTE rvolvar; /* random volume varations (0 - 100%) */
417 UBYTE rpanvar; /* random panning varations (0 - 100%) */
419 /* volume envelope */
420 UBYTE volflg; /* bit 0: on 1: sustain 2: loop */
421 UBYTE volpts;
422 UBYTE volsusbeg;
423 UBYTE volsusend;
424 UBYTE volbeg;
425 UBYTE volend;
426 ENVPT volenv[ENVPOINTS];
427 /* panning envelope */
428 UBYTE panflg; /* bit 0: on 1: sustain 2: loop */
429 UBYTE panpts;
430 UBYTE pansusbeg;
431 UBYTE pansusend;
432 UBYTE panbeg;
433 UBYTE panend;
434 ENVPT panenv[ENVPOINTS];
435 /* pitch envelope */
436 UBYTE pitflg; /* bit 0: on 1: sustain 2: loop */
437 UBYTE pitpts;
438 UBYTE pitsusbeg;
439 UBYTE pitsusend;
440 UBYTE pitbeg;
441 UBYTE pitend;
442 ENVPT pitenv[ENVPOINTS];
443 } INSTRUMENT;
445 struct MP_CONTROL;
446 struct MP_VOICE;
449 Module definition
452 /* maximum master channels supported */
453 #define UF_MAXCHAN 64
455 /* Module flags */
456 #define UF_XMPERIODS 0x0001 /* XM periods / finetuning */
457 #define UF_LINEAR 0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
458 #define UF_INST 0x0004 /* Instruments are used */
459 #define UF_NNA 0x0008 /* IT: NNA used, set numvoices rather
460 than numchn */
461 #define UF_S3MSLIDES 0x0010 /* uses old S3M volume slides */
462 #define UF_BGSLIDES 0x0020 /* continue volume slides in the background */
463 #define UF_HIGHBPM 0x0040 /* MED: can use >255 bpm */
464 #define UF_NOWRAP 0x0080 /* XM-type (i.e. illogical) pattern break
465 semantics */
466 #define UF_ARPMEM 0x0100 /* IT: need arpeggio memory */
467 #define UF_FT2QUIRKS 0x0200 /* emulate some FT2 replay quirks */
468 #define UF_PANNING 0x0400 /* module uses panning effects or have
469 non-tracker default initial panning */
471 typedef struct MODULE {
472 /* general module information */
473 CHAR* songname; /* name of the song */
474 CHAR* modtype; /* string type of module loaded */
475 CHAR* comment; /* module comments */
477 UWORD flags; /* See module flags above */
478 UBYTE numchn; /* number of module channels */
479 UBYTE numvoices; /* max # voices used for full NNA playback */
480 UWORD numpos; /* number of positions in this song */
481 UWORD numpat; /* number of patterns in this song */
482 UWORD numins; /* number of instruments */
483 UWORD numsmp; /* number of samples */
484 struct INSTRUMENT* instruments; /* all instruments */
485 struct SAMPLE* samples; /* all samples */
486 UBYTE realchn; /* real number of channels used */
487 UBYTE totalchn; /* total number of channels used (incl NNAs) */
489 /* playback settings */
490 UWORD reppos; /* restart position */
491 UBYTE initspeed; /* initial song speed */
492 UWORD inittempo; /* initial song tempo */
493 UBYTE initvolume; /* initial global volume (0 - 128) */
494 UWORD panning[UF_MAXCHAN]; /* panning positions */
495 UBYTE chanvol[UF_MAXCHAN]; /* channel positions */
496 UWORD bpm; /* current beats-per-minute speed */
497 UWORD sngspd; /* current song speed */
498 SWORD volume; /* song volume (0-128) (or user volume) */
500 int extspd; /* extended speed flag (default enabled) */
501 int panflag; /* panning flag (default enabled) */
502 int wrap; /* wrap module ? (default disabled) */
503 int loop; /* allow module to loop ? (default enabled) */
504 int fadeout; /* volume fade out during last pattern */
506 UWORD patpos; /* current row number */
507 SWORD sngpos; /* current song position */
508 ULONG sngtime; /* current song time in 2^-10 seconds */
510 SWORD relspd; /* relative speed factor */
512 /* internal module representation */
513 UWORD numtrk; /* number of tracks */
514 UBYTE** tracks; /* array of numtrk pointers to tracks */
515 UWORD* patterns; /* array of Patterns */
516 UWORD* pattrows; /* array of number of rows for each pattern */
517 UWORD* positions; /* all positions */
519 int forbid; /* if true, no player update! */
520 UWORD numrow; /* number of rows on current pattern */
521 UWORD vbtick; /* tick counter (counts from 0 to sngspd) */
522 UWORD sngremainder;/* used for song time computation */
524 struct MP_CONTROL* control; /* Effects Channel info (size pf->numchn) */
525 struct MP_VOICE* voice; /* Audio Voice information (size md_numchn) */
527 UBYTE globalslide; /* global volume slide rate */
528 UBYTE pat_repcrazy;/* module has just looped to position -1 */
529 UWORD patbrk; /* position where to start a new pattern */
530 UBYTE patdly; /* patterndelay counter (command memory) */
531 UBYTE patdly2; /* patterndelay counter (real one) */
532 SWORD posjmp; /* flag to indicate a jump is needed... */
533 UWORD bpmlimit; /* threshold to detect bpm or speed values */
534 } MODULE;
537 /* This structure is used to query current playing voices status */
538 typedef struct VOICEINFO {
539 INSTRUMENT* i; /* Current channel instrument */
540 SAMPLE* s; /* Current channel sample */
541 SWORD panning; /* panning position */
542 SBYTE volume; /* channel's "global" volume (0..64) */
543 UWORD period; /* period to play the sample at */
544 UBYTE kick; /* if true = sample has been restarted */
545 } VOICEINFO;
548 * ========== Module loaders
551 struct MLOADER;
553 MIKMODAPI extern CHAR* MikMod_InfoLoader(void);
554 MIKMODAPI extern void MikMod_RegisterAllLoaders(void);
555 MIKMODAPI extern void MikMod_RegisterLoader(struct MLOADER*);
557 MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
558 MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
559 MIKMODAPI extern struct MLOADER load_asy; /* ASYLUM Music Format 1.0 */
560 MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
561 MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
562 MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
563 MIKMODAPI extern struct MLOADER load_gt2; /* Graoumf tracker */
564 MIKMODAPI extern struct MLOADER load_it; /* Impulse Tracker (by Jeffrey Lim) */
565 MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
566 MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
567 MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
568 MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
569 MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
570 MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
571 MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
572 MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
573 MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
574 MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
575 MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
576 MIKMODAPI extern struct MLOADER load_xm; /* FastTracker 2 (by Triton) */
579 * ========== Module player
582 MIKMODAPI extern MODULE* Player_Load(CHAR*,int,int);
583 MIKMODAPI extern MODULE* Player_LoadFP(int,int,int);
584 MIKMODAPI extern MODULE* Player_LoadMem(const char *buffer,int len,int maxchan,int curious);
585 MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,int);
586 MIKMODAPI extern CHAR* Player_LoadTitle(CHAR*);
587 MIKMODAPI extern CHAR* Player_LoadTitleFP(int);
588 MIKMODAPI extern CHAR* Player_LoadTitleMem(const char *buffer,int len);
589 MIKMODAPI extern CHAR* Player_LoadTitleGeneric(MREADER*);
591 MIKMODAPI extern void Player_Free(MODULE*);
592 MIKMODAPI extern void Player_Start(MODULE*);
593 MIKMODAPI extern int Player_Active(void);
594 MIKMODAPI extern void Player_Stop(void);
595 MIKMODAPI extern void Player_TogglePause(void);
596 MIKMODAPI extern int Player_Paused(void);
597 MIKMODAPI extern void Player_NextPosition(void);
598 MIKMODAPI extern void Player_PrevPosition(void);
599 MIKMODAPI extern void Player_SetPosition(UWORD);
600 MIKMODAPI extern int Player_Muted(UBYTE);
601 MIKMODAPI extern void Player_SetVolume(SWORD);
602 MIKMODAPI extern MODULE* Player_GetModule(void);
603 MIKMODAPI extern void Player_SetSpeed(UWORD);
604 MIKMODAPI extern void Player_SetTempo(UWORD);
605 MIKMODAPI extern void Player_Unmute(SLONG,...);
606 MIKMODAPI extern void Player_Mute(SLONG,...);
607 MIKMODAPI extern void Player_ToggleMute(SLONG,...);
608 MIKMODAPI extern int Player_GetChannelVoice(UBYTE);
609 MIKMODAPI extern UWORD Player_GetChannelPeriod(UBYTE);
610 MIKMODAPI extern int Player_QueryVoices(UWORD numvoices, VOICEINFO *vinfo);
611 MIKMODAPI extern int Player_GetRow(void);
612 MIKMODAPI extern int Player_GetOrder(void);
614 typedef void (*MikMod_player_t)(void);
615 typedef void (*MikMod_callback_t)(unsigned char *data, size_t len);
617 MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
619 #define MUTE_EXCLUSIVE 32000
620 #define MUTE_INCLUSIVE 32001
623 * ========== Drivers
626 enum {
627 MD_MUSIC = 0,
628 MD_SNDFX
631 enum {
632 MD_HARDWARE = 0,
633 MD_SOFTWARE
636 /* Mixing flags */
638 /* These ones take effect only after MikMod_Init or MikMod_Reset */
639 #define DMODE_16BITS 0x0001 /* enable 16 bit output */
640 #define DMODE_STEREO 0x0002 /* enable stereo output */
641 #define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
642 #define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
643 #define DMODE_HQMIXER 0x0010 /* Use high-quality (slower) software mixer */
644 #define DMODE_FLOAT 0x0020 /* enable float output */
645 /* These take effect immediately. */
646 #define DMODE_SURROUND 0x0100 /* enable surround sound */
647 #define DMODE_INTERP 0x0200 /* enable interpolation */
648 #define DMODE_REVERSE 0x0400 /* reverse stereo */
649 #define DMODE_SIMDMIXER 0x0800 /* enable SIMD mixing */
650 #define DMODE_NOISEREDUCTION 0x1000 /* Low pass filtering */
652 struct SAMPLOAD;
653 typedef struct MDRIVER {
654 struct MDRIVER* next;
655 CHAR* Name;
656 CHAR* Version;
658 UBYTE HardVoiceLimit; /* Limit of hardware mixer voices */
659 UBYTE SoftVoiceLimit; /* Limit of software mixer voices */
661 CHAR *Alias;
662 CHAR *CmdLineHelp;
664 void (*CommandLine) (CHAR*);
665 int (*IsPresent) (void);
666 SWORD (*SampleLoad) (struct SAMPLOAD*,int);
667 void (*SampleUnload) (SWORD);
668 ULONG (*FreeSampleSpace) (int);
669 ULONG (*RealSampleLength) (int,struct SAMPLE*);
670 int (*Init) (void);
671 void (*Exit) (void);
672 int (*Reset) (void);
673 int (*SetNumVoices) (void);
674 int (*PlayStart) (void);
675 void (*PlayStop) (void);
676 void (*Update) (void);
677 void (*Pause) (void);
678 void (*VoiceSetVolume) (UBYTE,UWORD);
679 UWORD (*VoiceGetVolume) (UBYTE);
680 void (*VoiceSetFrequency)(UBYTE,ULONG);
681 ULONG (*VoiceGetFrequency)(UBYTE);
682 void (*VoiceSetPanning) (UBYTE,ULONG);
683 ULONG (*VoiceGetPanning) (UBYTE);
684 void (*VoicePlay) (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
685 void (*VoiceStop) (UBYTE);
686 int (*VoiceStopped) (UBYTE);
687 SLONG (*VoiceGetPosition) (UBYTE);
688 ULONG (*VoiceRealVolume) (UBYTE);
689 } MDRIVER;
691 /* These variables can be changed at ANY time and results will be immediate */
692 MIKMODAPI extern UBYTE md_volume; /* global sound volume (0-128) */
693 MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
694 MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
695 MIKMODAPI extern UBYTE md_reverb; /* 0 = none; 15 = chaos */
696 MIKMODAPI extern UBYTE md_pansep; /* 0 = mono; 128 == 100% (full left/right) */
698 /* The variables below can be changed at any time, but changes will not be
699 implemented until MikMod_Reset is called. A call to MikMod_Reset may result
700 in a skip or pop in audio (depending on the soundcard driver and the settings
701 changed). */
702 MIKMODAPI extern UWORD md_device; /* device */
703 MIKMODAPI extern UWORD md_mixfreq; /* mixing frequency */
704 MIKMODAPI extern UWORD md_mode; /* mode. See DMODE_? flags above */
706 /* The following variable should not be changed! */
707 MIKMODAPI extern MDRIVER* md_driver; /* Current driver in use. */
709 /* Known drivers list */
711 MIKMODAPI extern struct MDRIVER drv_nos; /* no sound */
712 #if 0
713 MIKMODAPI extern struct MDRIVER drv_pipe; /* piped output */
714 MIKMODAPI extern struct MDRIVER drv_raw; /* raw file disk writer [music.raw] */
715 MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
716 MIKMODAPI extern struct MDRIVER drv_wav; /* RIFF WAVE file disk writer [music.wav] */
717 MIKMODAPI extern struct MDRIVER drv_aiff; /* AIFF file disk writer [music.aiff] */
719 MIKMODAPI extern struct MDRIVER drv_ultra; /* Linux Ultrasound driver */
720 MIKMODAPI extern struct MDRIVER drv_sam9407; /* Linux sam9407 driver */
722 MIKMODAPI extern struct MDRIVER drv_AF; /* Dec Alpha AudioFile */
723 MIKMODAPI extern struct MDRIVER drv_aix; /* AIX audio device */
724 MIKMODAPI extern struct MDRIVER drv_alsa; /* Advanced Linux Sound Architecture (ALSA) */
725 MIKMODAPI extern struct MDRIVER drv_esd; /* Enlightened sound daemon (EsounD) */
726 MIKMODAPI extern struct MDRIVER drv_hp; /* HP-UX audio device */
727 MIKMODAPI extern struct MDRIVER drv_nas; /* Network Audio System (NAS) */
728 MIKMODAPI extern struct MDRIVER drv_oss; /* OpenSound System (Linux,FreeBSD...) */
729 MIKMODAPI extern struct MDRIVER drv_sgi; /* SGI audio library */
730 MIKMODAPI extern struct MDRIVER drv_sun; /* Sun/NetBSD/OpenBSD audio device */
732 MIKMODAPI extern struct MDRIVER drv_dart; /* OS/2 Direct Audio RealTime */
733 MIKMODAPI extern struct MDRIVER drv_os2; /* OS/2 MMPM/2 */
735 MIKMODAPI extern struct MDRIVER drv_ds; /* Win32 DirectSound driver */
736 MIKMODAPI extern struct MDRIVER drv_win; /* Win32 multimedia API driver */
738 MIKMODAPI extern struct MDRIVER drv_mac; /* Macintosh Sound Manager driver */
739 MIKMODAPI extern struct MDRIVER drv_osx; /* MacOS X CoreAudio Driver */
741 MIKMODAPI extern struct MDRIVER drv_gp32; /* GP32 Sound driver */
743 MIKMODAPI extern struct MDRIVER drv_wss; /* DOS WSS driver */
744 MIKMODAPI extern struct MDRIVER drv_sb; /* DOS SB driver */
745 #endif
746 /*========== Virtual channel mixer interface (for user-supplied drivers only) */
748 MIKMODAPI extern int VC_Init(void);
749 MIKMODAPI extern void VC_Exit(void);
750 MIKMODAPI extern void VC_SetCallback(MikMod_callback_t callback);
751 MIKMODAPI extern int VC_SetNumVoices(void);
752 MIKMODAPI extern ULONG VC_SampleSpace(int);
753 MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
755 MIKMODAPI extern int VC_PlayStart(void);
756 MIKMODAPI extern void VC_PlayStop(void);
758 MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
759 MIKMODAPI extern void VC_SampleUnload(SWORD);
761 MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
762 MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
764 MIKMODAPI extern void VC_VoiceSetVolume(UBYTE,UWORD);
765 MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
766 MIKMODAPI extern void VC_VoiceSetFrequency(UBYTE,ULONG);
767 MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
768 MIKMODAPI extern void VC_VoiceSetPanning(UBYTE,ULONG);
769 MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
770 MIKMODAPI extern void VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
772 MIKMODAPI extern void VC_VoiceStop(UBYTE);
773 MIKMODAPI extern int VC_VoiceStopped(UBYTE);
774 MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
775 MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
777 #ifdef __cplusplus
779 #endif
781 #endif
783 /* ex:set ts=4: */