3 * MIDAS DLL programming interface
5 * $Id: midasdll.h,v 1.32 1997/08/15 16:48:25 pekangas Exp $
7 * Copyright 1996,1997 Housemarque Inc.
9 * This file is part of MIDAS Digital Audio System, and may only be
10 * used, modified and distributed under the terms of the MIDAS
11 * Digital Audio System license, "license.txt". By continuing to use,
12 * modify or distribute this file you indicate that you have
13 * read the license and understand and accept it fully.
21 /* This is a kluge, but necessary as Watcom C sucks: */
22 #ifdef EXPORT_IN_MIDASDLL_H
25 #define _FUNC(x) x __export __stdcall
26 #define MIDAS_CALL __cdecl
28 #define _FUNC(x) __declspec(dllexport) x __stdcall
29 #define MIDAS_CALL __cdecl
33 #if defined(__linux__) || defined(__UNIX__) || defined(__DJGPP__)
38 #define _FUNC(x) x cdecl
39 #define MIDAS_CALL __cdecl
41 #define _FUNC(x) x __stdcall
42 #define MIDAS_CALL __cdecl
48 #if defined(__WATCOMC__) && defined(__cplusplus)
49 /* Disable to annoying Watcom C++ warnings - I have no idea how to get around
50 these without breaking Visual C compatibility: */
56 /* We'll need to define DWORD, BOOL, TRUE and FALSE if someone hasn't
57 done that before. For now, we'll just assume that if no-one has defined
58 TRUE we need to define everything. There definitions are compatible with
59 windows.h. If something else in your system defines these differently,
60 things should still work OK as long as FALSE is 0, TRUE is nonzero and
61 DWORD is 32-bit. Take care that you don't compare BOOLs like "bool == TRUE"
62 in that case though, just use "bool".
64 THIS IS UGLY AND MAY NEED FIXING!
65 ---------------------------------
72 typedef unsigned long DWORD;
73 #endif /* ifndef TRUE */
79 MIDAS_OPTION_NONE = 0,
81 MIDAS_OPTION_OUTPUTMODE,
82 MIDAS_OPTION_MIXBUFLEN,
83 MIDAS_OPTION_MIXBUFBLOCKS,
84 MIDAS_OPTION_DSOUND_MODE,
85 MIDAS_OPTION_DSOUND_HWND,
86 MIDAS_OPTION_DSOUND_OBJECT,
87 MIDAS_OPTION_DSOUND_BUFLEN,
88 MIDAS_OPTION_16BIT_ULAW_AUTOCONVERT,
89 MIDAS_OPTION_FILTER_MODE,
90 MIDAS_OPTION_MIXING_MODE,
91 MIDAS_OPTION_DEFAULT_STEREO_SEPARATION,
92 MIDAS_OPTION_FORCE_NO_SOUND
100 MIDAS_MODE_STEREO = 2,
102 MIDAS_MODE_16BIT = 8,
103 MIDAS_MODE_8BIT_MONO = MIDAS_MODE_8BIT | MIDAS_MODE_MONO,
104 MIDAS_MODE_8BIT_STEREO = MIDAS_MODE_8BIT | MIDAS_MODE_STEREO,
105 MIDAS_MODE_16BIT_MONO = MIDAS_MODE_16BIT | MIDAS_MODE_MONO,
106 MIDAS_MODE_16BIT_STEREO = MIDAS_MODE_16BIT | MIDAS_MODE_STEREO
111 enum MIDASsampleTypes
113 MIDAS_SAMPLE_NONE = 0,
114 MIDAS_SAMPLE_8BIT_MONO = 1,
115 MIDAS_SAMPLE_16BIT_MONO = 2,
116 MIDAS_SAMPLE_8BIT_STEREO = 3,
117 MIDAS_SAMPLE_16BIT_STEREO = 4,
118 MIDAS_SAMPLE_ADPCM_MONO = 5,
119 MIDAS_SAMPLE_ADPCM_STEREO = 6,
120 MIDAS_SAMPLE_ULAW_MONO = 7,
121 MIDAS_SAMPLE_ULAW_STEREO = 8
135 MIDAS_PAN_LEFT = -64,
136 MIDAS_PAN_MIDDLE = 0,
137 MIDAS_PAN_RIGHT = 64,
138 MIDAS_PAN_SURROUND = 0x80
144 MIDAS_CHANNEL_AUTO = 0xFFFF,
145 MIDAS_ILLEGAL_CHANNEL = 0xFFFF
149 enum MIDASdsoundModes
151 MIDAS_DSOUND_DISABLED = 0,
153 MIDAS_DSOUND_PRIMARY,
154 MIDAS_DSOUND_FORCE_STREAM
160 MIDAS_POSITION_DEFAULT = 0xFFFFFFFF
165 enum MIDASfilterModes
167 MIDAS_FILTER_NONE = 0,
168 MIDAS_FILTER_LESS = 1,
169 MIDAS_FILTER_MORE = 2,
170 MIDAS_FILTER_AUTO = 3
174 enum MIDASechoFilterTypes
176 MIDAS_ECHO_FILTER_NONE = 0,
177 MIDAS_ECHO_FILTER_LOWPASS = 1,
178 MIDAS_ECHO_FILTER_HIGHPASS = 2
182 enum MIDASmixingModes
184 MIDAS_MIX_NORMAL_QUALITY = 0,
185 MIDAS_MIX_HIGH_QUALITY = 1
189 enum MIDASsamplePlayStatus
191 MIDAS_SAMPLE_STOPPED = 0,
192 MIDAS_SAMPLE_PLAYING = 1
196 enum MIDASpostProcPosition
198 MIDAS_POST_PROC_FIRST = 0,
208 unsigned numPatterns;
209 unsigned numInstruments;
210 unsigned numChannels;
218 } MIDASinstrumentInfo;
228 unsigned songLoopCount;
234 unsigned delay; /* milliseconds, 16.16 fixed point */
235 int gain; /* gain, 16.16 fixed point */
236 int reverseChannels; /* reverse channels? */
237 unsigned filterType; /* filter type, MIDASechoFilterTypes */
243 int feedback; /* feedback, 16.16 fixed point */
244 int gain; /* total gain, 16.16 fixed point */
245 unsigned numEchoes; /* number of echoes */
246 MIDASecho *echoes; /* the echoes */
250 typedef void (MIDAS_CALL *MIDASpostProcFunction)(void *data,
251 unsigned numSamples, void *user);
253 typedef struct _MIDASpostProcessor
255 struct _MIDASpostProcessor *next, *prev; /* reserved */
256 void *userData; /* reserved */
257 MIDASpostProcFunction floatMono;
258 MIDASpostProcFunction floatStereo;
259 MIDASpostProcFunction intMono;
260 MIDASpostProcFunction intStereo;
261 } MIDASpostProcessor;
265 typedef void* MIDASmodule;
266 typedef DWORD MIDASmodulePlayHandle;
267 typedef DWORD MIDASsample;
268 typedef DWORD MIDASsamplePlayHandle;
269 typedef void* MIDASstreamHandle;
270 typedef void* MIDASechoHandle;
277 _FUNC(int) MIDASgetLastError(void);
278 _FUNC(char*) MIDASgetErrorMessage(int errorCode);
280 _FUNC(DWORD) MIDASgetDisplayRefreshRate(void);
282 _FUNC(BOOL) MIDASstartup(void);
283 _FUNC(BOOL) MIDASdetectSD(void);
284 _FUNC(BOOL) MIDASdetectSoundCard(void);
285 _FUNC(BOOL) MIDASconfig(void);
286 _FUNC(BOOL) MIDASloadConfig(char *fileName);
287 _FUNC(BOOL) MIDASsaveConfig(char *fileName);
288 _FUNC(BOOL) MIDASreadConfigRegistry(DWORD key, char *subKey);
289 _FUNC(BOOL) MIDASwriteConfigRegistry(DWORD key, char *subKey);
291 _FUNC(BOOL) MIDASinit(void);
292 _FUNC(BOOL) MIDASsetOption(int option, DWORD value);
293 _FUNC(DWORD) MIDASgetOption(int option);
294 _FUNC(BOOL) MIDASclose(void);
295 _FUNC(BOOL) MIDASsuspend(void);
296 _FUNC(BOOL) MIDASresume(void);
297 _FUNC(BOOL) MIDASopenChannels(int numChannels);
298 _FUNC(BOOL) MIDAScloseChannels(void);
299 _FUNC(BOOL) MIDASsetAmplification(DWORD amplification);
300 _FUNC(BOOL) MIDASstartBackgroundPlay(DWORD pollRate);
301 _FUNC(BOOL) MIDASstopBackgroundPlay(void);
302 _FUNC(BOOL) MIDASpoll(void);
303 _FUNC(void) MIDASlock(void);
304 _FUNC(void) MIDASunlock(void);
305 _FUNC(char*) MIDASgetVersionString(void);
306 _FUNC(BOOL) MIDASsetTimerCallbacks(DWORD rate, BOOL displaySync,
307 void (MIDAS_CALL *preVR)(),
308 void (MIDAS_CALL *immVR)(),
309 void (MIDAS_CALL *inVR)());
310 _FUNC(BOOL) MIDASremoveTimerCallbacks(void);
312 _FUNC(DWORD) MIDASallocateChannel(void);
313 _FUNC(BOOL) MIDASfreeChannel(DWORD channel);
315 _FUNC(MIDASmodule) MIDASloadModule(char *fileName);
316 _FUNC(MIDASmodulePlayHandle) MIDASplayModule(MIDASmodule module,
318 _FUNC(MIDASmodulePlayHandle) MIDASplayModuleSection(MIDASmodule module,
323 _FUNC(BOOL) MIDASstopModule(MIDASmodulePlayHandle playHandle);
324 _FUNC(BOOL) MIDASfreeModule(MIDASmodule module);
326 _FUNC(BOOL) MIDASgetPlayStatus(MIDASmodulePlayHandle playHandle,
327 MIDASplayStatus *status);
328 _FUNC(BOOL) MIDASsetPosition(MIDASmodulePlayHandle playHandle,
330 _FUNC(BOOL) MIDASsetMusicVolume(MIDASmodulePlayHandle playHandle,
332 _FUNC(BOOL) MIDASgetModuleInfo(MIDASmodule module, MIDASmoduleInfo *info);
333 _FUNC(BOOL) MIDASgetInstrumentInfo(MIDASmodule module, int instNum,
334 MIDASinstrumentInfo *info);
335 _FUNC(BOOL) MIDASsetMusicSyncCallback(MIDASmodulePlayHandle playHandle,
336 void (MIDAS_CALL *callback)
338 unsigned position, unsigned row));
339 _FUNC(BOOL) MIDASfadeMusicChannel(MIDASmodulePlayHandle playHandle,
340 unsigned channel, unsigned fade);
342 _FUNC(MIDASsample) MIDASloadRawSample(char *fileName, int sampleType,
344 _FUNC(MIDASsample) MIDASloadWaveSample(char *fileName, int loopSample);
345 _FUNC(BOOL) MIDASfreeSample(MIDASsample sample);
346 _FUNC(BOOL) MIDASallocAutoEffectChannels(unsigned numChannels);
347 _FUNC(BOOL) MIDASfreeAutoEffectChannels(void);
348 _FUNC(MIDASsamplePlayHandle) MIDASplaySample(MIDASsample sample,
349 unsigned channel, int priority, unsigned rate,
350 unsigned volume, int panning);
351 _FUNC(BOOL) MIDASstopSample(MIDASsamplePlayHandle sample);
352 _FUNC(BOOL) MIDASsetSampleRate(MIDASsamplePlayHandle sample,
354 _FUNC(BOOL) MIDASsetSampleVolume(MIDASsamplePlayHandle sample,
356 _FUNC(BOOL) MIDASsetSamplePanning(MIDASsamplePlayHandle sample,
358 _FUNC(BOOL) MIDASsetSamplePriority(MIDASsamplePlayHandle sample,
360 _FUNC(DWORD) MIDASgetSamplePlayStatus(MIDASsamplePlayHandle sample);
362 _FUNC(MIDASstreamHandle) MIDASplayStreamFile(char *fileName,
365 unsigned bufferLength,
367 _FUNC(BOOL) MIDASstopStream(MIDASstreamHandle stream);
369 _FUNC(MIDASstreamHandle) MIDASplayStreamWaveFile(char *fileName,
370 unsigned bufferLength,
373 _FUNC(MIDASstreamHandle) MIDASplayStreamPolling(unsigned sampleType,
375 unsigned bufferLength);
376 _FUNC(unsigned) MIDASfeedStreamData(MIDASstreamHandle stream,
377 unsigned char *data, unsigned numBytes, BOOL feedAll);
379 _FUNC(BOOL) MIDASsetStreamRate(MIDASstreamHandle stream, unsigned rate);
380 _FUNC(BOOL) MIDASsetStreamVolume(MIDASstreamHandle stream,
382 _FUNC(BOOL) MIDASsetStreamPanning(MIDASstreamHandle stream, int panning);
384 _FUNC(DWORD) MIDASgetStreamBytesBuffered(MIDASstreamHandle stream);
385 _FUNC(BOOL) MIDASpauseStream(MIDASstreamHandle stream);
386 _FUNC(BOOL) MIDASresumeStream(MIDASstreamHandle stream);
388 _FUNC(MIDASechoHandle) MIDASaddEchoEffect(MIDASechoSet *echoSet);
389 _FUNC(BOOL) MIDASremoveEchoEffect(MIDASechoHandle echoHandle);
391 _FUNC(BOOL) MIDASaddPostProcessor(MIDASpostProcessor *postProc,
392 unsigned procPos, void *userData);
393 _FUNC(BOOL) MIDASremovePostProcessor(MIDASpostProcessor *postProc);
408 * $Log: midasdll.h,v $
409 * Revision 1.32 1997/08/15 16:48:25 pekangas
410 * Added user post-processing functions
412 * Revision 1.31 1997/07/31 16:36:34 pekangas
413 * Fixed to work in Linux again
415 * Revision 1.30 1997/07/31 14:30:58 pekangas
416 * Added option MIDAS_OPTION_FORCE_NO_SOUND
418 * Revision 1.29 1997/07/31 10:56:48 pekangas
419 * Renamed from MIDAS Sound System to MIDAS Digital Audio System
421 * Revision 1.28 1997/07/29 16:51:09 pekangas
422 * Added sample playing status query
424 * Revision 1.27 1997/07/25 13:49:47 pekangas
425 * Actually added MIDAS_FILTER_AUTO (oops)
427 * Revision 1.26 1997/07/25 13:48:24 pekangas
428 * Changed MIDAS_OPTION_OVERSAMPLING setting to MIDAS_OPTION_MIXING_MODE
429 * Added automatic filtering
430 * Added MIDASgetOption()
432 * Revision 1.25 1997/07/11 11:05:54 pekangas
433 * Added new options to the echoes: Each echo now has its own filter setting
434 * (low/high-pass or nothing) and the whole echo set has a common gain.
436 * Revision 1.24 1997/07/10 18:40:23 pekangas
437 * Added echo effect support
439 * Revision 1.23 1997/07/09 08:58:00 pekangas
440 * Added default stereo separation
442 * Revision 1.22 1997/07/08 19:16:44 pekangas
443 * Added Win32 setup functions, save/restore setup from registry, and
444 * fixed WinWave to ignore buffer blocks -setting to be compatible with the
447 * Revision 1.21 1997/06/05 20:18:49 pekangas
448 * Added preliminary support for interpolating mixing (mono only at the
451 * Revision 1.20 1997/06/02 00:54:15 jpaana
452 * Changed most __LINUX__ defines to __UNIX__ for generic *nix porting
454 * Revision 1.19 1997/05/21 17:47:41 pekangas
455 * Changed MIDASfilterTypes to MIDASfilterModes
457 * Revision 1.18 1997/05/20 20:37:59 pekangas
458 * Added WAVE support to both streams and samples
460 * Revision 1.17 1997/05/07 17:14:53 pekangas
461 * Added a lot of new thread synchronization code, mainly to minimize the
462 * cases where MIDAS state may be modified when the player thread is active
463 * and vice versa. Added MIDASlock() and MIDASunlock() to the API.
465 * Revision 1.16 1997/05/03 17:54:02 pekangas
466 * Added optional simple output filtering
468 * Revision 1.15 1997/05/02 13:19:49 pekangas
469 * Several changes: Added support for non-looping module playback, added
470 * support for playing several modules simultaneously, added module section
471 * playback, added automatic channel allocation and deallocation to stream
472 * playback, simplified automatic effect channel handling and added functions
473 * for allocating and deallocating individiual channels.
475 * Revision 1.14 1997/04/08 15:48:07 pekangas
476 * Added gmpFadeChannel / MIDASfadeMusicChannel functions
478 * Revision 1.13 1997/04/07 21:07:51 pekangas
479 * Added the ability to pause/resume streams.
480 * Added functions to query the number of stream bytes buffered
482 * Revision 1.12 1997/03/09 19:13:01 pekangas
483 * Added the possibility to turn off u-law autoconvert
485 * Revision 1.11 1997/03/05 16:49:49 pekangas
486 * Added timer functions to DLL, some other minor modifications
488 * Revision 1.10 1997/02/27 16:03:36 pekangas
489 * Added DJGPP support
491 * Revision 1.9 1997/02/20 19:49:40 pekangas
492 * Added u-law sample type
494 * Revision 1.8 1997/02/19 20:45:09 pekangas
495 * Added functions MIDASsuspend() and MIDASresume()
497 * Revision 1.7 1997/02/12 17:18:37 pekangas
498 * Added MIDASsetAmplification()
500 * Revision 1.6 1997/02/12 16:28:12 pekangas
501 * Added ADPCM sample type
503 * Revision 1.5 1997/02/06 20:58:20 pekangas
504 * Added DirectSound support - new files, errors, and global flags
506 * Revision 1.4 1997/01/16 18:41:59 pekangas
507 * Changed copyright messages to Housemarque
509 * Revision 1.3 1997/01/16 18:26:27 pekangas
510 * Added numerous new functions
512 * Revision 1.2 1996/09/28 08:12:40 jpaana
515 * Revision 1.1 1996/09/25 18:38:12 pekangas