-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMss.h
4183 lines (3075 loc) · 145 KB
/
Mss.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//############################################################################
//## ##
//## Miles Sound System ##
//## ##
//## MSS.H: Miles Sound System main header file ##
//## ##
//## Version 1.00 of 15-Feb-95: Initial, derived from AIL.H V3.02 ##
//## 1.01 of 19-Jun-95: Added various functions for V3.03 release ##
//## 1.02 of 22-Nov-95: C++ typedef problem fixed, declspecs added ##
//## 1.03 of 15-Feb-96: Changes for 16 bit callbacks and multiple ##
//## 16 bit DLL loads (JKR) ##
//## 1.04 of 2-Nov-97: Changes made to handle DLS in future ##
//## versions ##
//## 1.05 of 1-Jan-98: Massive changes for version 4.0 ##
//## 1.06 of 17-Sep-98: Massive changes for version 5.0 ##
//## 1.07 of 2-Feb-99: Changes for new input API ##
//## 1.08 of 8-Feb-99: Changes for new filter helper functions ##
//## ##
//## Author: John Miles ##
//## ##
//############################################################################
//## ##
//## Contact RAD Game Tools at 425-893-4300 for technical support. ##
//## ##
//############################################################################
#ifndef MSS_VERSION
#define MSS_VERSION "6.0a"
#define MSS_VERSION_DATE "18-Oct-99"
#define MSS_COPYRIGHT "Copyright (C) 1991-99 RAD Game Tools, Inc."
#endif
#ifndef MSS_H
#define MSS_H
// IS_DOS for DOS
// IS_WINDOWS for Windows or Win32s
// IS_WIN32 for Win32s
// IS_WIN16 for Windows
// IS_32 for 32-bit DOS or Win32s
// IS_16 for 16-bit Windows
#ifdef IS_DOS
#undef IS_DOS
#endif
#ifdef IS_WINDOWS
#undef IS_WINDOWS
#endif
#ifdef IS_WIN32
#undef IS_WIN32
#endif
#ifdef IS_WIN16
#undef IS_WIN16
#endif
#ifdef IS_32
#undef IS_32
#endif
#ifdef IS_16
#undef IS_16
#endif
#ifdef __DOS__
#define IS_DOS
#define IS_32
#else
#ifdef _WIN32
#define IS_WINDOWS
#define IS_WIN32
#define IS_32
#else
#ifdef WIN32
#define IS_WINDOWS
#define IS_WIN32
#define IS_32
#else
#ifdef __NT__
#define IS_WINDOWS
#define IS_WIN32
#define IS_32
#else
#ifdef __WIN32__
#define IS_WINDOWS
#define IS_WIN32
#define IS_32
#else
#ifdef _WINDOWS
#define IS_WINDOWS
#define IS_WIN16
#define IS_16
#else
#ifdef _WINDLL
#define IS_WINDOWS
#define IS_WIN16
#define IS_16
#else
#ifdef WINDOWS
#define IS_WINDOWS
#define IS_WIN16
#define IS_16
#else
#ifdef __WINDOWS__
#define IS_WINDOWS
#define IS_WIN16
#define IS_16
#else
#ifdef _Windows
#define IS_WINDOWS
#define IS_WIN16
#define IS_16
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#if (!defined(IS_DOS) && !defined(IS_WINDOWS))
#error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, or WIN32.
#endif
#ifdef _PUSHPOP_SUPPORTED
#pragma pack(push,1)
#else
#pragma pack(1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef IS_DOS
#define AILCALLBACK __pascal
#define AILEXPORT cdecl
#define DXDEC extern
#define DXDEF
#define AILCALL cdecl
#define FAR
#define HIWORD(ptr) (((U32)ptr)>>16)
#define LOWORD(ptr) ((U16)((U32)ptr))
#define FOURCC U32
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((U32)(U8)(ch0) | ((U32)(U8)(ch1) << 8) | \
((U32)(U8)(ch2) << 16) | ((U32)(U8)(ch3) << 24 ))
#define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
#define AILLIBCALLBACK __pascal
#define MSS_MAIN_DEF
#define MSS_REDIST_DIR_NAME "DOS"
#else
#define AILLIBCALLBACK WINAPI
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef WIN32_EXTRA_LEAN
#define WIN32_EXTRA_LEAN
#endif
#ifndef STRICT
#define STRICT
#endif
#include <windows.h>
#include <mmsystem.h>
#define MSS_MAIN_DEF __cdecl
//
// If compiling MSS DLL, use __declspec(dllexport) for both
// declarations and definitions
//
// If compiling MSS16 library or application, use "extern" in declarations
// and nothing in definitions
//
#ifdef IS_WIN32
#define AILEXPORT WINAPI
#ifdef BUILD_MSS
#define DXDEC __declspec(dllexport)
#define DXDEF __declspec(dllexport)
#else
#ifdef __BORLANDC__
#define DXDEC extern
#else
#define DXDEC __declspec(dllimport)
#endif
#endif
#define MSSDLLNAME "MSS32.DLL"
#define MSS_REDIST_DIR_NAME "WIN32"
#else
#define AILEXPORT __export WINAPI
#define DXDEC extern
#define DXDEF
#define MSSDLLNAME "MSS16.DLL"
#define MSS_REDIST_DIR_NAME "WIN16"
#endif
#define AILCALL WINAPI
#define AILCALLBACK AILEXPORT
typedef LPVOID AILLPDIRECTSOUND;
typedef LPVOID AILLPDIRECTSOUNDBUFFER;
#endif
#ifndef NULL
#define NULL 0
#endif
//
// Misc. constant definitions
//
#define MAX_DRVRS 16 // Max. # of simultaneous drivers
#define MAX_TIMERS 16 // Max. # of simultaneous timers
#define MAX_NOTES 32 // Max # of notes "on"
#define FOR_NEST 4 // # of nested XMIDI FOR loops
#define NUM_CHANS 16 // # of possible MIDI channels
#define MAX_W_VOICES 16 // Max virtual wave synth voice cnt
#define MAX_W_ENTRIES 512 // 512 wave library entries max.
#define MIN_CHAN ( 1-1) // Min channel recognized (0-based)
#define MAX_CHAN (16-1) // Max channel recognized
#define MIN_LOCK_CHAN ( 2-1) // Min channel available for locking
#define MAX_LOCK_CHAN ( 9-1) // Max channel available for locking
#define PERCUSS_CHAN (10-1) // Percussion channel (no locking)
#define AIL_MAX_FILE_HEADER_SIZE 4096 // AIL_set_named_sample_file() requires at least 4K
// of data or the entire file image, whichever is less,
// to determine sample format
#define DIG_F_16BITS_MASK 1
#define DIG_F_STEREO_MASK 2
#define DIG_F_ADPCM_MASK 4
#define DIG_F_MONO_8 0 // PCM data formats
#define DIG_F_MONO_16 (DIG_F_16BITS_MASK)
#define DIG_F_STEREO_8 (DIG_F_STEREO_MASK)
#define DIG_F_STEREO_16 (DIG_F_STEREO_MASK|DIG_F_16BITS_MASK)
#define DIG_F_ADPCM_MONO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK)
#define DIG_F_ADPCM_STEREO_16 (DIG_F_ADPCM_MASK |DIG_F_16BITS_MASK|DIG_F_STEREO_MASK)
#define DIG_F_USING_ASI 16
#define DIG_PCM_SIGN 0x0001 // (obsolete)
#define DIG_PCM_ORDER 0x0002
#define DIG_PCM_POLARITY 0x0004 // PCM flags used by driver hardware
#define DIG_PCM_SPLIT 0x0008
#define DIG_BUFFER_SERVICE 0x0010
#define DIG_DUAL_DMA 0x0020
#define DIG_RECORDING_SUPPORTED 0x8000
#define WAVE_FORMAT_PCM 1
#define WAVE_FORMAT_IMA_ADPCM 0x0011
#ifdef IS_DOS
#define AIL3DIG 0 // .DIG driver
#define AIL3MDI 1 // .MDI driver
#define DIG_DETECT_8_BIT_ONLY 0x0001 // Detect 8-bit DMA only
#define DIG_DETECT_16_BIT_ONLY 0x0002 // Detect 16-bit DMA only
#define DIG_DETECT_8_AND_16_BITS 0x0003 // Detect both 8- and 16-bit DMA
#define DRV_INIT 0x300 // Functions common to .MDI and .DIG
#define DRV_GET_INFO 0x301 // drivers
#define DRV_SERVE 0x302
#define DRV_PARSE_ENV 0x303
#define DRV_VERIFY_IO 0x304
#define DRV_INIT_DEV 0x305
#define DRV_SHUTDOWN_DEV 0x306
#define DIG_HW_VOLUME 0x400 // .DIG driver functions
#define DIG_START_P_CMD 0x401
#define DIG_STOP_P_REQ 0x402
#define DIG_START_R_CMD 0x403
#define DIG_STOP_R_REQ 0x404
#define DIG_VSE 0x405
#define MDI_HW_VOLUME 0x500 // .MDI driver functions
#define MDI_INIT_INS_MGR 0x501
#define MDI_MIDI_XMIT 0x502
#define MDI_INSTALL_T_SET 0x503
#define MDI_GET_T_STATUS 0x504
#define MDI_PROT_UNPROT_T 0x505
#define MDI_VSE 0x506
#else
//
// Pass to AIL_midiOutOpen for NULL MIDI driver
//
#define MIDI_NULL_DRIVER ((U32)(S32)-2)
#endif
//
// Non-specific XMIDI/MIDI controllers and event types
//
#define SYSEX_BYTE 105
#define PB_RANGE 106
#define CHAN_MUTE 107
#define CALLBACK_PFX 108
#define SEQ_BRANCH 109
#define CHAN_LOCK 110
#define CHAN_PROTECT 111
#define VOICE_PROTECT 112
#define TIMBRE_PROTECT 113
#define PATCH_BANK_SEL 114
#define INDIRECT_C_PFX 115
#define FOR_LOOP 116
#define NEXT_LOOP 117
#define CLEAR_BEAT_BAR 118
#define CALLBACK_TRIG 119
#define SEQ_INDEX 120
#define GM_BANK_MSB 0
#define MODULATION 1
#define DATA_MSB 6
#define PART_VOLUME 7
#define PANPOT 10
#define EXPRESSION 11
#define GM_BANK_LSB 32
#define DATA_LSB 38
#define SUSTAIN 64
#define REVERB 91
#define CHORUS 93
#define RPN_LSB 100
#define RPN_MSB 101
#define RESET_ALL_CTRLS 121
#define ALL_NOTES_OFF 123
#define EV_NOTE_OFF 0x80
#define EV_NOTE_ON 0x90
#define EV_POLY_PRESS 0xa0
#define EV_CONTROL 0xb0
#define EV_PROGRAM 0xc0
#define EV_CHAN_PRESS 0xd0
#define EV_PITCH 0xe0
#define EV_SYSEX 0xf0
#define EV_ESC 0xf7
#define EV_META 0xff
#define META_EOT 0x2f
#define META_TEMPO 0x51
#define META_TIME_SIG 0x58
//
// SAMPLE.system_data[] usage
//
#define SSD_EOD_CALLBACK 0 // Application end-of-data callback if not NULL
#define VOC_BLK_PTR 1 // Pointer to current block
#define VOC_REP_BLK 2 // Pointer to beginning of repeat loop block
#define VOC_N_REPS 3 // # of iterations left in repeat loop
#define VOC_MARKER 4 // Marker to search for, or -1 if all
#define VOC_MARKER_FOUND 5 // Desired marker found if 1, else 0
#define SSD_RELEASE 6 // Release sample handle upon termination if >0
#ifdef IS_WINDOWS
#define SSD_EOD_CB_WIN32S 7 // Application end-of-data callback is in Win32s
#else
#define SSD_TEMP 7 // Temporary storage location for general use
#endif
//
// Timer status values
//
#define AILT_FREE 0 // Timer handle is free for allocation
#define AILT_STOPPED 1 // Timer is stopped
#define AILT_RUNNING 2 // Timer is running
//
// SAMPLE.status flag values
//
#define SMP_FREE 0x0001 // Sample is available for allocation
#define SMP_DONE 0x0002 // Sample has finished playing, or has
// never been started
#define SMP_PLAYING 0x0004 // Sample is playing
#define SMP_STOPPED 0x0008 // Sample has been stopped
#define SMP_PLAYINGBUTRELEASED 0x0010 // Sample is playing, but digital handle
// has been temporarily released
//
// SEQUENCE.status flag values
//
#define SEQ_FREE 0x0001 // Sequence is available for allocation
#define SEQ_DONE 0x0002 // Sequence has finished playing, or has
// never been started
#define SEQ_PLAYING 0x0004 // Sequence is playing
#define SEQ_STOPPED 0x0008 // Sequence has been stopped
#define SEQ_PLAYINGBUTRELEASED 0x0010 // Sequence is playing, but MIDI handle
// has been temporarily released
#ifdef IS_DOS
//
// MIDI driver types
//
#define MDIDRVRTYPE_GM 0 // General MIDI driver (Roland-compatible)
#define MDIDRVRTYPE_FM_2 1 // 2-operator FM MIDI driver (OPL2)
#define MDIDRVRTYPE_FM_4 2 // 4-operator FM MIDI driver (OPL3)
#define MDIDRVRTYPE_SPKR 3 // Tandy or PC speaker "beep" driver
//
// .INI installation result codes
//
#define AIL_INIT_SUCCESS 0 // Driver installed successfully
#define AIL_NO_INI_FILE 1 // No MDI.INI or DIG.INI file exists
#define AIL_INIT_FAILURE 2 // Driver could not be initialized
#ifdef __BORLANDC__
#ifndef REALPTR
#define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff) \
- AIL_sel_base(_DS)))
#endif
#else
#ifndef REALPTR
#define REALPTR(x) ((void *) (U32) ((((U32) (x))>>16<<4) + ((x) & 0xffff)))
#endif
#endif
#else
//
// AIL_set_direct_buffer_control() command values
//
#define AILDS_RELINQUISH 0 // App returns control of secondary buffer
#define AILDS_SEIZE 1 // App takes control of secondary buffer
#define AILDS_SEIZE_LOOP 2 // App wishes to loop the secondary buffer
#endif
//
// General type definitions for portability
//
#ifndef C8
#define C8 char
#endif
#ifndef U8
#define U8 unsigned char
#endif
#ifndef S8
#define S8 signed char
#endif
#ifndef U16
#define U16 unsigned short
#endif
#ifndef S16
#define S16 signed short
#endif
#ifndef U32
#define U32 unsigned long
#endif
#ifndef S32
#define S32 signed long
#endif
#ifndef F32
#define F32 float
#endif
#ifndef F64
#define F64 double
#endif
#ifndef REALFAR
#define REALFAR unsigned long
#endif
#ifndef FILE_ERRS
#define FILE_ERRS
#define AIL_NO_ERROR 0
#define AIL_IO_ERROR 1
#define AIL_OUT_OF_MEMORY 2
#define AIL_FILE_NOT_FOUND 3
#define AIL_CANT_WRITE_FILE 4
#define AIL_CANT_READ_FILE 5
#define AIL_DISK_FULL 6
#endif
#define MIN_VAL 0
#define NOM_VAL 1
#define MAX_VAL 2
#ifndef YES
#define YES 1
#endif
#ifndef NO
#define NO 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
//
// Preference names and default values
//
#define DIG_RESAMPLING_TOLERANCE 0
#define DEFAULT_DRT 655 // Resampling triggered at +/- 1%
#define DIG_MIXER_CHANNELS 1
#define DEFAULT_DMC 64 // 64 allocatable SAMPLE structures
#define DIG_DEFAULT_VOLUME 2
#define DEFAULT_DDV 127 // Default sample volume = 127 (0-127)
#define MDI_SERVICE_RATE 3
#define DEFAULT_MSR 120 // XMIDI sequencer timing = 120 Hz
#define MDI_SEQUENCES 4
#define DEFAULT_MS 8 // 8 sequence handles/driver
#define MDI_DEFAULT_VOLUME 5
#define DEFAULT_MDV 127 // Default sequence volume = 127 (0-127)
#define MDI_QUANT_ADVANCE 6
#define DEFAULT_MQA 1 // Beat/bar count +1 interval
#define MDI_ALLOW_LOOP_BRANCHING 7
#define DEFAULT_ALB NO // Branches cancel XMIDI FOR loops
#define MDI_DEFAULT_BEND_RANGE 8
#define DEFAULT_MDBR 2 // Default pitch-bend range = 2
#define MDI_DOUBLE_NOTE_OFF 9
#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards
#define DIG_ENABLE_RESAMPLE_FILTER 31 // Enable resampling filter by
#define DEFAULT_DERF YES // default
#define DIG_DECODE_BUFFER_SIZE 32 // 2K decode buffer size by default
#define DEFAULT_DDBS 2048
#ifdef IS_WINDOWS
#define DIG_DS_FRAGMENT_SIZE 34
#define DEFAULT_DDFS 8 // Use 8 millisecond buffer fragments with DirectSound if MSS mixer in use
#define DIG_DS_FRAGMENT_CNT 35
#define DEFAULT_DDFC 96 // Use 96 buffer fragments with DirectSound if MSS mixer in use
#define DIG_DS_MIX_FRAGMENT_CNT 42
#define DEFAULT_DDMFC 8 // Mix ahead 8 buffer fragments
#define DIG_DS_USE_PRIMARY 36
#define DEFAULT_DDUP NO // Mix into secondary DirectSound buffer by default
#define DIG_DS_DSBCAPS_CTRL3D 37
#define DEFAULT_DDDC NO // Do not use DSBCAPS_CTRL3D by default
#define DIG_DS_CREATION_HANDLER 38
#define DEFAULT_DDCH NULL // Use DirectSoundCreate() by default
#define MDI_SYSEX_BUFFER_SIZE 10
#define DEFAULT_MSBS 1536 // Default sysex buffer = 1536 bytes
#define DIG_OUTPUT_BUFFER_SIZE 11
#define DEFAULT_DOBS 49152 // 48K output buffer size
#define AIL_MM_PERIOD 12
#define DEFAULT_AMP 5 // Default MM timer period = 5 msec.
#define AIL_TIMERS 13
#define DEFAULT_AT 16 // 16 allocatable HTIMER handles
#define DIG_MIN_CHAIN_ELEMENT_SIZE 14
#define DEFAULT_MCES 4096 // 4096 bytes/waveOut buffer
#define DIG_USE_WAVEOUT 15
#define DEFAULT_DUW NO // Use DirectSound by default
#define DIG_DS_SECONDARY_SIZE 16
#define DEFAULT_DDSS (32*1024L) // Must be 2^n -- use 32K by default
#define DIG_DS_SAMPLE_CEILING 17
#define DEFAULT_DDSC 44100 // Allow up to 44 kHz samples
#define AIL_LOCK_PROTECTION 18
#define DEFAULT_ALP YES // Suspend foreground thread by default
#define AIL_WIN32S_CALLBACK_SIZE 19
#define DEFAULT_WCS 4096 // Size of callback data in bytes
#else
#define DIG_SERVICE_RATE 10
#define DEFAULT_DSR 200 // DMA buffer-polling rate = 200 Hz
#define DIG_HARDWARE_SAMPLE_RATE 11
#define DEFAULT_DHSR NOM_VAL // Use nominal sample rate by default
#define DIG_DMA_RESERVE 12
#define DEFAULT_DDR 32768 // Reserve 32K real-mode mem for DMA
#define DIG_LATENCY 13
#define DEFAULT_DL 100 // Half-buffer size in ms = 100
#define DIG_USE_STEREO 14
#define DEFAULT_DUS NO // Use mono output only
#define DIG_USE_16_BITS 15
#define DEFAULT_DU16 NO // Use 8-bit output by default
#define DIG_ALLOW_16_BIT_DMA 16
#define DEFAULT_DA16DMA YES // OK to use 16-bit DMA if necessary
#define DIG_SS_LOCK 17
#define DEFAULT_DSL NO // Don't disable IRQs while mixing
#define AIL_SCAN_FOR_HARDWARE 18
#define DEFAULT_ASH YES // Scan for I/O settings if necessary
#define AIL_ALLOW_VDM_EXECUTION 19
#define DEFAULT_AVE YES // Allow Windows "DOS box" execution
#endif
// ----------------------------------
// DLS Preference names and default values
// Unless otherwise specified, values must be established
// BEFORE calling DLSMSSOpen()!
// ----------------------------------
#define DLS_TIMEBASE 20
#define DEFAULT_DTB 120 // 120 intervals/second by default
#define DLS_VOICE_LIMIT 21
#define DEFAULT_DVL 24 // 24 voices supported
#define DLS_BANK_SELECT_ALIAS 22
#define DEFAULT_DBSA NO // Do not treat controller 114 as bank
#define DLS_STREAM_BOOTSTRAP 23 // Don't submit first stream buffer
#define DEFAULT_DSB YES // until at least 2 available
#define DLS_VOLUME_BOOST 24
#define DEFAULT_DVB 0 // Boost final volume by 0 dB
#define DLS_ENABLE_FILTERING 25 // Filtering = on by default
#define DEFAULT_DEF YES // (may be changed at any time)
#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present
#define DEFAULT_AEMS YES // (may be changed at any time)
#define DLS_GM_PASSTHROUGH 28 // Pass unrecognized traffic on to
#define DEFAULT_DGP YES // default GM driver layer
// (may be changed at any time)
#define DLS_ADPCM_TO_ASI_THRESHOLD 39 // Size in samples to switch to ASI
#define DEFAULT_DATAT 32768
#ifdef OLD_DLS_REVERB_PREFERENCES
// these preferences are obsolete - move to the new DLS reverb function.
// these defines now control nothing and will disappear completely
// in MSS 6.0
#define DLS_ENABLE_GLOBAL_REVERB 26 // Global reverb disabled by default
#define DEFAULT_DEGR NO
#define DLS_GLOBAL_REVERB_LEVEL 29 // Reverb level 0-127
#define DEFAULT_GRL 20 // (may be changed at any time)
#define DLS_GLOBAL_REVERB_TIME 30 // Reverb time in stream buffers
#define DEFAULT_GRT 1
#endif
//
// Add'l platform-independent prefs
//
#define DIG_REVERB_BUFFER_SIZE 40
#define DEFAULT_DRBS 0 // No reverb support by default
#define DIG_INPUT_LATENCY 41 // Use >= 250-millisecond input buffers if
#define DEFAULT_DIL 250 // explicit size request cannot be satisfied
#define DIG_USE_WAVEIN 43
#define DEFAULT_DUWI YES // Use waveIn for input by default
#define N_PREFS 44 // # of preference types
typedef struct _AILSOUNDINFO {
S32 format;
void FAR* data_ptr;
U32 data_len;
U32 rate;
S32 bits;
S32 channels;
U32 samples;
U32 block_size;
void FAR* initial_ptr;
} AILSOUNDINFO;
// for multi-processor machines
#ifdef IS_WIN32
#ifdef BUILD_MSS
#define MSSLockedIncrement(var) _asm { lock inc [var] }
#define MSSLockedDecrement(var) _asm { lock dec [var] }
static void __MSSLockedIncrementAddr(void * addr)
{
_asm {
mov eax,[addr]
lock inc dword ptr [eax]
}
}
static void __MSSLockedDecrementAddr(void * addr)
{
_asm {
mov eax,[addr]
lock dec dword ptr [eax]
}
}
#define MSSLockedIncrementPtr(var) __MSSLockedIncrementAddr(&(var))
#define MSSLockedDecrementPtr(var) __MSSLockedDecrementAddr(&(var))
#else
#define MSSLockedIncrement(var) (++var)
#define MSSLockedDecrement(var) (--var)
#define MSSLockedIncrementPtr(var) (++var)
#define MSSLockedDecrementPtr(var) (--var)
#endif
#else
#define MSSLockedIncrement(var) (++var)
#define MSSLockedDecrement(var) (--var)
#define MSSLockedIncrementPtr(var) (++var)
#define MSSLockedDecrementPtr(var) (--var)
#endif
#ifndef RIB_H // RIB.H contents included if RIB.H not already included
// #include "rib.h"
#define RIB_H
#define ARY_CNT(x) (sizeof((x)) / sizeof((x)[0]))
// ----------------------------------
// RIB data types
// ----------------------------------
typedef S32 RIBRESULT;
#define RIB_NOERR 0 // Success -- no error
#define RIB_NOT_ALL_AVAILABLE 1 // Some requested functions/attribs not available
#define RIB_NOT_FOUND 2 // Resource not found
#define RIB_OUT_OF_MEM 3 // Out of system RAM
//
// Handle to interface provider
//
typedef U32 HPROVIDER;
//
// Handle representing token used to obtain attribute or preference
// data from RIB provider
//
typedef U32 HATTRIB;
//
// Handle representing an enumerated interface entry
//
// RIB_enumerate_interface() returns 1 if valid next entry found, else
// 0 if end of list reached
//
typedef U32 HINTENUM;
#define HINTENUM_FIRST 0
//
// Handle representing an enumerated provider entry
//
// RIB_enumerate_providers() returns 1 if valid next entry found, else
// 0 if end of list reached
//
typedef U32 HPROENUM;
#define HPROENUM_FIRST 0
//
// Data types for RIB attributes and preferences
//
typedef enum
{
RIB_NONE = 0, // No type
RIB_CUSTOM, // Used for pointers to application-specific structures
RIB_DEC, // Used for 32-bit integer values to be reported in decimal
RIB_HEX, // Used for 32-bit integer values to be reported in hex
RIB_FLOAT, // Used for 32-bit single-precision FP values
RIB_PERCENT, // Used for 32-bit single-precision FP values to be reported as percentages
RIB_BOOL, // Used for Boolean-constrained integer values to be reported as TRUE or FALSE
RIB_STRING // Used for pointers to null-terminated ASCII strings
}
RIB_DATA_SUBTYPE;
//
// RIB_ENTRY_TYPE structure, used to register an interface or request one
//
typedef enum
{
RIB_FUNCTION = 0,
RIB_ATTRIBUTE, // Attribute: read-only data type used for status/info communication
RIB_PREFERENCE // Preference: read/write data type used to control behavior
}
RIB_ENTRY_TYPE;
//
// RIB_INTERFACE_ENTRY, used to represent a function or data entry in an
// interface
//
typedef struct
{
RIB_ENTRY_TYPE type; // See list above
C8 FAR *entry_name; // Name of desired function or attribute
U32 token; // Function pointer or attribute token
RIB_DATA_SUBTYPE subtype; // Data (attrib or preference) subtype
}
RIB_INTERFACE_ENTRY;
//
// Standard RAD Interface Broker provider identification attributes
//
#define PROVIDER_NAME (-100) // RIB_STRING name of decoder
#define PROVIDER_VERSION (-101) // RIB_HEX BCD version number
//
// Standard function to obtain provider attributes (see PROVIDER_ defines
// above)
//
// Each provider of a searchable interface must export this function
//
typedef U32 (AILCALL FAR *PROVIDER_QUERY_ATTRIBUTE) (HATTRIB index);
//
// Macros to simplify interface registrations/requests for functions,
// attributes, and preferences
//
#define FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE }
#define REG_FN(entry_name) { RIB_FUNCTION, #entry_name, (U32) &(entry_name), RIB_NONE }
#define AT(entry_name,ID) { RIB_ATTRIBUTE, (entry_name), (U32) &(ID), RIB_NONE }
#define REG_AT(entry_name,ID,subtype) { RIB_ATTRIBUTE, (entry_name), (U32) (ID), subtype }
#define PR(entry_name,ID) { RIB_PREFERENCE, (entry_name), (U32) &(ID), RIB_NONE }
#define REG_PR(entry_name,ID,subtype) { RIB_PREFERENCE, (entry_name), (U32) (ID), subtype }
#define RIB_register(x,y,z) RIB_register_interface (HPROVIDER(x), y, ARY_CNT(z), z)
#define RIB_unregister(x,y,z) RIB_unregister_interface(HPROVIDER(x), y, ARY_CNT(z), z)
#define RIB_unregister_all(x) RIB_unregister_interface(HPROVIDER(x), NULL, 0, NULL)
#define RIB_free_libraries() RIB_free_provider_library(HPROVIDER(NULL));
#define RIB_request(x,y,z) RIB_request_interface (x, y, ARY_CNT(z), z)
// ----------------------------------
// Standard RIB API prototypes
// ----------------------------------
DXDEC HPROVIDER AILCALL RIB_alloc_provider_handle (U32 module);
DXDEC void AILCALL RIB_free_provider_handle (HPROVIDER provider);
DXDEC HPROVIDER AILCALL RIB_load_provider_library (C8 FAR *filename);
DXDEC void AILCALL RIB_free_provider_library (HPROVIDER provider);
DXDEC HPROVIDER AILCALL RIB_provider_library_handle (void);
DXDEC RIBRESULT AILCALL RIB_register_interface (HPROVIDER provider,
C8 FAR *interface_name,
S32 entry_count,
const RIB_INTERFACE_ENTRY FAR *rlist);
DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider,
C8 FAR *interface_name,
S32 entry_count,
const RIB_INTERFACE_ENTRY FAR *rlist);
DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider,
C8 FAR *interface_name,
S32 entry_count,
RIB_INTERFACE_ENTRY FAR *rlist);
DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider,
C8 FAR *interface_name,
RIB_ENTRY_TYPE entry_type,
C8 FAR *entry_name,
U32 FAR *token);
DXDEC S32 AILCALL RIB_enumerate_interface (HPROVIDER provider,
C8 FAR *interface_name,
RIB_ENTRY_TYPE type,
HINTENUM FAR *next,
RIB_INTERFACE_ENTRY FAR *dest);
DXDEC S32 AILCALL RIB_enumerate_providers (C8 FAR *interface_name,
HPROENUM FAR *next,
HPROVIDER FAR *dest);
DXDEC C8 FAR * AILCALL RIB_type_string (U32 data,
RIB_DATA_SUBTYPE subtype);
DXDEC HPROVIDER AILCALL RIB_find_file_provider (C8 FAR *interface_name,
C8 FAR *attribute_name,
C8 FAR *file_suffix);
DXDEC HPROVIDER AILCALL RIB_find_provider (C8 FAR *interface_name,
C8 FAR *attribute_name,
C8 FAR *attribute_value);
DXDEC S32 AILCALL RIB_load_application_providers
(C8 FAR *filespec);
DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider,