summaryrefslogtreecommitdiff
path: root/apps/plugins/mikmod/mikmod.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mikmod/mikmod.h')
-rw-r--r--apps/plugins/mikmod/mikmod.h895
1 files changed, 497 insertions, 398 deletions
diff --git a/apps/plugins/mikmod/mikmod.h b/apps/plugins/mikmod/mikmod.h
index a1c201f6d2..8256299451 100644
--- a/apps/plugins/mikmod/mikmod.h
+++ b/apps/plugins/mikmod/mikmod.h
@@ -1,30 +1,28 @@
1/* MikMod sound library 1/* MikMod sound library
2 (c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS 2 (c) 1998-2014 Miodrag Vallat and others - see the AUTHORS file
3 for complete list. 3 for complete list.
4 4
5 This library is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of 7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version. 8 the License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Library General Public License for more details. 13 GNU Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public 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 16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 02111-1307, USA. 18 02111-1307, USA.
19*/ 19*/
20 20
21/*============================================================================== 21/*==============================================================================
22 22
23 $Id: mikmod.h.in,v 1.3 2005/03/30 19:09:21 realtech Exp $
24
25 MikMod sound library include file 23 MikMod sound library include file
26 24
27==============================================================================*/ 25 ==============================================================================*/
28 26
29#ifndef _MIKMOD_H_ 27#ifndef _MIKMOD_H_
30#define _MIKMOD_H_ 28#define _MIKMOD_H_
@@ -40,163 +38,221 @@ extern "C" {
40 38
41/* 39/*
42 * ========== Compiler magic for shared libraries 40 * ========== Compiler magic for shared libraries
41 *
42 * ========== NOTE TO WINDOWS DEVELOPERS:
43 * If you are compiling for Windows and will link to the static library
44 * (libmikmod.a with MinGW, or mikmod_static.lib with MSVC or LCC, etc),
45 * you must define MIKMOD_STATIC in your project. Otherwise, dllimport
46 * will be assumed.
43 */ 47 */
44 48#if defined(_WIN32) || defined(__CYGWIN__)
45#if defined WIN32 && defined _DLL 49# if defined(MIKMOD_BUILD) && defined(DLL_EXPORT) /* building libmikmod as a dll for windows */
46#ifdef DLL_EXPORTS 50# define MIKMODAPI __declspec(dllexport)
47#define MIKMODAPI __declspec(dllexport) 51# elif defined(MIKMOD_BUILD) || defined(MIKMOD_STATIC) /* building or using static libmikmod for windows */
48#else 52# define MIKMODAPI
49#define MIKMODAPI __declspec(dllimport) 53# else
50#endif 54# define MIKMODAPI __declspec(dllimport) /* using libmikmod dll for windows */
55# endif
56#elif defined(__OS2__) && defined(__WATCOMC__)
57# if defined(MIKMOD_BUILD) && defined(__SW_BD) /* building libmikmod as a dll for os/2 */
58# define MIKMODAPI __declspec(dllexport)
59# else
60# define MIKMODAPI /* using dll or static libmikmod for os/2 */
61# endif
62/* SYM_VISIBILITY should be defined if both the compiler
63 * and the target support the visibility attributes. the
64 * configury does that automatically. for the standalone
65 * makefiles, etc, the developer should add the required
66 * flags, i.e.: -DSYM_VISIBILITY -fvisibility=hidden */
67#elif defined(MIKMOD_BUILD) && defined(SYM_VISIBILITY)
68# define MIKMODAPI __attribute__((visibility("default")))
51#else 69#else
52#define MIKMODAPI 70# define MIKMODAPI
53#endif 71#endif
54 72
55/* 73/*
56 * ========== Library version 74 * ========== Library version
57 */ 75 */
58 76
59#define LIBMIKMOD_VERSION_MAJOR 3L 77#define LIBMIKMOD_VERSION_MAJOR 3L
60#define LIBMIKMOD_VERSION_MINOR 2L 78#define LIBMIKMOD_VERSION_MINOR 3L
61#define LIBMIKMOD_REVISION 0L 79#define LIBMIKMOD_REVISION 11L
62 80
63#define LIBMIKMOD_VERSION \ 81#define LIBMIKMOD_VERSION \
64 ((LIBMIKMOD_VERSION_MAJOR<<16)| \ 82 ((LIBMIKMOD_VERSION_MAJOR<<16)| \
65 (LIBMIKMOD_VERSION_MINOR<< 8)| \ 83 (LIBMIKMOD_VERSION_MINOR<< 8)| \
66 (LIBMIKMOD_REVISION)) 84 (LIBMIKMOD_REVISION))
67 85
68MIKMODAPI extern long MikMod_GetVersion(void); 86MIKMODAPI extern long MikMod_GetVersion(void);
69 87
70/* 88/*
71 * ========== Platform independent-type definitions 89 * ========== Dependency platform headers
72 */ 90 */
73#if 0 91
74#ifdef WIN32 92#ifdef _WIN32
93#ifndef WIN32_LEAN_AND_MEAN
75#define WIN32_LEAN_AND_MEAN 94#define WIN32_LEAN_AND_MEAN
95#endif
76#include <windows.h> 96#include <windows.h>
77#include <io.h> 97#include <io.h>
78#include <mmsystem.h> 98#include <mmsystem.h>
99#define _MIKMOD_WIN32
100#endif
101
102#if defined(__DJGPP__) || defined(MSDOS) || defined(__MSDOS__) || defined(__DOS__)
103#define _MIKMOD_DOS
79#endif 104#endif
80 105
81#if defined(__OS2__)||defined(__EMX__) 106#if defined(__OS2__) || defined(__EMX__)
82#define INCL_DOSSEMAPHORES 107#define INCL_DOSSEMAPHORES
83#include <os2.h> 108#include <os2.h>
84#else 109#include <io.h>
85typedef char CHAR; 110#define _MIKMOD_OS2
111#endif
112
113#if defined(__MORPHOS__) || defined(__AROS__) || defined(_AMIGA) || defined(__AMIGA__) || defined(__amigaos__) || defined(AMIGAOS)
114#include <exec/types.h>
115#define _MIKMOD_AMIGA
86#endif 116#endif
117
118/*
119 * ========== Platform independent-type definitions
120 * (pain when it comes to cross-platform maintenance..)
121 */
122
123#if !(defined(_MIKMOD_OS2) || defined(_MIKMOD_WIN32))
124typedef char CHAR;
87#endif 125#endif
88 126
89typedef char CHAR; 127/* int: 0=false, <>0 true -- 16 bits on Amiga, int-wide on others. */
128#if !(defined(_MIKMOD_OS2) || defined(_MIKMOD_WIN32) || defined(_MIKMOD_AMIGA))
129//typedef int int;
130#endif
90 131
132/* 1 byte, signed and unsigned: */
133typedef signed char SBYTE;
134#ifndef _MIKMOD_AMIGA
135typedef unsigned char UBYTE;
136#endif
91 137
92#if defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(__powerpc64__) 138/* 2 bytes, signed and unsigned: */
93/* 64 bit architectures */ 139#if !(defined __LCC__ && defined _WIN32)
140typedef signed short int SWORD;
141#endif
142#if !((defined __LCC__ && defined _WIN32) || defined(_MIKMOD_AMIGA))
143typedef unsigned short int UWORD;
144#endif
94 145
95typedef signed char SBYTE; /* 1 byte, signed */ 146/* 4 bytes, signed and unsigned: */
96typedef unsigned char UBYTE; /* 1 byte, unsigned */ 147#if defined(_LP64) || defined(__LP64__) || defined(__arch64__) || defined(__alpha) || defined(__x86_64) || defined(__powerpc64__)
97typedef signed short SWORD; /* 2 bytes, signed */ 148 /* 64 bit architectures: */
98typedef unsigned short UWORD; /* 2 bytes, unsigned */ 149typedef signed int SLONG;
99typedef signed int SLONG; /* 4 bytes, signed */ 150#if !(defined(_WIN32) || defined(_MIKMOD_AMIGA))
100typedef unsigned int ULONG; /* 4 bytes, unsigned */ 151typedef unsigned int ULONG;
101//typedef int BOOL; /* 0=false, <>0 true */ 152#endif
102 153
103#else 154#else /* 32 bit architectures: */
104/* 32 bit architectures */ 155typedef signed long int SLONG;
105 156#if !(defined(_MIKMOD_OS2) || defined(_MIKMOD_WIN32) || defined(_MIKMOD_AMIGA))
106typedef signed char SBYTE; /* 1 byte, signed */ 157typedef unsigned long int ULONG;
107typedef unsigned char UBYTE; /* 1 byte, unsigned */
108typedef signed short SWORD; /* 2 bytes, signed */
109typedef unsigned short UWORD; /* 2 bytes, unsigned */
110typedef signed long SLONG; /* 4 bytes, signed */
111#if !defined(__OS2__)&&!defined(__EMX__)&&!defined(WIN32)
112typedef unsigned long ULONG; /* 4 bytes, unsigned */
113//typedef int BOOL; /* 0=false, <>0 true */
114#endif 158#endif
115#endif 159#endif
116 160
161/* make sure types are of correct sizes: */
162typedef int __mikmod_typetest [
163 (
164 (sizeof(SBYTE)==1) && (sizeof(UBYTE)==1)
165 && (sizeof(SWORD)==2) && (sizeof(UWORD)==2)
166 && (sizeof(SLONG)==4) && (sizeof(ULONG)==4)
167#ifndef _MIKMOD_AMIGA
168 && (sizeof(int) == sizeof(int))
169#endif
170 && (sizeof(CHAR) == sizeof(char))
171 ) * 2 - 1 ];
172
117/* 173/*
118 * ========== Error codes 174 * ========== Error codes
119 */ 175 */
120 176
121enum { 177enum {
122 MMERR_OPENING_FILE = 1, 178 MMERR_OPENING_FILE = 1,
123 MMERR_OUT_OF_MEMORY, 179 MMERR_OUT_OF_MEMORY,
124 MMERR_DYNAMIC_LINKING, 180 MMERR_DYNAMIC_LINKING,
125 181
126 MMERR_SAMPLE_TOO_BIG, 182 MMERR_SAMPLE_TOO_BIG,
127 MMERR_OUT_OF_HANDLES, 183 MMERR_OUT_OF_HANDLES,
128 MMERR_UNKNOWN_WAVE_TYPE, 184 MMERR_UNKNOWN_WAVE_TYPE,
129 185
130 MMERR_LOADING_PATTERN, 186 MMERR_LOADING_PATTERN,
131 MMERR_LOADING_TRACK, 187 MMERR_LOADING_TRACK,
132 MMERR_LOADING_HEADER, 188 MMERR_LOADING_HEADER,
133 MMERR_LOADING_SAMPLEINFO, 189 MMERR_LOADING_SAMPLEINFO,
134 MMERR_NOT_A_MODULE, 190 MMERR_NOT_A_MODULE,
135 MMERR_NOT_A_STREAM, 191 MMERR_NOT_A_STREAM,
136 MMERR_MED_SYNTHSAMPLES, 192 MMERR_MED_SYNTHSAMPLES,
137 MMERR_ITPACK_INVALID_DATA, 193 MMERR_ITPACK_INVALID_DATA,
138 194
139 MMERR_DETECTING_DEVICE, 195 MMERR_DETECTING_DEVICE,
140 MMERR_INVALID_DEVICE, 196 MMERR_INVALID_DEVICE,
141 MMERR_INITIALIZING_MIXER, 197 MMERR_INITIALIZING_MIXER,
142 MMERR_OPENING_AUDIO, 198 MMERR_OPENING_AUDIO,
143 MMERR_8BIT_ONLY, 199 MMERR_8BIT_ONLY,
144 MMERR_16BIT_ONLY, 200 MMERR_16BIT_ONLY,
145 MMERR_STEREO_ONLY, 201 MMERR_STEREO_ONLY,
146 MMERR_ULAW, 202 MMERR_ULAW,
147 MMERR_NON_BLOCK, 203 MMERR_NON_BLOCK,
148 204
149 MMERR_AF_AUDIO_PORT, 205 MMERR_AF_AUDIO_PORT,
150 206
151 MMERR_AIX_CONFIG_INIT, 207 MMERR_AIX_CONFIG_INIT,
152 MMERR_AIX_CONFIG_CONTROL, 208 MMERR_AIX_CONFIG_CONTROL,
153 MMERR_AIX_CONFIG_START, 209 MMERR_AIX_CONFIG_START,
154 210
155 MMERR_GUS_SETTINGS, 211 MMERR_GUS_SETTINGS,
156 MMERR_GUS_RESET, 212 MMERR_GUS_RESET,
157 MMERR_GUS_TIMER, 213 MMERR_GUS_TIMER,
158 214
159 MMERR_HP_SETSAMPLESIZE, 215 MMERR_HP_SETSAMPLESIZE,
160 MMERR_HP_SETSPEED, 216 MMERR_HP_SETSPEED,
161 MMERR_HP_CHANNELS, 217 MMERR_HP_CHANNELS,
162 MMERR_HP_AUDIO_OUTPUT, 218 MMERR_HP_AUDIO_OUTPUT,
163 MMERR_HP_AUDIO_DESC, 219 MMERR_HP_AUDIO_DESC,
164 MMERR_HP_BUFFERSIZE, 220 MMERR_HP_BUFFERSIZE,
165 221
166 MMERR_OSS_SETFRAGMENT, 222 MMERR_OSS_SETFRAGMENT,
167 MMERR_OSS_SETSAMPLESIZE, 223 MMERR_OSS_SETSAMPLESIZE,
168 MMERR_OSS_SETSTEREO, 224 MMERR_OSS_SETSTEREO,
169 MMERR_OSS_SETSPEED, 225 MMERR_OSS_SETSPEED,
170 226
171 MMERR_SGI_SPEED, 227 MMERR_SGI_SPEED,
172 MMERR_SGI_16BIT, 228 MMERR_SGI_16BIT,
173 MMERR_SGI_8BIT, 229 MMERR_SGI_8BIT,
174 MMERR_SGI_STEREO, 230 MMERR_SGI_STEREO,
175 MMERR_SGI_MONO, 231 MMERR_SGI_MONO,
176 232
177 MMERR_SUN_INIT, 233 MMERR_SUN_INIT,
178 234
179 MMERR_OS2_MIXSETUP, 235 MMERR_OS2_MIXSETUP,
180 MMERR_OS2_SEMAPHORE, 236 MMERR_OS2_SEMAPHORE,
181 MMERR_OS2_TIMER, 237 MMERR_OS2_TIMER,
182 MMERR_OS2_THREAD, 238 MMERR_OS2_THREAD,
183 239
184 MMERR_DS_PRIORITY, 240 MMERR_DS_PRIORITY,
185 MMERR_DS_BUFFER, 241 MMERR_DS_BUFFER,
186 MMERR_DS_FORMAT, 242 MMERR_DS_FORMAT,
187 MMERR_DS_NOTIFY, 243 MMERR_DS_NOTIFY,
188 MMERR_DS_EVENT, 244 MMERR_DS_EVENT,
189 MMERR_DS_THREAD, 245 MMERR_DS_THREAD,
190 MMERR_DS_UPDATE, 246 MMERR_DS_UPDATE,
191 247
192 MMERR_WINMM_HANDLE, 248 MMERR_WINMM_HANDLE,
193 MMERR_WINMM_ALLOCATED, 249 MMERR_WINMM_ALLOCATED,
194 MMERR_WINMM_DEVICEID, 250 MMERR_WINMM_DEVICEID,
195 MMERR_WINMM_FORMAT, 251 MMERR_WINMM_FORMAT,
196 MMERR_WINMM_UNKNOWN, 252 MMERR_WINMM_UNKNOWN,
197 253
198 MMERR_MAC_SPEED, 254 MMERR_MAC_SPEED,
199 MMERR_MAC_START, 255 MMERR_MAC_START,
200 256
201 MMERR_OSX_UNKNOWN_DEVICE, 257 MMERR_OSX_UNKNOWN_DEVICE,
202 MMERR_OSX_BAD_PROPERTY, 258 MMERR_OSX_BAD_PROPERTY,
@@ -205,16 +261,43 @@ enum {
205 MMERR_OSX_BUFFER_ALLOC, 261 MMERR_OSX_BUFFER_ALLOC,
206 MMERR_OSX_ADD_IO_PROC, 262 MMERR_OSX_ADD_IO_PROC,
207 MMERR_OSX_DEVICE_START, 263 MMERR_OSX_DEVICE_START,
208 MMERR_OSX_PTHREAD, 264 MMERR_OSX_PTHREAD,
209 265
210 MMERR_DOSWSS_STARTDMA, 266 MMERR_DOSWSS_STARTDMA,
211 MMERR_DOSSB_STARTDMA, 267 MMERR_DOSSB_STARTDMA,
212 268
213 MMERR_MAX 269 MMERR_NO_FLOAT32,/* should actually be after MMERR_ULAW or something */
270
271 MMERR_OPENAL_CREATECTX,
272 MMERR_OPENAL_CTXCURRENT,
273 MMERR_OPENAL_GENBUFFERS,
274 MMERR_OPENAL_GENSOURCES,
275 MMERR_OPENAL_SOURCE,
276 MMERR_OPENAL_QUEUEBUFFERS,
277 MMERR_OPENAL_UNQUEUEBUFFERS,
278 MMERR_OPENAL_BUFFERDATA,
279 MMERR_OPENAL_GETSOURCE,
280 MMERR_OPENAL_SOURCEPLAY,
281 MMERR_OPENAL_SOURCESTOP,
282
283 MMERR_ALSA_NOCONFIG,
284 MMERR_ALSA_SETPARAMS,
285 MMERR_ALSA_SETFORMAT,
286 MMERR_ALSA_SETRATE,
287 MMERR_ALSA_SETCHANNELS,
288 MMERR_ALSA_BUFFERSIZE,
289 MMERR_ALSA_PCM_START,
290 MMERR_ALSA_PCM_WRITE,
291 MMERR_ALSA_PCM_RECOVER,
292
293 MMERR_SNDIO_SETPARAMS,
294 MMERR_SNDIO_BADPARAMS,
295
296 MMERR_MAX
214}; 297};
215 298
216/* 299/*
217 * ========== Error handling 300 * ========== Error handling
218 */ 301 */
219 302
220typedef void (MikMod_handler)(void); 303typedef void (MikMod_handler)(void);
@@ -222,12 +305,12 @@ typedef MikMod_handler *MikMod_handler_t;
222 305
223MIKMODAPI extern int MikMod_errno; 306MIKMODAPI extern int MikMod_errno;
224MIKMODAPI extern int MikMod_critical; 307MIKMODAPI extern int MikMod_critical;
225MIKMODAPI extern char *MikMod_strerror(int); 308MIKMODAPI extern const char *MikMod_strerror(int);
226 309
227MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t); 310MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
228 311
229/* 312/*
230 * ========== Library initialization and core functions 313 * ========== Library initialization and core functions
231 */ 314 */
232 315
233struct MDRIVER; 316struct MDRIVER;
@@ -236,15 +319,15 @@ MIKMODAPI extern void MikMod_RegisterAllDrivers(void);
236 319
237MIKMODAPI extern CHAR* MikMod_InfoDriver(void); 320MIKMODAPI extern CHAR* MikMod_InfoDriver(void);
238MIKMODAPI extern void MikMod_RegisterDriver(struct MDRIVER*); 321MIKMODAPI extern void MikMod_RegisterDriver(struct MDRIVER*);
239MIKMODAPI extern int MikMod_DriverFromAlias(CHAR*); 322MIKMODAPI extern int MikMod_DriverFromAlias(const CHAR*);
240MIKMODAPI extern struct MDRIVER *MikMod_DriverByOrdinal(int); 323MIKMODAPI extern struct MDRIVER *MikMod_DriverByOrdinal(int);
241 324
242MIKMODAPI extern int MikMod_Init(CHAR*); 325MIKMODAPI extern int MikMod_Init(const CHAR*);
243MIKMODAPI extern void MikMod_Exit(void); 326MIKMODAPI extern void MikMod_Exit(void);
244MIKMODAPI extern int MikMod_Reset(CHAR*); 327MIKMODAPI extern int MikMod_Reset(const CHAR*);
245MIKMODAPI extern int MikMod_SetNumVoices(int,int); 328MIKMODAPI extern int MikMod_SetNumVoices(int,int);
246MIKMODAPI extern int MikMod_Active(void); 329MIKMODAPI extern int MikMod_Active(void);
247MIKMODAPI extern int MikMod_EnableOutput(void); 330MIKMODAPI extern int MikMod_EnableOutput(void);
248MIKMODAPI extern void MikMod_DisableOutput(void); 331MIKMODAPI extern void MikMod_DisableOutput(void);
249MIKMODAPI extern void MikMod_Update(void); 332MIKMODAPI extern void MikMod_Update(void);
250 333
@@ -253,33 +336,34 @@ MIKMODAPI extern void MikMod_Lock(void);
253MIKMODAPI extern void MikMod_Unlock(void); 336MIKMODAPI extern void MikMod_Unlock(void);
254 337
255MIKMODAPI extern void* MikMod_malloc(size_t); 338MIKMODAPI extern void* MikMod_malloc(size_t);
256MIKMODAPI extern void* MikMod_realloc(void *, size_t);
257MIKMODAPI extern void* MikMod_calloc(size_t,size_t); 339MIKMODAPI extern void* MikMod_calloc(size_t,size_t);
258MIKMODAPI extern void MikMod_free(void*); 340MIKMODAPI extern void* MikMod_realloc(void*,size_t);
341MIKMODAPI extern CHAR* MikMod_strdup(const CHAR*);
342MIKMODAPI extern void MikMod_free(void*); /* frees if ptr != NULL */
259 343
260/* 344/*
261 * ========== Reader, Writer 345 * ========== Reader, Writer
262 */ 346 */
263 347
264typedef struct MREADER { 348typedef struct MREADER {
265 int (*Seek)(struct MREADER*,long,int); 349 int (*Seek)(struct MREADER*,long,int);
266 long (*Tell)(struct MREADER*); 350 long (*Tell)(struct MREADER*);
267 int (*Read)(struct MREADER*,void*,size_t); 351 int (*Read)(struct MREADER*,void*,size_t);
268 int (*Get)(struct MREADER*); 352 int (*Get)(struct MREADER*);
269 int (*Eof)(struct MREADER*); 353 int (*Eof)(struct MREADER*);
270 long iobase; 354 long iobase;
271 long prev_iobase; 355 long prev_iobase;
272} MREADER; 356} MREADER;
273 357
274typedef struct MWRITER { 358typedef struct MWRITER {
275 int (*Seek)(struct MWRITER*,long,int); 359 int (*Seek)(struct MWRITER*, long, int);
276 long (*Tell)(struct MWRITER*); 360 long (*Tell)(struct MWRITER*);
277 int (*Write)(struct MWRITER*,void*,size_t); 361 int (*Write)(struct MWRITER*, const void*, size_t);
278 int (*Put)(struct MWRITER*,int); 362 int (*Put)(struct MWRITER*, int);
279} MWRITER; 363} MWRITER;
280 364
281/* 365/*
282 * ========== Samples 366 * ========== Samples
283 */ 367 */
284 368
285/* Sample playback should not be interrupted */ 369/* Sample playback should not be interrupted */
@@ -291,9 +375,9 @@ typedef struct MWRITER {
291#define SF_SIGNED 0x0004 375#define SF_SIGNED 0x0004
292#define SF_BIG_ENDIAN 0x0008 376#define SF_BIG_ENDIAN 0x0008
293#define SF_DELTA 0x0010 377#define SF_DELTA 0x0010
294#define SF_ITPACKED 0x0020 378#define SF_ITPACKED 0x0020
295 379
296#define SF_FORMATMASK 0x003F 380#define SF_FORMATMASK 0x003F
297 381
298/* General Playback flags */ 382/* General Playback flags */
299 383
@@ -302,61 +386,61 @@ typedef struct MWRITER {
302#define SF_REVERSE 0x0400 386#define SF_REVERSE 0x0400
303#define SF_SUSTAIN 0x0800 387#define SF_SUSTAIN 0x0800
304 388
305#define SF_PLAYBACKMASK 0x0C00 389#define SF_PLAYBACKMASK 0x0C00
306 390
307/* Module-only Playback Flags */ 391/* Module-only Playback Flags */
308 392
309#define SF_OWNPAN 0x1000 393#define SF_OWNPAN 0x1000
310#define SF_UST_LOOP 0x2000 394#define SF_UST_LOOP 0x2000
311 395
312#define SF_EXTRAPLAYBACKMASK 0x3000 396#define SF_EXTRAPLAYBACKMASK 0x3000
313 397
314/* Panning constants */ 398/* Panning constants */
315#define PAN_LEFT 0 399#define PAN_LEFT 0
316#define PAN_HALFLEFT 64 400#define PAN_HALFLEFT 64
317#define PAN_CENTER 128 401#define PAN_CENTER 128
318#define PAN_HALFRIGHT 192 402#define PAN_HALFRIGHT 192
319#define PAN_RIGHT 255 403#define PAN_RIGHT 255
320#define PAN_SURROUND 512 /* panning value for Dolby Surround */ 404#define PAN_SURROUND 512 /* panning value for Dolby Surround */
321 405
322typedef struct SAMPLE { 406typedef struct SAMPLE {
323 SWORD panning; /* panning (0-255 or PAN_SURROUND) */ 407 SWORD panning; /* panning (0-255 or PAN_SURROUND) */
324 ULONG speed; /* Base playing speed/frequency of note */ 408 ULONG speed; /* Base playing speed/frequency of note */
325 UBYTE volume; /* volume 0-64 */ 409 UBYTE volume; /* volume 0-64 */
326 UWORD inflags; /* sample format on disk */ 410 UWORD inflags; /* sample format on disk */
327 UWORD flags; /* sample format in memory */ 411 UWORD flags; /* sample format in memory */
328 ULONG length; /* length of sample (in samples!) */ 412 ULONG length; /* length of sample (in samples!) */
329 ULONG loopstart; /* repeat position (relative to start, in samples) */ 413 ULONG loopstart; /* repeat position (relative to start, in samples) */
330 ULONG loopend; /* repeat end */ 414 ULONG loopend; /* repeat end */
331 ULONG susbegin; /* sustain loop begin (in samples) \ Not Supported */ 415 ULONG susbegin; /* sustain loop begin (in samples) \ Not Supported */
332 ULONG susend; /* sustain loop end / Yet! */ 416 ULONG susend; /* sustain loop end / Yet! */
333 417
334 /* Variables used by the module player only! (ignored for sound effects) */ 418 /* Variables used by the module player only! (ignored for sound effects) */
335 UBYTE globvol; /* global volume */ 419 UBYTE globvol; /* global volume */
336 UBYTE vibflags; /* autovibrato flag stuffs */ 420 UBYTE vibflags; /* autovibrato flag stuffs */
337 UBYTE vibtype; /* Vibratos moved from INSTRUMENT to SAMPLE */ 421 UBYTE vibtype; /* Vibratos moved from INSTRUMENT to SAMPLE */
338 UBYTE vibsweep; 422 UBYTE vibsweep;
339 UBYTE vibdepth; 423 UBYTE vibdepth;
340 UBYTE vibrate; 424 UBYTE vibrate;
341 CHAR* samplename; /* name of the sample */ 425 CHAR* samplename; /* name of the sample */
342 426
343 /* Values used internally only */ 427 /* Values used internally only */
344 UWORD avibpos; /* autovibrato pos [player use] */ 428 UWORD avibpos; /* autovibrato pos [player use] */
345 UBYTE divfactor; /* for sample scaling, maintains proper period slides */ 429 UBYTE divfactor; /* for sample scaling, maintains proper period slides */
346 ULONG seekpos; /* seek position in file */ 430 ULONG seekpos; /* seek position in file */
347 SWORD handle; /* sample handle used by individual drivers */ 431 SWORD handle; /* sample handle used by individual drivers */
348 void (*onfree)(void *ctx); /* called from Sample_Free if not NULL */ 432 void (*onfree)(void *ctx); /* called from Sample_Free if not NULL */
349 void *ctx; /* context passed to previous function*/ 433 void *ctx; /* context passed to previous function*/
350} SAMPLE; 434} SAMPLE;
351 435
352/* Sample functions */ 436/* Sample functions */
353 437
354MIKMODAPI extern SAMPLE *Sample_LoadRaw(CHAR *,ULONG rate, ULONG channel, ULONG flags); 438MIKMODAPI extern SAMPLE *Sample_LoadRaw(const CHAR *,ULONG rate, ULONG channel, ULONG flags);
355MIKMODAPI extern SAMPLE *Sample_LoadRawFP(int fp,ULONG rate,ULONG channel, ULONG flags); 439MIKMODAPI extern SAMPLE *Sample_LoadRawFP(int fp,ULONG rate,ULONG channel, ULONG flags);
356MIKMODAPI extern SAMPLE *Sample_LoadRawMem(const char *buf, int len, ULONG rate, ULONG channel, ULONG flags); 440MIKMODAPI extern SAMPLE *Sample_LoadRawMem(const char *buf, int len, ULONG rate, ULONG channel, ULONG flags);
357MIKMODAPI extern SAMPLE *Sample_LoadRawGeneric(MREADER*reader,ULONG rate, ULONG channel, ULONG flags); 441MIKMODAPI extern SAMPLE *Sample_LoadRawGeneric(MREADER*reader,ULONG rate, ULONG channel, ULONG flags);
358 442
359MIKMODAPI extern SAMPLE *Sample_Load(CHAR*); 443MIKMODAPI extern SAMPLE *Sample_Load(const CHAR*);
360MIKMODAPI extern SAMPLE *Sample_LoadFP(int); 444MIKMODAPI extern SAMPLE *Sample_LoadFP(int);
361MIKMODAPI extern SAMPLE *Sample_LoadMem(const char *buf, int len); 445MIKMODAPI extern SAMPLE *Sample_LoadMem(const char *buf, int len);
362MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*); 446MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
@@ -376,12 +460,12 @@ MIKMODAPI extern SLONG Voice_GetPosition(SBYTE);
376MIKMODAPI extern ULONG Voice_RealVolume(SBYTE); 460MIKMODAPI extern ULONG Voice_RealVolume(SBYTE);
377 461
378/* 462/*
379 * ========== Internal module representation (UniMod) 463 * ========== Internal module representation (UniMod)
380 */ 464 */
381 465
382/* 466/*
383 Instrument definition - for information only, the only field which may be 467 Instrument definition - for information only, the only field which may be
384 of use in user programs is the name field 468 of use in user programs is the name field
385*/ 469*/
386 470
387/* Instrument note count */ 471/* Instrument note count */
@@ -389,8 +473,8 @@ MIKMODAPI extern ULONG Voice_RealVolume(SBYTE);
389 473
390/* Envelope point */ 474/* Envelope point */
391typedef struct ENVPT { 475typedef struct ENVPT {
392 SWORD pos; 476 SWORD pos;
393 SWORD val; 477 SWORD val;
394} ENVPT; 478} ENVPT;
395 479
396/* Envelope point count */ 480/* Envelope point count */
@@ -398,154 +482,156 @@ typedef struct ENVPT {
398 482
399/* Instrument structure */ 483/* Instrument structure */
400typedef struct INSTRUMENT { 484typedef struct INSTRUMENT {
401 CHAR* insname; 485 CHAR* insname;
402 486
403 UBYTE flags; 487 UBYTE flags;
404 UWORD samplenumber[INSTNOTES]; 488 UWORD samplenumber[INSTNOTES];
405 UBYTE samplenote[INSTNOTES]; 489 UBYTE samplenote[INSTNOTES];
406 490
407 UBYTE nnatype; 491 UBYTE nnatype;
408 UBYTE dca; /* duplicate check action */ 492 UBYTE dca; /* duplicate check action */
409 UBYTE dct; /* duplicate check type */ 493 UBYTE dct; /* duplicate check type */
410 UBYTE globvol; 494 UBYTE globvol;
411 UWORD volfade; 495 UWORD volfade;
412 SWORD panning; /* instrument-based panning var */ 496 SWORD panning; /* instrument-based panning var */
413 497
414 UBYTE pitpansep; /* pitch pan separation (0 to 255) */ 498 UBYTE pitpansep; /* pitch pan separation (0 to 255) */
415 UBYTE pitpancenter; /* pitch pan center (0 to 119) */ 499 UBYTE pitpancenter; /* pitch pan center (0 to 119) */
416 UBYTE rvolvar; /* random volume varations (0 - 100%) */ 500 UBYTE rvolvar; /* random volume varations (0 - 100%) */
417 UBYTE rpanvar; /* random panning varations (0 - 100%) */ 501 UBYTE rpanvar; /* random panning varations (0 - 100%) */
418 502
419 /* volume envelope */ 503 /* volume envelope */
420 UBYTE volflg; /* bit 0: on 1: sustain 2: loop */ 504 UBYTE volflg; /* bit 0: on 1: sustain 2: loop */
421 UBYTE volpts; 505 UBYTE volpts;
422 UBYTE volsusbeg; 506 UBYTE volsusbeg;
423 UBYTE volsusend; 507 UBYTE volsusend;
424 UBYTE volbeg; 508 UBYTE volbeg;
425 UBYTE volend; 509 UBYTE volend;
426 ENVPT volenv[ENVPOINTS]; 510 ENVPT volenv[ENVPOINTS];
427 /* panning envelope */ 511 /* panning envelope */
428 UBYTE panflg; /* bit 0: on 1: sustain 2: loop */ 512 UBYTE panflg; /* bit 0: on 1: sustain 2: loop */
429 UBYTE panpts; 513 UBYTE panpts;
430 UBYTE pansusbeg; 514 UBYTE pansusbeg;
431 UBYTE pansusend; 515 UBYTE pansusend;
432 UBYTE panbeg; 516 UBYTE panbeg;
433 UBYTE panend; 517 UBYTE panend;
434 ENVPT panenv[ENVPOINTS]; 518 ENVPT panenv[ENVPOINTS];
435 /* pitch envelope */ 519 /* pitch envelope */
436 UBYTE pitflg; /* bit 0: on 1: sustain 2: loop */ 520 UBYTE pitflg; /* bit 0: on 1: sustain 2: loop */
437 UBYTE pitpts; 521 UBYTE pitpts;
438 UBYTE pitsusbeg; 522 UBYTE pitsusbeg;
439 UBYTE pitsusend; 523 UBYTE pitsusend;
440 UBYTE pitbeg; 524 UBYTE pitbeg;
441 UBYTE pitend; 525 UBYTE pitend;
442 ENVPT pitenv[ENVPOINTS]; 526 ENVPT pitenv[ENVPOINTS];
443} INSTRUMENT; 527} INSTRUMENT;
444 528
445struct MP_CONTROL; 529struct MP_CONTROL;
446struct MP_VOICE; 530struct MP_VOICE;
447 531
448/* 532/*
449 Module definition 533 Module definition
450*/ 534*/
451 535
452/* maximum master channels supported */ 536/* maximum master channels supported */
453#define UF_MAXCHAN 64 537#define UF_MAXCHAN 64
454 538
455/* Module flags */ 539/* Module flags */
456#define UF_XMPERIODS 0x0001 /* XM periods / finetuning */ 540#define UF_XMPERIODS 0x0001 /* XM periods / finetuning */
457#define UF_LINEAR 0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */ 541#define UF_LINEAR 0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
458#define UF_INST 0x0004 /* Instruments are used */ 542#define UF_INST 0x0004 /* Instruments are used */
459#define UF_NNA 0x0008 /* IT: NNA used, set numvoices rather 543#define UF_NNA 0x0008 /* IT: NNA used, set numvoices rather
460 than numchn */ 544 than numchn */
461#define UF_S3MSLIDES 0x0010 /* uses old S3M volume slides */ 545#define UF_S3MSLIDES 0x0010 /* uses old S3M volume slides */
462#define UF_BGSLIDES 0x0020 /* continue volume slides in the background */ 546#define UF_BGSLIDES 0x0020 /* continue volume slides in the background */
463#define UF_HIGHBPM 0x0040 /* MED: can use >255 bpm */ 547#define UF_HIGHBPM 0x0040 /* MED: can use >255 bpm */
464#define UF_NOWRAP 0x0080 /* XM-type (i.e. illogical) pattern break 548#define UF_NOWRAP 0x0080 /* XM-type (i.e. illogical) pattern break
465 semantics */ 549 semantics */
466#define UF_ARPMEM 0x0100 /* IT: need arpeggio memory */ 550#define UF_ARPMEM 0x0100 /* IT: need arpeggio memory */
467#define UF_FT2QUIRKS 0x0200 /* emulate some FT2 replay quirks */ 551#define UF_FT2QUIRKS 0x0200 /* emulate some FT2 replay quirks */
468#define UF_PANNING 0x0400 /* module uses panning effects or have 552#define UF_PANNING 0x0400 /* module uses panning effects or have
469 non-tracker default initial panning */ 553 non-tracker default initial panning */
470 554
471typedef struct MODULE { 555typedef struct MODULE {
472 /* general module information */ 556 /* general module information */
473 CHAR* songname; /* name of the song */ 557 CHAR* songname; /* name of the song */
474 CHAR* modtype; /* string type of module loaded */ 558 CHAR* modtype; /* string type of module loaded */
475 CHAR* comment; /* module comments */ 559 CHAR* comment; /* module comments */
476 560
477 UWORD flags; /* See module flags above */ 561 UWORD flags; /* See module flags above */
478 UBYTE numchn; /* number of module channels */ 562 UBYTE numchn; /* number of module channels */
479 UBYTE numvoices; /* max # voices used for full NNA playback */ 563 UBYTE numvoices; /* max # voices used for full NNA playback */
480 UWORD numpos; /* number of positions in this song */ 564 UWORD numpos; /* number of positions in this song */
481 UWORD numpat; /* number of patterns in this song */ 565 UWORD numpat; /* number of patterns in this song */
482 UWORD numins; /* number of instruments */ 566 UWORD numins; /* number of instruments */
483 UWORD numsmp; /* number of samples */ 567 UWORD numsmp; /* number of samples */
484struct INSTRUMENT* instruments; /* all instruments */ 568
485struct SAMPLE* samples; /* all samples */ 569 struct INSTRUMENT* instruments; /* all instruments */
486 UBYTE realchn; /* real number of channels used */ 570 struct SAMPLE* samples; /* all samples */
487 UBYTE totalchn; /* total number of channels used (incl NNAs) */ 571
488 572 UBYTE realchn; /* real number of channels used */
489 /* playback settings */ 573 UBYTE totalchn; /* total number of channels used (incl NNAs) */
490 UWORD reppos; /* restart position */ 574
491 UBYTE initspeed; /* initial song speed */ 575 /* playback settings */
492 UWORD inittempo; /* initial song tempo */ 576 UWORD reppos; /* restart position */
493 UBYTE initvolume; /* initial global volume (0 - 128) */ 577 UBYTE initspeed; /* initial song speed */
494 UWORD panning[UF_MAXCHAN]; /* panning positions */ 578 UWORD inittempo; /* initial song tempo */
495 UBYTE chanvol[UF_MAXCHAN]; /* channel positions */ 579 UBYTE initvolume; /* initial global volume (0 - 128) */
496 UWORD bpm; /* current beats-per-minute speed */ 580 UWORD panning[UF_MAXCHAN]; /* panning positions */
497 UWORD sngspd; /* current song speed */ 581 UBYTE chanvol[UF_MAXCHAN]; /* channel positions */
498 SWORD volume; /* song volume (0-128) (or user volume) */ 582 UWORD bpm; /* current beats-per-minute speed */
499 583 UWORD sngspd; /* current song speed */
500 int extspd; /* extended speed flag (default enabled) */ 584 SWORD volume; /* song volume (0-128) (or user volume) */
501 int panflag; /* panning flag (default enabled) */ 585
502 int wrap; /* wrap module ? (default disabled) */ 586 int extspd; /* extended speed flag (default enabled) */
503 int loop; /* allow module to loop ? (default enabled) */ 587 int panflag; /* panning flag (default enabled) */
504 int fadeout; /* volume fade out during last pattern */ 588 int wrap; /* wrap module ? (default disabled) */
505 589 int loop; /* allow module to loop ? (default enabled) */
506 UWORD patpos; /* current row number */ 590 int fadeout; /* volume fade out during last pattern */
507 SWORD sngpos; /* current song position */ 591
508 ULONG sngtime; /* current song time in 2^-10 seconds */ 592 UWORD patpos; /* current row number */
509 593 SWORD sngpos; /* current song position */
510 SWORD relspd; /* relative speed factor */ 594 ULONG sngtime; /* current song time in 2^-10 seconds */
511 595
512 /* internal module representation */ 596 SWORD relspd; /* relative speed factor */
513 UWORD numtrk; /* number of tracks */ 597
514 UBYTE** tracks; /* array of numtrk pointers to tracks */ 598 /* internal module representation */
515 UWORD* patterns; /* array of Patterns */ 599 UWORD numtrk; /* number of tracks */
516 UWORD* pattrows; /* array of number of rows for each pattern */ 600 UBYTE** tracks; /* array of numtrk pointers to tracks */
517 UWORD* positions; /* all positions */ 601 UWORD* patterns; /* array of Patterns */
518 602 UWORD* pattrows; /* array of number of rows for each pattern */
519 int forbid; /* if true, no player update! */ 603 UWORD* positions; /* all positions */
520 UWORD numrow; /* number of rows on current pattern */ 604
521 UWORD vbtick; /* tick counter (counts from 0 to sngspd) */ 605 int forbid; /* if true, no player update! */
522 UWORD sngremainder;/* used for song time computation */ 606 UWORD numrow; /* number of rows on current pattern */
523 607 UWORD vbtick; /* tick counter (counts from 0 to sngspd) */
524struct MP_CONTROL* control; /* Effects Channel info (size pf->numchn) */ 608 UWORD sngremainder;/* used for song time computation */
525struct MP_VOICE* voice; /* Audio Voice information (size md_numchn) */ 609
526 610 struct MP_CONTROL* control; /* Effects Channel info (size pf->numchn) */
527 UBYTE globalslide; /* global volume slide rate */ 611 struct MP_VOICE* voice; /* Audio Voice information (size md_numchn) */
528 UBYTE pat_repcrazy;/* module has just looped to position -1 */ 612
529 UWORD patbrk; /* position where to start a new pattern */ 613 UBYTE globalslide; /* global volume slide rate */
530 UBYTE patdly; /* patterndelay counter (command memory) */ 614 UBYTE pat_repcrazy;/* module has just looped to position -1 */
531 UBYTE patdly2; /* patterndelay counter (real one) */ 615 UWORD patbrk; /* position where to start a new pattern */
532 SWORD posjmp; /* flag to indicate a jump is needed... */ 616 UBYTE patdly; /* patterndelay counter (command memory) */
533 UWORD bpmlimit; /* threshold to detect bpm or speed values */ 617 UBYTE patdly2; /* patterndelay counter (real one) */
618 SWORD posjmp; /* flag to indicate a jump is needed... */
619 UWORD bpmlimit; /* threshold to detect bpm or speed values */
534} MODULE; 620} MODULE;
535 621
536 622
537/* This structure is used to query current playing voices status */ 623/* This structure is used to query current playing voices status */
538typedef struct VOICEINFO { 624typedef struct VOICEINFO {
539 INSTRUMENT* i; /* Current channel instrument */ 625 INSTRUMENT* i; /* Current channel instrument */
540 SAMPLE* s; /* Current channel sample */ 626 SAMPLE* s; /* Current channel sample */
541 SWORD panning; /* panning position */ 627 SWORD panning; /* panning position */
542 SBYTE volume; /* channel's "global" volume (0..64) */ 628 SBYTE volume; /* channel's "global" volume (0..64) */
543 UWORD period; /* period to play the sample at */ 629 UWORD period; /* period to play the sample at */
544 UBYTE kick; /* if true = sample has been restarted */ 630 UBYTE kick; /* if true = sample has been restarted */
545} VOICEINFO; 631} VOICEINFO;
546 632
547/* 633/*
548 * ========== Module loaders 634 * ========== Module loaders
549 */ 635 */
550 636
551struct MLOADER; 637struct MLOADER;
@@ -572,18 +658,19 @@ MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
572MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */ 658MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
573MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */ 659MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
574MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */ 660MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
661MIKMODAPI extern struct MLOADER load_umx; /* Unreal UMX container of Epic Games */
575MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */ 662MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
576MIKMODAPI extern struct MLOADER load_xm; /* FastTracker 2 (by Triton) */ 663MIKMODAPI extern struct MLOADER load_xm; /* FastTracker 2 (by Triton) */
577 664
578/* 665/*
579 * ========== Module player 666 * ========== Module player
580 */ 667 */
581 668
582MIKMODAPI extern MODULE* Player_Load(CHAR*,int,int); 669MIKMODAPI extern MODULE* Player_Load(const CHAR*,int,int);
583MIKMODAPI extern MODULE* Player_LoadFP(int,int,int); 670MIKMODAPI extern MODULE* Player_LoadFP(int,int,int);
584MIKMODAPI extern MODULE* Player_LoadMem(const char *buffer,int len,int maxchan,int curious); 671MIKMODAPI extern MODULE* Player_LoadMem(const char *buffer,int len,int maxchan,int curious);
585MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,int); 672MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,int);
586MIKMODAPI extern CHAR* Player_LoadTitle(CHAR*); 673MIKMODAPI extern CHAR* Player_LoadTitle(const CHAR*);
587MIKMODAPI extern CHAR* Player_LoadTitleFP(int); 674MIKMODAPI extern CHAR* Player_LoadTitleFP(int);
588MIKMODAPI extern CHAR* Player_LoadTitleMem(const char *buffer,int len); 675MIKMODAPI extern CHAR* Player_LoadTitleMem(const char *buffer,int len);
589MIKMODAPI extern CHAR* Player_LoadTitleGeneric(MREADER*); 676MIKMODAPI extern CHAR* Player_LoadTitleGeneric(MREADER*);
@@ -607,9 +694,9 @@ MIKMODAPI extern void Player_Mute(SLONG,...);
607MIKMODAPI extern void Player_ToggleMute(SLONG,...); 694MIKMODAPI extern void Player_ToggleMute(SLONG,...);
608MIKMODAPI extern int Player_GetChannelVoice(UBYTE); 695MIKMODAPI extern int Player_GetChannelVoice(UBYTE);
609MIKMODAPI extern UWORD Player_GetChannelPeriod(UBYTE); 696MIKMODAPI extern UWORD Player_GetChannelPeriod(UBYTE);
610MIKMODAPI extern int Player_QueryVoices(UWORD numvoices, VOICEINFO *vinfo); 697MIKMODAPI extern int Player_QueryVoices(UWORD numvoices, VOICEINFO *vinfo);
611MIKMODAPI extern int Player_GetRow(void); 698MIKMODAPI extern int Player_GetRow(void);
612MIKMODAPI extern int Player_GetOrder(void); 699MIKMODAPI extern int Player_GetOrder(void);
613 700
614typedef void (*MikMod_player_t)(void); 701typedef void (*MikMod_player_t)(void);
615typedef void (*MikMod_callback_t)(unsigned char *data, size_t len); 702typedef void (*MikMod_callback_t)(unsigned char *data, size_t len);
@@ -620,17 +707,17 @@ MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
620#define MUTE_INCLUSIVE 32001 707#define MUTE_INCLUSIVE 32001
621 708
622/* 709/*
623 * ========== Drivers 710 * ========== Drivers
624 */ 711 */
625 712
626enum { 713enum {
627 MD_MUSIC = 0, 714 MD_MUSIC = 0,
628 MD_SNDFX 715 MD_SNDFX
629}; 716};
630 717
631enum { 718enum {
632 MD_HARDWARE = 0, 719 MD_HARDWARE = 0,
633 MD_SOFTWARE 720 MD_SOFTWARE
634}; 721};
635 722
636/* Mixing flags */ 723/* Mixing flags */
@@ -646,46 +733,48 @@ enum {
646#define DMODE_SURROUND 0x0100 /* enable surround sound */ 733#define DMODE_SURROUND 0x0100 /* enable surround sound */
647#define DMODE_INTERP 0x0200 /* enable interpolation */ 734#define DMODE_INTERP 0x0200 /* enable interpolation */
648#define DMODE_REVERSE 0x0400 /* reverse stereo */ 735#define DMODE_REVERSE 0x0400 /* reverse stereo */
649#define DMODE_SIMDMIXER 0x0800 /* enable SIMD mixing */ 736#define DMODE_SIMDMIXER 0x0800 /* enable SIMD mixing */
650#define DMODE_NOISEREDUCTION 0x1000 /* Low pass filtering */ 737#define DMODE_NOISEREDUCTION 0x1000 /* Low pass filtering */
651 738
739
652struct SAMPLOAD; 740struct SAMPLOAD;
741
653typedef struct MDRIVER { 742typedef struct MDRIVER {
654struct MDRIVER* next; 743 struct MDRIVER* next;
655 CHAR* Name; 744 const CHAR* Name;
656 CHAR* Version; 745 const CHAR* Version;
657 746
658 UBYTE HardVoiceLimit; /* Limit of hardware mixer voices */ 747 UBYTE HardVoiceLimit; /* Limit of hardware mixer voices */
659 UBYTE SoftVoiceLimit; /* Limit of software mixer voices */ 748 UBYTE SoftVoiceLimit; /* Limit of software mixer voices */
660 749
661 CHAR *Alias; 750 const CHAR* Alias;
662 CHAR *CmdLineHelp; 751 const CHAR* CmdLineHelp;
663 752
664 void (*CommandLine) (CHAR*); 753 void (*CommandLine) (const CHAR*);
665 int (*IsPresent) (void); 754 int (*IsPresent) (void);
666 SWORD (*SampleLoad) (struct SAMPLOAD*,int); 755 SWORD (*SampleLoad) (struct SAMPLOAD*,int);
667 void (*SampleUnload) (SWORD); 756 void (*SampleUnload) (SWORD);
668 ULONG (*FreeSampleSpace) (int); 757 ULONG (*FreeSampleSpace) (int);
669 ULONG (*RealSampleLength) (int,struct SAMPLE*); 758 ULONG (*RealSampleLength) (int,struct SAMPLE*);
670 int (*Init) (void); 759 int (*Init) (void);
671 void (*Exit) (void); 760 void (*Exit) (void);
672 int (*Reset) (void); 761 int (*Reset) (void);
673 int (*SetNumVoices) (void); 762 int (*SetNumVoices) (void);
674 int (*PlayStart) (void); 763 int (*PlayStart) (void);
675 void (*PlayStop) (void); 764 void (*PlayStop) (void);
676 void (*Update) (void); 765 void (*Update) (void);
677 void (*Pause) (void); 766 void (*Pause) (void);
678 void (*VoiceSetVolume) (UBYTE,UWORD); 767 void (*VoiceSetVolume) (UBYTE,UWORD);
679 UWORD (*VoiceGetVolume) (UBYTE); 768 UWORD (*VoiceGetVolume) (UBYTE);
680 void (*VoiceSetFrequency)(UBYTE,ULONG); 769 void (*VoiceSetFrequency)(UBYTE,ULONG);
681 ULONG (*VoiceGetFrequency)(UBYTE); 770 ULONG (*VoiceGetFrequency)(UBYTE);
682 void (*VoiceSetPanning) (UBYTE,ULONG); 771 void (*VoiceSetPanning) (UBYTE,ULONG);
683 ULONG (*VoiceGetPanning) (UBYTE); 772 ULONG (*VoiceGetPanning) (UBYTE);
684 void (*VoicePlay) (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD); 773 void (*VoicePlay) (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
685 void (*VoiceStop) (UBYTE); 774 void (*VoiceStop) (UBYTE);
686 int (*VoiceStopped) (UBYTE); 775 int (*VoiceStopped) (UBYTE);
687 SLONG (*VoiceGetPosition) (UBYTE); 776 SLONG (*VoiceGetPosition) (UBYTE);
688 ULONG (*VoiceRealVolume) (UBYTE); 777 ULONG (*VoiceRealVolume) (UBYTE);
689} MDRIVER; 778} MDRIVER;
690 779
691/* These variables can be changed at ANY time and results will be immediate */ 780/* These variables can be changed at ANY time and results will be immediate */
@@ -700,7 +789,7 @@ MIKMODAPI extern UBYTE md_pansep; /* 0 = mono; 128 == 100% (full left/righ
700 in a skip or pop in audio (depending on the soundcard driver and the settings 789 in a skip or pop in audio (depending on the soundcard driver and the settings
701 changed). */ 790 changed). */
702MIKMODAPI extern UWORD md_device; /* device */ 791MIKMODAPI extern UWORD md_device; /* device */
703MIKMODAPI extern UWORD md_mixfreq; /* mixing frequency */ 792MIKMODAPI extern ULONG md_mixfreq; /* mixing frequency */
704MIKMODAPI extern UWORD md_mode; /* mode. See DMODE_? flags above */ 793MIKMODAPI extern UWORD md_mode; /* mode. See DMODE_? flags above */
705 794
706/* The following variable should not be changed! */ 795/* The following variable should not be changed! */
@@ -709,7 +798,6 @@ MIKMODAPI extern MDRIVER* md_driver; /* Current driver in use. */
709/* Known drivers list */ 798/* Known drivers list */
710 799
711MIKMODAPI extern struct MDRIVER drv_nos; /* no sound */ 800MIKMODAPI extern struct MDRIVER drv_nos; /* no sound */
712#if 0
713MIKMODAPI extern struct MDRIVER drv_pipe; /* piped output */ 801MIKMODAPI extern struct MDRIVER drv_pipe; /* piped output */
714MIKMODAPI extern struct MDRIVER drv_raw; /* raw file disk writer [music.raw] */ 802MIKMODAPI extern struct MDRIVER drv_raw; /* raw file disk writer [music.raw] */
715MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */ 803MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
@@ -717,42 +805,53 @@ MIKMODAPI extern struct MDRIVER drv_wav; /* RIFF WAVE file disk writer [music
717MIKMODAPI extern struct MDRIVER drv_aiff; /* AIFF file disk writer [music.aiff] */ 805MIKMODAPI extern struct MDRIVER drv_aiff; /* AIFF file disk writer [music.aiff] */
718 806
719MIKMODAPI extern struct MDRIVER drv_ultra; /* Linux Ultrasound driver */ 807MIKMODAPI extern struct MDRIVER drv_ultra; /* Linux Ultrasound driver */
720MIKMODAPI extern struct MDRIVER drv_sam9407; /* Linux sam9407 driver */ 808MIKMODAPI extern struct MDRIVER drv_sam9407;/* Linux sam9407 driver */
721 809
722MIKMODAPI extern struct MDRIVER drv_AF; /* Dec Alpha AudioFile */ 810MIKMODAPI extern struct MDRIVER drv_AF; /* Dec Alpha AudioFile */
811MIKMODAPI extern struct MDRIVER drv_ahi; /* Amiga AHI */
723MIKMODAPI extern struct MDRIVER drv_aix; /* AIX audio device */ 812MIKMODAPI extern struct MDRIVER drv_aix; /* AIX audio device */
724MIKMODAPI extern struct MDRIVER drv_alsa; /* Advanced Linux Sound Architecture (ALSA) */ 813MIKMODAPI extern struct MDRIVER drv_alsa; /* Advanced Linux Sound Architecture (ALSA) */
725MIKMODAPI extern struct MDRIVER drv_esd; /* Enlightened sound daemon (EsounD) */ 814MIKMODAPI extern struct MDRIVER drv_esd; /* Enlightened sound daemon (EsounD) */
815MIKMODAPI extern struct MDRIVER drv_pulseaudio; /* PulseAudio */
726MIKMODAPI extern struct MDRIVER drv_hp; /* HP-UX audio device */ 816MIKMODAPI extern struct MDRIVER drv_hp; /* HP-UX audio device */
727MIKMODAPI extern struct MDRIVER drv_nas; /* Network Audio System (NAS) */ 817MIKMODAPI extern struct MDRIVER drv_nas; /* Network Audio System (NAS) */
728MIKMODAPI extern struct MDRIVER drv_oss; /* OpenSound System (Linux,FreeBSD...) */ 818MIKMODAPI extern struct MDRIVER drv_oss; /* OpenSound System (Linux,FreeBSD...) */
819MIKMODAPI extern struct MDRIVER drv_openal; /* OpenAL driver */
820MIKMODAPI extern struct MDRIVER drv_sdl; /* SDL audio driver */
729MIKMODAPI extern struct MDRIVER drv_sgi; /* SGI audio library */ 821MIKMODAPI extern struct MDRIVER drv_sgi; /* SGI audio library */
822MIKMODAPI extern struct MDRIVER drv_sndio; /* OpenBSD sndio */
730MIKMODAPI extern struct MDRIVER drv_sun; /* Sun/NetBSD/OpenBSD audio device */ 823MIKMODAPI extern struct MDRIVER drv_sun; /* Sun/NetBSD/OpenBSD audio device */
731 824
732MIKMODAPI extern struct MDRIVER drv_dart; /* OS/2 Direct Audio RealTime */ 825MIKMODAPI extern struct MDRIVER drv_dart; /* OS/2 Direct Audio RealTime */
733MIKMODAPI extern struct MDRIVER drv_os2; /* OS/2 MMPM/2 */ 826MIKMODAPI extern struct MDRIVER drv_os2; /* OS/2 MMPM/2 */
734 827
735MIKMODAPI extern struct MDRIVER drv_ds; /* Win32 DirectSound driver */ 828MIKMODAPI extern struct MDRIVER drv_ds; /* Win32 DirectSound driver */
829MIKMODAPI extern struct MDRIVER drv_xaudio2;/* Win32 XAudio2 driver */
736MIKMODAPI extern struct MDRIVER drv_win; /* Win32 multimedia API driver */ 830MIKMODAPI extern struct MDRIVER drv_win; /* Win32 multimedia API driver */
737 831
738MIKMODAPI extern struct MDRIVER drv_mac; /* Macintosh Sound Manager driver */ 832MIKMODAPI extern struct MDRIVER drv_mac; /* Macintosh Sound Manager driver */
739MIKMODAPI extern struct MDRIVER drv_osx; /* MacOS X CoreAudio Driver */ 833MIKMODAPI extern struct MDRIVER drv_osx; /* MacOS X CoreAudio Driver */
740 834
835MIKMODAPI extern struct MDRIVER drv_dc; /* Dreamcast driver */
741MIKMODAPI extern struct MDRIVER drv_gp32; /* GP32 Sound driver */ 836MIKMODAPI extern struct MDRIVER drv_gp32; /* GP32 Sound driver */
837MIKMODAPI extern struct MDRIVER drv_psp; /* PlayStation Portable driver */
838MIKMODAPI extern struct MDRIVER drv_n64; /* Nintendo64 driver */
742 839
743MIKMODAPI extern struct MDRIVER drv_wss; /* DOS WSS driver */ 840MIKMODAPI extern struct MDRIVER drv_wss; /* DOS WSS driver */
744MIKMODAPI extern struct MDRIVER drv_sb; /* DOS SB driver */ 841MIKMODAPI extern struct MDRIVER drv_sb; /* DOS S/B driver */
745#endif 842
843MIKMODAPI extern struct MDRIVER drv_osles; /* OpenSL ES driver for android */
844
746/*========== Virtual channel mixer interface (for user-supplied drivers only) */ 845/*========== Virtual channel mixer interface (for user-supplied drivers only) */
747 846
748MIKMODAPI extern int VC_Init(void); 847MIKMODAPI extern int VC_Init(void);
749MIKMODAPI extern void VC_Exit(void); 848MIKMODAPI extern void VC_Exit(void);
750MIKMODAPI extern void VC_SetCallback(MikMod_callback_t callback); 849MIKMODAPI extern void VC_SetCallback(MikMod_callback_t callback);
751MIKMODAPI extern int VC_SetNumVoices(void); 850MIKMODAPI extern int VC_SetNumVoices(void);
752MIKMODAPI extern ULONG VC_SampleSpace(int); 851MIKMODAPI extern ULONG VC_SampleSpace(int);
753MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*); 852MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
754 853
755MIKMODAPI extern int VC_PlayStart(void); 854MIKMODAPI extern int VC_PlayStart(void);
756MIKMODAPI extern void VC_PlayStop(void); 855MIKMODAPI extern void VC_PlayStop(void);
757 856
758MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int); 857MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);