summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eax/eax-util.cpp706
-rw-r--r--eax/eax-util.h765
-rw-r--r--eax/eax.h535
-rw-r--r--milessdk/include/mss.h4805
-rw-r--r--milessdk/lib/mss32.libbin0 -> 246322 bytes
-rw-r--r--premake5.lua5
-rw-r--r--src/audio/AudioManager.cpp308
-rw-r--r--src/audio/AudioManager.h34
-rw-r--r--src/audio/AudioSamples.h8
-rw-r--r--src/audio/MusicManager.cpp6
-rw-r--r--src/audio/MusicManager.h13
-rw-r--r--src/audio/SampleManager.cpp176
-rw-r--r--src/audio/SampleManager.h68
-rw-r--r--src/audio/sampman.cpp2331
-rw-r--r--src/audio/sampman.h334
-rw-r--r--src/core/Timer.h1
-rw-r--r--src/core/common.h1
-rw-r--r--src/core/config.h2
-rw-r--r--src/skel/win/gta3.icobin0 -> 2238 bytes
19 files changed, 9692 insertions, 406 deletions
diff --git a/eax/eax-util.cpp b/eax/eax-util.cpp
new file mode 100644
index 00000000..44425957
--- /dev/null
+++ b/eax/eax-util.cpp
@@ -0,0 +1,706 @@
+/***********************************************************************************************\
+* *
+* EAX-UTIL.CPP - utilities for EAX 3.0 *
+* Function declaration for EAX Morphing *
+* String names of the all the presets defined in eax-util.h *
+* Arrays grouping together all the EAX presets in a scenario *
+* *
+************************************************************************************************/
+
+#include "eax-util.h"
+#include <math.h>
+
+// Function prototypes used by EAX3ListenerInterpolate
+void Clamp(EAXVECTOR *eaxVector);
+bool CheckEAX3LP(LPEAXLISTENERPROPERTIES lpEAX3LP);
+
+
+/***********************************************************************************************\
+*
+* Definition of the EAXMorph function - EAX3ListenerInterpolate
+*
+\***********************************************************************************************/
+
+/*
+ EAX3ListenerInterpolate
+ lpStart - Initial EAX 3 Listener parameters
+ lpFinish - Final EAX 3 Listener parameters
+ flRatio - Ratio Destination : Source (0.0 == Source, 1.0 == Destination)
+ lpResult - Interpolated EAX 3 Listener parameters
+ bCheckValues - Check EAX 3.0 parameters are in range, default = false (no checking)
+*/
+bool EAX3ListenerInterpolate(LPEAXLISTENERPROPERTIES lpStart, LPEAXLISTENERPROPERTIES lpFinish,
+ float flRatio, LPEAXLISTENERPROPERTIES lpResult, bool bCheckValues)
+{
+ EAXVECTOR StartVector, FinalVector;
+
+ float flInvRatio;
+
+ if (bCheckValues)
+ {
+ if (!CheckEAX3LP(lpStart))
+ return false;
+
+ if (!CheckEAX3LP(lpFinish))
+ return false;
+ }
+
+ if (flRatio >= 1.0f)
+ {
+ memcpy(lpResult, lpFinish, sizeof(EAXLISTENERPROPERTIES));
+ return true;
+ }
+ else if (flRatio <= 0.0f)
+ {
+ memcpy(lpResult, lpStart, sizeof(EAXLISTENERPROPERTIES));
+ return true;
+ }
+
+ flInvRatio = (1.0f - flRatio);
+
+ // Environment
+ lpResult->ulEnvironment = 26; // (UNDEFINED environment)
+
+ // Environment Size
+ if (lpStart->flEnvironmentSize == lpFinish->flEnvironmentSize)
+ lpResult->flEnvironmentSize = lpStart->flEnvironmentSize;
+ else
+ lpResult->flEnvironmentSize = (float)exp( (log(lpStart->flEnvironmentSize) * flInvRatio) + (log(lpFinish->flEnvironmentSize) * flRatio) );
+
+ // Environment Diffusion
+ if (lpStart->flEnvironmentDiffusion == lpFinish->flEnvironmentDiffusion)
+ lpResult->flEnvironmentDiffusion = lpStart->flEnvironmentDiffusion;
+ else
+ lpResult->flEnvironmentDiffusion = (lpStart->flEnvironmentDiffusion * flInvRatio) + (lpFinish->flEnvironmentDiffusion * flRatio);
+
+ // Room
+ if (lpStart->lRoom == lpFinish->lRoom)
+ lpResult->lRoom = lpStart->lRoom;
+ else
+ lpResult->lRoom = (int)( ((float)lpStart->lRoom * flInvRatio) + ((float)lpFinish->lRoom * flRatio) );
+
+ // Room HF
+ if (lpStart->lRoomHF == lpFinish->lRoomHF)
+ lpResult->lRoomHF = lpStart->lRoomHF;
+ else
+ lpResult->lRoomHF = (int)( ((float)lpStart->lRoomHF * flInvRatio) + ((float)lpFinish->lRoomHF * flRatio) );
+
+ // Room LF
+ if (lpStart->lRoomLF == lpFinish->lRoomLF)
+ lpResult->lRoomLF = lpStart->lRoomLF;
+ else
+ lpResult->lRoomLF = (int)( ((float)lpStart->lRoomLF * flInvRatio) + ((float)lpFinish->lRoomLF * flRatio) );
+
+ // Decay Time
+ if (lpStart->flDecayTime == lpFinish->flDecayTime)
+ lpResult->flDecayTime = lpStart->flDecayTime;
+ else
+ lpResult->flDecayTime = (float)exp( (log(lpStart->flDecayTime) * flInvRatio) + (log(lpFinish->flDecayTime) * flRatio) );
+
+ // Decay HF Ratio
+ if (lpStart->flDecayHFRatio == lpFinish->flDecayHFRatio)
+ lpResult->flDecayHFRatio = lpStart->flDecayHFRatio;
+ else
+ lpResult->flDecayHFRatio = (float)exp( (log(lpStart->flDecayHFRatio) * flInvRatio) + (log(lpFinish->flDecayHFRatio) * flRatio) );
+
+ // Decay LF Ratio
+ if (lpStart->flDecayLFRatio == lpFinish->flDecayLFRatio)
+ lpResult->flDecayLFRatio = lpStart->flDecayLFRatio;
+ else
+ lpResult->flDecayLFRatio = (float)exp( (log(lpStart->flDecayLFRatio) * flInvRatio) + (log(lpFinish->flDecayLFRatio) * flRatio) );
+
+ // Reflections
+ if (lpStart->lReflections == lpFinish->lReflections)
+ lpResult->lReflections = lpStart->lReflections;
+ else
+ lpResult->lReflections = (int)( ((float)lpStart->lReflections * flInvRatio) + ((float)lpFinish->lReflections * flRatio) );
+
+ // Reflections Delay
+ if (lpStart->flReflectionsDelay == lpFinish->flReflectionsDelay)
+ lpResult->flReflectionsDelay = lpStart->flReflectionsDelay;
+ else
+ lpResult->flReflectionsDelay = (float)exp( (log(lpStart->flReflectionsDelay+0.0001) * flInvRatio) + (log(lpFinish->flReflectionsDelay+0.0001) * flRatio) );
+
+ // Reflections Pan
+
+ // To interpolate the vector correctly we need to ensure that both the initial and final vectors vectors are clamped to a length of 1.0f
+ StartVector = lpStart->vReflectionsPan;
+ FinalVector = lpFinish->vReflectionsPan;
+
+ Clamp(&StartVector);
+ Clamp(&FinalVector);
+
+ if (lpStart->vReflectionsPan.x == lpFinish->vReflectionsPan.x)
+ lpResult->vReflectionsPan.x = lpStart->vReflectionsPan.x;
+ else
+ lpResult->vReflectionsPan.x = FinalVector.x + (flInvRatio * (StartVector.x - FinalVector.x));
+
+ if (lpStart->vReflectionsPan.y == lpFinish->vReflectionsPan.y)
+ lpResult->vReflectionsPan.y = lpStart->vReflectionsPan.y;
+ else
+ lpResult->vReflectionsPan.y = FinalVector.y + (flInvRatio * (StartVector.y - FinalVector.y));
+
+ if (lpStart->vReflectionsPan.z == lpFinish->vReflectionsPan.z)
+ lpResult->vReflectionsPan.z = lpStart->vReflectionsPan.z;
+ else
+ lpResult->vReflectionsPan.z = FinalVector.z + (flInvRatio * (StartVector.z - FinalVector.z));
+
+ // Reverb
+ if (lpStart->lReverb == lpFinish->lReverb)
+ lpResult->lReverb = lpStart->lReverb;
+ else
+ lpResult->lReverb = (int)( ((float)lpStart->lReverb * flInvRatio) + ((float)lpFinish->lReverb * flRatio) );
+
+ // Reverb Delay
+ if (lpStart->flReverbDelay == lpFinish->flReverbDelay)
+ lpResult->flReverbDelay = lpStart->flReverbDelay;
+ else
+ lpResult->flReverbDelay = (float)exp( (log(lpStart->flReverbDelay+0.0001) * flInvRatio) + (log(lpFinish->flReverbDelay+0.0001) * flRatio) );
+
+ // Reverb Pan
+
+ // To interpolate the vector correctly we need to ensure that both the initial and final vectors are clamped to a length of 1.0f
+ StartVector = lpStart->vReverbPan;
+ FinalVector = lpFinish->vReverbPan;
+
+ Clamp(&StartVector);
+ Clamp(&FinalVector);
+
+ if (lpStart->vReverbPan.x == lpFinish->vReverbPan.x)
+ lpResult->vReverbPan.x = lpStart->vReverbPan.x;
+ else
+ lpResult->vReverbPan.x = FinalVector.x + (flInvRatio * (StartVector.x - FinalVector.x));
+
+ if (lpStart->vReverbPan.y == lpFinish->vReverbPan.y)
+ lpResult->vReverbPan.y = lpStart->vReverbPan.y;
+ else
+ lpResult->vReverbPan.y = FinalVector.y + (flInvRatio * (StartVector.y - FinalVector.y));
+
+ if (lpStart->vReverbPan.z == lpFinish->vReverbPan.z)
+ lpResult->vReverbPan.z = lpStart->vReverbPan.z;
+ else
+ lpResult->vReverbPan.z = FinalVector.z + (flInvRatio * (StartVector.z - FinalVector.z));
+
+ // Echo Time
+ if (lpStart->flEchoTime == lpFinish->flEchoTime)
+ lpResult->flEchoTime = lpStart->flEchoTime;
+ else
+ lpResult->flEchoTime = (float)exp( (log(lpStart->flEchoTime) * flInvRatio) + (log(lpFinish->flEchoTime) * flRatio) );
+
+ // Echo Depth
+ if (lpStart->flEchoDepth == lpFinish->flEchoDepth)
+ lpResult->flEchoDepth = lpStart->flEchoDepth;
+ else
+ lpResult->flEchoDepth = (lpStart->flEchoDepth * flInvRatio) + (lpFinish->flEchoDepth * flRatio);
+
+ // Modulation Time
+ if (lpStart->flModulationTime == lpFinish->flModulationTime)
+ lpResult->flModulationTime = lpStart->flModulationTime;
+ else
+ lpResult->flModulationTime = (float)exp( (log(lpStart->flModulationTime) * flInvRatio) + (log(lpFinish->flModulationTime) * flRatio) );
+
+ // Modulation Depth
+ if (lpStart->flModulationDepth == lpFinish->flModulationDepth)
+ lpResult->flModulationDepth = lpStart->flModulationDepth;
+ else
+ lpResult->flModulationDepth = (lpStart->flModulationDepth * flInvRatio) + (lpFinish->flModulationDepth * flRatio);
+
+ // Air Absorption HF
+ if (lpStart->flAirAbsorptionHF == lpFinish->flAirAbsorptionHF)
+ lpResult->flAirAbsorptionHF = lpStart->flAirAbsorptionHF;
+ else
+ lpResult->flAirAbsorptionHF = (lpStart->flAirAbsorptionHF * flInvRatio) + (lpFinish->flAirAbsorptionHF * flRatio);
+
+ // HF Reference
+ if (lpStart->flHFReference == lpFinish->flHFReference)
+ lpResult->flHFReference = lpStart->flHFReference;
+ else
+ lpResult->flHFReference = (float)exp( (log(lpStart->flHFReference) * flInvRatio) + (log(lpFinish->flHFReference) * flRatio) );
+
+ // LF Reference
+ if (lpStart->flLFReference == lpFinish->flLFReference)
+ lpResult->flLFReference = lpStart->flLFReference;
+ else
+ lpResult->flLFReference = (float)exp( (log(lpStart->flLFReference) * flInvRatio) + (log(lpFinish->flLFReference) * flRatio) );
+
+ // Room Rolloff Factor
+ if (lpStart->flRoomRolloffFactor == lpFinish->flRoomRolloffFactor)
+ lpResult->flRoomRolloffFactor = lpStart->flRoomRolloffFactor;
+ else
+ lpResult->flRoomRolloffFactor = (lpStart->flRoomRolloffFactor * flInvRatio) + (lpFinish->flRoomRolloffFactor * flRatio);
+
+ // Flags
+ lpResult->ulFlags = (lpStart->ulFlags & lpFinish->ulFlags);
+
+ // Clamp Delays
+ if (lpResult->flReflectionsDelay > EAXLISTENER_MAXREFLECTIONSDELAY)
+ lpResult->flReflectionsDelay = EAXLISTENER_MAXREFLECTIONSDELAY;
+
+ if (lpResult->flReverbDelay > EAXLISTENER_MAXREVERBDELAY)
+ lpResult->flReverbDelay = EAXLISTENER_MAXREVERBDELAY;
+
+ return true;
+}
+
+
+/*
+ CheckEAX3LP
+ Checks that the parameters in the EAX 3 Listener Properties structure are in-range
+*/
+bool CheckEAX3LP(LPEAXLISTENERPROPERTIES lpEAX3LP)
+{
+ if ( (lpEAX3LP->lRoom < EAXLISTENER_MINROOM) || (lpEAX3LP->lRoom > EAXLISTENER_MAXROOM) )
+ return false;
+
+ if ( (lpEAX3LP->lRoomHF < EAXLISTENER_MINROOMHF) || (lpEAX3LP->lRoomHF > EAXLISTENER_MAXROOMHF) )
+ return false;
+
+ if ( (lpEAX3LP->lRoomLF < EAXLISTENER_MINROOMLF) || (lpEAX3LP->lRoomLF > EAXLISTENER_MAXROOMLF) )
+ return false;
+
+ if ( (lpEAX3LP->ulEnvironment < EAXLISTENER_MINENVIRONMENT) || (lpEAX3LP->ulEnvironment > EAXLISTENER_MAXENVIRONMENT) )
+ return false;
+
+ if ( (lpEAX3LP->flEnvironmentSize < EAXLISTENER_MINENVIRONMENTSIZE) || (lpEAX3LP->flEnvironmentSize > EAXLISTENER_MAXENVIRONMENTSIZE) )
+ return false;
+
+ if ( (lpEAX3LP->flEnvironmentDiffusion < EAXLISTENER_MINENVIRONMENTDIFFUSION) || (lpEAX3LP->flEnvironmentDiffusion > EAXLISTENER_MAXENVIRONMENTDIFFUSION) )
+ return false;
+
+ if ( (lpEAX3LP->flDecayTime < EAXLISTENER_MINDECAYTIME) || (lpEAX3LP->flDecayTime > EAXLISTENER_MAXDECAYTIME) )
+ return false;
+
+ if ( (lpEAX3LP->flDecayHFRatio < EAXLISTENER_MINDECAYHFRATIO) || (lpEAX3LP->flDecayHFRatio > EAXLISTENER_MAXDECAYHFRATIO) )
+ return false;
+
+ if ( (lpEAX3LP->flDecayLFRatio < EAXLISTENER_MINDECAYLFRATIO) || (lpEAX3LP->flDecayLFRatio > EAXLISTENER_MAXDECAYLFRATIO) )
+ return false;
+
+ if ( (lpEAX3LP->lReflections < EAXLISTENER_MINREFLECTIONS) || (lpEAX3LP->lReflections > EAXLISTENER_MAXREFLECTIONS) )
+ return false;
+
+ if ( (lpEAX3LP->flReflectionsDelay < EAXLISTENER_MINREFLECTIONSDELAY) || (lpEAX3LP->flReflectionsDelay > EAXLISTENER_MAXREFLECTIONSDELAY) )
+ return false;
+
+ if ( (lpEAX3LP->lReverb < EAXLISTENER_MINREVERB) || (lpEAX3LP->lReverb > EAXLISTENER_MAXREVERB) )
+ return false;
+
+ if ( (lpEAX3LP->flReverbDelay < EAXLISTENER_MINREVERBDELAY) || (lpEAX3LP->flReverbDelay > EAXLISTENER_MAXREVERBDELAY) )
+ return false;
+
+ if ( (lpEAX3LP->flEchoTime < EAXLISTENER_MINECHOTIME) || (lpEAX3LP->flEchoTime > EAXLISTENER_MAXECHOTIME) )
+ return false;
+
+ if ( (lpEAX3LP->flEchoDepth < EAXLISTENER_MINECHODEPTH) || (lpEAX3LP->flEchoDepth > EAXLISTENER_MAXECHODEPTH) )
+ return false;
+
+ if ( (lpEAX3LP->flModulationTime < EAXLISTENER_MINMODULATIONTIME) || (lpEAX3LP->flModulationTime > EAXLISTENER_MAXMODULATIONTIME) )
+ return false;
+
+ if ( (lpEAX3LP->flModulationDepth < EAXLISTENER_MINMODULATIONDEPTH) || (lpEAX3LP->flModulationDepth > EAXLISTENER_MAXMODULATIONDEPTH) )
+ return false;
+
+ if ( (lpEAX3LP->flAirAbsorptionHF < EAXLISTENER_MINAIRABSORPTIONHF) || (lpEAX3LP->flAirAbsorptionHF > EAXLISTENER_MAXAIRABSORPTIONHF) )
+ return false;
+
+ if ( (lpEAX3LP->flHFReference < EAXLISTENER_MINHFREFERENCE) || (lpEAX3LP->flHFReference > EAXLISTENER_MAXHFREFERENCE) )
+ return false;
+
+ if ( (lpEAX3LP->flLFReference < EAXLISTENER_MINLFREFERENCE) || (lpEAX3LP->flLFReference > EAXLISTENER_MAXLFREFERENCE) )
+ return false;
+
+ if ( (lpEAX3LP->flRoomRolloffFactor < EAXLISTENER_MINROOMROLLOFFFACTOR) || (lpEAX3LP->flRoomRolloffFactor > EAXLISTENER_MAXROOMROLLOFFFACTOR) )
+ return false;
+
+ if (lpEAX3LP->ulFlags & EAXLISTENERFLAGS_RESERVED)
+ return false;
+
+ return true;
+}
+
+/*
+ Clamp
+ Clamps the length of the vector to 1.0f
+*/
+void Clamp(EAXVECTOR *eaxVector)
+{
+ float flMagnitude;
+ float flInvMagnitude;
+
+ flMagnitude = (float)sqrt((eaxVector->x*eaxVector->x) + (eaxVector->y*eaxVector->y) + (eaxVector->z*eaxVector->z));
+
+ if (flMagnitude <= 1.0f)
+ return;
+
+ flInvMagnitude = 1.0f / flMagnitude;
+
+ eaxVector->x *= flInvMagnitude;
+ eaxVector->y *= flInvMagnitude;
+ eaxVector->z *= flInvMagnitude;
+}
+
+
+/***********************************************************************************************\
+*
+* To assist those developers wishing to add EAX effects to their level editors, each of the
+
+* List of string names of the various EAX 3.0 presets defined in eax-util.h
+* Arrays to group together presets of the same scenario
+*
+\***********************************************************************************************/
+
+
+//////////////////////////////////////////////////////
+// Array of scenario names //
+//////////////////////////////////////////////////////
+
+char* EAX30_SCENARIO_NAMES[] =
+{
+ "Castle",
+ "Factory",
+ "IcePalace",
+ "SpaceStation",
+ "WoodenShip",
+ "Sports",
+ "Prefab",
+ "Domes and Pipes",
+ "Outdoors",
+ "Mood",
+ "Driving",
+ "City",
+ "Miscellaneous",
+ "Original"
+};
+
+//////////////////////////////////////////////////////
+// Array of standardised location names //
+//////////////////////////////////////////////////////
+
+char* EAX30_LOCATION_NAMES[] =
+{
+ "Hall",
+ "Large Room",
+ "Medium Room",
+ "Small Room",
+ "Cupboard",
+ "Alcove",
+ "Long Passage",
+ "Short Passage",
+ "Courtyard"
+};
+
+//////////////////////////////////////////////////////
+// Standardised Location effects can be accessed //
+// from a matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_STANDARD_PRESETS[EAX30_NUM_STANDARD_SCENARIOS][EAX30_NUM_LOCATIONS]=
+{
+ {EAX30_PRESET_CASTLE_HALL, EAX30_PRESET_CASTLE_LARGEROOM, EAX30_PRESET_CASTLE_MEDIUMROOM, EAX30_PRESET_CASTLE_SMALLROOM, EAX30_PRESET_CASTLE_CUPBOARD, EAX30_PRESET_CASTLE_ALCOVE, EAX30_PRESET_CASTLE_LONGPASSAGE, EAX30_PRESET_CASTLE_SHORTPASSAGE, EAX30_PRESET_CASTLE_COURTYARD},
+ {EAX30_PRESET_FACTORY_HALL, EAX30_PRESET_FACTORY_LARGEROOM, EAX30_PRESET_FACTORY_MEDIUMROOM, EAX30_PRESET_FACTORY_SMALLROOM, EAX30_PRESET_FACTORY_CUPBOARD, EAX30_PRESET_FACTORY_ALCOVE, EAX30_PRESET_FACTORY_LONGPASSAGE, EAX30_PRESET_FACTORY_SHORTPASSAGE, EAX30_PRESET_FACTORY_COURTYARD},
+ {EAX30_PRESET_ICEPALACE_HALL, EAX30_PRESET_ICEPALACE_LARGEROOM, EAX30_PRESET_ICEPALACE_MEDIUMROOM, EAX30_PRESET_ICEPALACE_SMALLROOM, EAX30_PRESET_ICEPALACE_CUPBOARD, EAX30_PRESET_ICEPALACE_ALCOVE, EAX30_PRESET_ICEPALACE_LONGPASSAGE, EAX30_PRESET_ICEPALACE_SHORTPASSAGE, EAX30_PRESET_ICEPALACE_COURTYARD},
+ {EAX30_PRESET_SPACESTATION_HALL,EAX30_PRESET_SPACESTATION_LARGEROOM,EAX30_PRESET_SPACESTATION_MEDIUMROOM, EAX30_PRESET_SPACESTATION_SMALLROOM,EAX30_PRESET_SPACESTATION_CUPBOARD, EAX30_PRESET_SPACESTATION_ALCOVE, EAX30_PRESET_SPACESTATION_LONGPASSAGE, EAX30_PRESET_SPACESTATION_SHORTPASSAGE, EAX30_PRESET_SPACESTATION_HALL},
+ {EAX30_PRESET_WOODEN_HALL, EAX30_PRESET_WOODEN_LARGEROOM, EAX30_PRESET_WOODEN_MEDIUMROOM, EAX30_PRESET_WOODEN_SMALLROOM, EAX30_PRESET_WOODEN_CUPBOARD, EAX30_PRESET_WOODEN_ALCOVE, EAX30_PRESET_WOODEN_LONGPASSAGE, EAX30_PRESET_WOODEN_SHORTPASSAGE, EAX30_PRESET_WOODEN_COURTYARD},
+};
+
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of original environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_ORIGINAL_PRESET_NAMES[] =
+{
+ "Generic",
+ "Padded Cell",
+ "Room",
+ "Bathroom",
+ "Living Room",
+ "Stone Room",
+ "Auditorium",
+ "Concert Hall",
+ "Cave",
+ "Arena",
+ "Hangar",
+ "Carpetted Hallway",
+ "Hallway",
+ "Stone Corridor",
+ "Alley",
+ "Forest",
+ "City",
+ "Mountains",
+ "Quarry",
+ "Plain",
+ "Parking Lot",
+ "Sewer Pipe",
+ "Underwater",
+ "Drugged",
+ "Dizzy",
+ "Psychotic"
+};
+
+//////////////////////////////////////////////////////
+// Sports effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_ORIGINAL_PRESETS[] =
+{
+ EAX30_PRESET_GENERIC,
+ EAX30_PRESET_PADDEDCELL,
+ EAX30_PRESET_ROOM,
+ EAX30_PRESET_BATHROOM,
+ EAX30_PRESET_LIVINGROOM,
+ EAX30_PRESET_STONEROOM,
+ EAX30_PRESET_AUDITORIUM,
+ EAX30_PRESET_CONCERTHALL,
+ EAX30_PRESET_CAVE,
+ EAX30_PRESET_ARENA,
+ EAX30_PRESET_HANGAR,
+ EAX30_PRESET_CARPETTEDHALLWAY,
+ EAX30_PRESET_HALLWAY,
+ EAX30_PRESET_STONECORRIDOR,
+ EAX30_PRESET_ALLEY,
+ EAX30_PRESET_FOREST,
+ EAX30_PRESET_CITY,
+ EAX30_PRESET_MOUNTAINS,
+ EAX30_PRESET_QUARRY,
+ EAX30_PRESET_PLAIN,
+ EAX30_PRESET_PARKINGLOT,
+ EAX30_PRESET_SEWERPIPE,
+ EAX30_PRESET_UNDERWATER,
+ EAX30_PRESET_DRUGGED,
+ EAX30_PRESET_DIZZY,
+ EAX30_PRESET_PSYCHOTIC
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of sport environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_SPORTS_PRESET_NAMES[] =
+{
+ "Empty Stadium",
+ "Full Stadium",
+ "Stadium Tannoy",
+ "Squash Court",
+ "Small Swimming Pool",
+ "Large Swimming Pool",
+ "Gymnasium"
+};
+
+//////////////////////////////////////////////////////
+// Sports effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_SPORTS_PRESETS[] =
+{
+ EAX30_PRESET_SPORT_EMPTYSTADIUM,
+ EAX30_PRESET_SPORT_FULLSTADIUM,
+ EAX30_PRESET_SPORT_STADIUMTANNOY,
+ EAX30_PRESET_SPORT_SQUASHCOURT,
+ EAX30_PRESET_SPORT_SMALLSWIMMINGPOOL,
+ EAX30_PRESET_SPORT_LARGESWIMMINGPOOL,
+ EAX30_PRESET_SPORT_GYMNASIUM
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of prefab environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_PREFAB_PRESET_NAMES[] =
+{
+ "Workshop",
+ "School Room",
+ "Practise Room",
+ "Outhouse",
+ "Caravan"
+};
+
+//////////////////////////////////////////////////////
+// Prefab effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_PREFAB_PRESETS[] =
+{
+ EAX30_PRESET_PREFAB_WORKSHOP,
+ EAX30_PRESET_PREFAB_SCHOOLROOM,
+ EAX30_PRESET_PREFAB_PRACTISEROOM,
+ EAX30_PRESET_PREFAB_OUTHOUSE,
+ EAX30_PRESET_PREFAB_CARAVAN
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of Domes & Pipes environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_DOMESNPIPES_PRESET_NAMES[] =
+{
+ "Domed Tomb",
+ "Saint Paul's Dome",
+ "Small Pipe",
+ "Long Thin Pipe",
+ "Large Pipe",
+ "Resonant Pipe"
+};
+
+//////////////////////////////////////////////////////
+// Domes & Pipes effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_DOMESNPIPES_PRESETS[] =
+{
+ EAX30_PRESET_DOME_TOMB,
+ EAX30_PRESET_DOME_SAINTPAULS,
+ EAX30_PRESET_PIPE_SMALL,
+ EAX30_PRESET_PIPE_LONGTHIN,
+ EAX30_PRESET_PIPE_LARGE,
+ EAX30_PRESET_PIPE_RESONANT
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of Outdoors environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_OUTDOORS_PRESET_NAMES[] =
+{
+ "Backyard",
+ "Rolling Plains",
+ "Deep Canyon",
+ "Creek",
+ "Valley"
+};
+
+//////////////////////////////////////////////////////
+// Outdoors effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_OUTDOORS_PRESETS[] =
+{
+ EAX30_PRESET_OUTDOORS_BACKYARD,
+ EAX30_PRESET_OUTDOORS_ROLLINGPLAINS,
+ EAX30_PRESET_OUTDOORS_DEEPCANYON,
+ EAX30_PRESET_OUTDOORS_CREEK,
+ EAX30_PRESET_OUTDOORS_VALLEY
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of Mood environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_MOOD_PRESET_NAMES[] =
+{
+ "Heaven",
+ "Hell",
+ "Memory"
+};
+
+//////////////////////////////////////////////////////
+// Mood effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_MOOD_PRESETS[] =
+{
+ EAX30_PRESET_MOOD_HEAVEN,
+ EAX30_PRESET_MOOD_HELL,
+ EAX30_PRESET_MOOD_MEMORY
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of driving environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_DRIVING_PRESET_NAMES[] =
+{
+ "Race Commentator",
+ "Pit Garage",
+ "In-car (Stripped out racer)",
+ "In-car (Sportscar)",
+ "In-car (Luxury)",
+ "Full Grandstand",
+ "Empty Grandstand",
+ "Tunnel"
+};
+
+//////////////////////////////////////////////////////
+// Driving effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_DRIVING_PRESETS[] =
+{
+ EAX30_PRESET_DRIVING_COMMENTATOR,
+ EAX30_PRESET_DRIVING_PITGARAGE,
+ EAX30_PRESET_DRIVING_INCAR_RACER,
+ EAX30_PRESET_DRIVING_INCAR_SPORTS,
+ EAX30_PRESET_DRIVING_INCAR_LUXURY,
+ EAX30_PRESET_DRIVING_FULLGRANDSTAND,
+ EAX30_PRESET_DRIVING_EMPTYGRANDSTAND,
+ EAX30_PRESET_DRIVING_TUNNEL
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of City environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_CITY_PRESET_NAMES[] =
+{
+ "City Streets",
+ "Subway",
+ "Museum",
+ "Library",
+ "Underpass",
+ "Abandoned City"
+};
+
+//////////////////////////////////////////////////////
+// City effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_CITY_PRESETS[] =
+{
+ EAX30_PRESET_CITY_STREETS,
+ EAX30_PRESET_CITY_SUBWAY,
+ EAX30_PRESET_CITY_MUSEUM,
+ EAX30_PRESET_CITY_LIBRARY,
+ EAX30_PRESET_CITY_UNDERPASS,
+ EAX30_PRESET_CITY_ABANDONED
+};
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Array of Misc environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_MISC_PRESET_NAMES[] =
+{
+ "Dusty Box Room",
+ "Chapel",
+ "Small Water Room"
+};
+
+//////////////////////////////////////////////////////
+// Misc effects matrix //
+//////////////////////////////////////////////////////
+
+EAXLISTENERPROPERTIES EAX30_MISC_PRESETS[] =
+{
+ EAX30_PRESET_DUSTYROOM,
+ EAX30_PRESET_CHAPEL,
+ EAX30_PRESET_SMALLWATERROOM
+};
+
diff --git a/eax/eax-util.h b/eax/eax-util.h
new file mode 100644
index 00000000..204582aa
--- /dev/null
+++ b/eax/eax-util.h
@@ -0,0 +1,765 @@
+/*******************************************************************\
+* *
+* EAX-UTIL.H - utilities for Environmental Audio Extensions v. 3.0 *
+* Definitions of the Original 26 EAX Presets *
+* Definitions for some new EAX Presets *
+* Definitions of some Material Presets *
+* Function declaration for EAX Morphing *
+* *
+\*******************************************************************/
+
+#ifndef EAXUTIL_INCLUDED
+#define EAXUTIL_INCLUDED
+
+#include <eax.h>
+
+/***********************************************************************************************
+* Function : EAX3ListenerInterpolate
+* Params : lpStart - Initial EAX 3 Listener parameters
+* : lpFinish - Final EAX 3 Listener parameters
+* : flRatio - Ratio Destination : Source (0.0 == Source, 1.0 == Destination)
+* : lpResult - Interpolated EAX 3 Listener parameters
+* : bCheckValues - Check EAX 3.0 parameters are in range,
+ - default == false (no checking)
+************************************************************************************************/
+bool EAX3ListenerInterpolate(EAXLISTENERPROPERTIES *lpStartEAX3LP, EAXLISTENERPROPERTIES *lpFinishEAX3LP,
+ float flRatio, EAXLISTENERPROPERTIES *lpResultEAX3LP, bool bCheckValues = false);
+
+
+/***********************************************************************************************\
+*
+* Legacy environment presets for use with DSPROPERTY_EAXLISTENER_ALLPARAMETERS.
+* Each array conforms to the DSPROPSETID_EAX30_ListenerProperties structure defined in EAX.H.
+*
+************************************************************************************************/
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_GENERIC \
+ {0, 7.5f, 1.000f, -1000, -100, 0, 1.49f, 0.83f, 1.00f, -2602, 0.007f, 0.00f,0.00f,0.00f, 200, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_PADDEDCELL \
+ {1, 1.4f, 1.000f, -1000, -6000, 0, 0.17f, 0.10f, 1.00f, -1204, 0.001f, 0.00f,0.00f,0.00f, 207, 0.002f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_ROOM \
+ {2, 1.9f, 1.000f, -1000, -454, 0, 0.40f, 0.83f, 1.00f, -1646, 0.002f, 0.00f,0.00f,0.00f, 53, 0.003f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_BATHROOM \
+ {3, 1.4f, 1.000f, -1000, -1200, 0, 1.49f, 0.54f, 1.00f, -370, 0.007f, 0.00f,0.00f,0.00f, 1030, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_LIVINGROOM \
+ {4, 2.5f, 1.000f, -1000, -6000, 0, 0.50f, 0.10f, 1.00f, -1376, 0.003f, 0.00f,0.00f,0.00f, -1104, 0.004f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_STONEROOM \
+ {5, 11.6f, 1.000f, -1000, -300, 0, 2.31f, 0.64f, 1.00f, -711, 0.012f, 0.00f,0.00f,0.00f, 83, 0.017f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_AUDITORIUM \
+ {6, 21.6f, 1.000f, -1000, -476, 0, 4.32f, 0.59f, 1.00f, -789, 0.020f, 0.00f,0.00f,0.00f, -289, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_CONCERTHALL \
+ {7, 19.6f, 1.000f, -1000, -500, 0, 3.92f, 0.70f, 1.00f, -1230, 0.020f, 0.00f,0.00f,0.00f, -02, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_CAVE \
+ {8, 14.6f, 1.000f, -1000, 0, 0, 2.91f, 1.30f, 1.00f, -602, 0.015f, 0.00f,0.00f,0.00f, -302, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_ARENA \
+ {9, 36.2f, 1.000f, -1000, -698, 0, 7.24f, 0.33f, 1.00f, -1166, 0.020f, 0.00f,0.00f,0.00f, 16, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_HANGAR \
+ {10, 50.3f, 1.000f, -1000, -1000, 0, 10.05f, 0.23f, 1.00f, -602, 0.020f, 0.00f,0.00f,0.00f, 198, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_CARPETTEDHALLWAY \
+ {11, 1.9f, 1.000f, -1000, -4000, 0, 0.30f, 0.10f, 1.00f, -1831, 0.002f, 0.00f,0.00f,0.00f, -1630, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_HALLWAY \
+ {12, 1.8f, 1.000f, -1000, -300, 0, 1.49f, 0.59f, 1.00f, -1219, 0.007f, 0.00f,0.00f,0.00f, 441, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_STONECORRIDOR \
+ {13, 13.5f, 1.000f, -1000, -237, 0, 2.70f, 0.79f, 1.00f, -1214, 0.013f, 0.00f,0.00f,0.00f, 395, 0.020f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_ALLEY \
+ {14, 7.5f, 0.300f, -1000, -270, 0, 1.49f, 0.86f, 1.00f, -1204, 0.007f, 0.00f,0.00f,0.00f, -4, 0.011f, 0.00f,0.00f,0.00f, 0.125f, 0.950f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_FOREST \
+ {15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f,0.00f,0.00f, -229, 0.088f, 0.00f,0.00f,0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_CITY \
+ {16, 7.5f, 0.500f, -1000, -800, 0, 1.49f, 0.67f, 1.00f, -2273, 0.007f, 0.00f,0.00f,0.00f, -1691, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_MOUNTAINS \
+ {17, 100.0f, 0.270f, -1000, -2500, 0, 1.49f, 0.21f, 1.00f, -2780, 0.300f, 0.00f,0.00f,0.00f, -1434, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_QUARRY \
+ {18, 17.5f, 1.000f, -1000, -1000, 0, 1.49f, 0.83f, 1.00f, -10000, 0.061f, 0.00f,0.00f,0.00f, 500, 0.025f, 0.00f,0.00f,0.00f, 0.125f, 0.700f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_PLAIN \
+ {19, 42.5f, 0.210f, -1000, -2000, 0, 1.49f, 0.50f, 1.00f, -2466, 0.179f, 0.00f,0.00f,0.00f, -1926, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_PARKINGLOT \
+ {20, 8.3f, 1.000f, -1000, 0, 0, 1.65f, 1.50f, 1.00f, -1363, 0.008f, 0.00f,0.00f,0.00f, -1153, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_SEWERPIPE \
+ {21, 1.7f, 0.800f, -1000, -1000, 0, 2.81f, 0.14f, 1.00f, 429, 0.014f, 0.00f,0.00f,0.00f, 1023, 0.021f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_UNDERWATER \
+ {22, 1.8f, 1.000f, -1000, -4000, 0, 1.49f, 0.10f, 1.00f, -449, 0.007f, 0.00f,0.00f,0.00f, 1700, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 1.180f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_DRUGGED \
+ {23, 1.9f, 0.500f, -1000, 0, 0, 8.39f, 1.39f, 1.00f, -115, 0.002f, 0.00f,0.00f,0.00f, 985, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_DIZZY \
+ {24, 1.8f, 0.600f, -1000, -400, 0, 17.23f, 0.56f, 1.00f, -1713, 0.020f, 0.00f,0.00f,0.00f, -613, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.810f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_PSYCHOTIC \
+ {25, 1.0f, 0.500f, -1000, -151, 0, 7.56f, 0.91f, 1.00f, -626, 0.020f, 0.00f,0.00f,0.00f, 774, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 4.000f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+
+
+/***********************************************************************************************\
+*
+* New environment presets for use with DSPROPERTY_EAXLISTENER_ALLPARAMETERS.
+* Each array conforms to the DSPROPSETID_EAX30_ListenerProperties structure defined in EAX.H.
+*
+************************************************************************************************/
+
+// STANDARDISED-LOCATION SCENARIOS
+
+// CASTLE PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_CASTLE_SMALLROOM \
+ { 26, 8.3f, 0.890f, -1100, -800, -2000, 1.22f, 0.83f, 0.31f, -100, 0.022f, 0.00f,0.00f,0.00f, 0, 0.011f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_SHORTPASSAGE \
+ { 26, 8.3f, 0.890f, -1000, -1000, -2000, 2.32f, 0.83f, 0.31f, -100, 0.007f, 0.00f,0.00f,0.00f, -500, 0.023f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_MEDIUMROOM \
+ { 26, 8.3f, 0.930f, -1000, -1100, -2000, 2.04f, 0.83f, 0.46f, -300, 0.022f, 0.00f,0.00f,0.00f, -200, 0.011f, 0.00f,0.00f,0.00f, 0.155f, 0.030f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_LONGPASSAGE \
+ { 26, 8.3f, 0.890f, -1000, -800, -2000, 3.42f, 0.83f, 0.31f, -200, 0.007f, 0.00f,0.00f,0.00f, -600, 0.023f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_LARGEROOM \
+ { 26, 8.3f, 0.820f, -1000, -1100, -1800, 2.53f, 0.83f, 0.50f, -900, 0.034f, 0.00f,0.00f,0.00f, -400, 0.016f, 0.00f,0.00f,0.00f, 0.185f, 0.070f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_HALL \
+ { 26, 8.3f, 0.810f, -1000, -1100, -1500, 3.14f, 0.79f, 0.62f, -1300, 0.056f, 0.00f,0.00f,0.00f, -500, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_CUPBOARD \
+ { 26, 8.3f, 0.890f, -1000, -1100, -2000, 0.67f, 0.87f, 0.31f, 300, 0.010f, 0.00f,0.00f,0.00f, 300, 0.007f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_CASTLE_COURTYARD \
+ { 26, 8.3f, 0.420f, -1100, -700, -900, 2.13f, 0.61f, 0.23f, -2300, 0.112f, 0.00f,0.00f,0.00f, -1500, 0.036f, 0.00f,0.00f,0.00f, 0.250f, 0.370f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_CASTLE_ALCOVE \
+ { 26, 8.3f, 0.890f, -1000, -600, -2000, 1.64f, 0.87f, 0.31f, -100, 0.007f, 0.00f,0.00f,0.00f, -500, 0.034f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
+
+
+// FACTORY PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_FACTORY_ALCOVE \
+ { 26, 1.8f, 0.590f, -1200, -200, -600, 3.14f, 0.65f, 1.31f, 300, 0.010f, 0.00f,0.00f,0.00f, -1200, 0.038f, 0.00f,0.00f,0.00f, 0.114f, 0.100f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_SHORTPASSAGE \
+ { 26, 1.8f, 0.640f, -1200, -200, -600, 2.53f, 0.65f, 1.31f, 0, 0.010f, 0.00f,0.00f,0.00f, -600, 0.038f, 0.00f,0.00f,0.00f, 0.135f, 0.230f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_MEDIUMROOM \
+ { 26, 1.9f, 0.820f, -1200, -200, -600, 2.76f, 0.65f, 1.31f, -1100, 0.022f, 0.00f,0.00f,0.00f, -400, 0.023f, 0.00f,0.00f,0.00f, 0.174f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_LONGPASSAGE \
+ { 26, 1.8f, 0.640f, -1200, -200, -600, 4.06f, 0.65f, 1.31f, 0, 0.020f, 0.00f,0.00f,0.00f, -900, 0.037f, 0.00f,0.00f,0.00f, 0.135f, 0.230f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_LARGEROOM \
+ { 26, 1.9f, 0.750f, -1200, -300, -400, 4.24f, 0.51f, 1.31f, -1500, 0.039f, 0.00f,0.00f,0.00f, -600, 0.023f, 0.00f,0.00f,0.00f, 0.231f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_HALL \
+ { 26, 1.9f, 0.750f, -1000, -300, -400, 7.43f, 0.51f, 1.31f, -2400, 0.073f, 0.00f,0.00f,0.00f, -500, 0.027f, 0.00f,0.00f,0.00f, 0.250f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_CUPBOARD \
+ { 26, 1.7f, 0.630f, -1200, -200, -600, 0.49f, 0.65f, 1.31f, 200, 0.010f, 0.00f,0.00f,0.00f, 200, 0.032f, 0.00f,0.00f,0.00f, 0.107f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_COURTYARD \
+ { 26, 1.7f, 0.570f, -1000, -1000, -400, 2.32f, 0.29f, 0.56f, -2400, 0.090f, 0.00f,0.00f,0.00f, -2000, 0.039f, 0.00f,0.00f,0.00f, 0.250f, 0.290f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+#define EAX30_PRESET_FACTORY_SMALLROOM \
+ { 26, 1.8f, 0.820f, -1200, -200, -600, 1.72f, 0.65f, 1.31f, -300, 0.010f, 0.00f,0.00f,0.00f, -200, 0.024f, 0.00f,0.00f,0.00f, 0.119f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
+
+// ICE PALACE PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_ICEPALACE_ALCOVE \
+ { 26, 2.7f, 0.840f, -1000, -500, -1100, 2.76f, 1.46f, 0.28f, 100, 0.010f, 0.00f,0.00f,0.00f, -1200, 0.030f, 0.00f,0.00f,0.00f, 0.161f, 0.090f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_SHORTPASSAGE \
+ { 26, 2.7f, 0.750f, -1000, -500, -1100, 1.79f, 1.46f, 0.28f, -600, 0.010f, 0.00f,0.00f,0.00f, -700, 0.019f, 0.00f,0.00f,0.00f, 0.177f, 0.090f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_MEDIUMROOM \
+ { 26, 2.7f, 0.870f, -1000, -500, -700, 2.22f, 1.53f, 0.32f, -800, 0.039f, 0.00f,0.00f,0.00f, -1200, 0.027f, 0.00f,0.00f,0.00f, 0.186f, 0.120f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_LONGPASSAGE \
+ { 26, 2.7f, 0.770f, -1000, -500, -800, 3.01f, 1.46f, 0.28f, -200, 0.012f, 0.00f,0.00f,0.00f, -800, 0.025f, 0.00f,0.00f,0.00f, 0.186f, 0.040f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_LARGEROOM \
+ { 26, 2.9f, 0.810f, -1000, -500, -700, 3.14f, 1.53f, 0.32f, -1200, 0.039f, 0.00f,0.00f,0.00f, -1300, 0.027f, 0.00f,0.00f,0.00f, 0.214f, 0.110f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_HALL \
+ { 26, 2.9f, 0.760f, -1000, -700, -500, 5.49f, 1.53f, 0.38f, -1900, 0.054f, 0.00f,0.00f,0.00f, -1400, 0.052f, 0.00f,0.00f,0.00f, 0.226f, 0.110f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_CUPBOARD \
+ { 26, 2.7f, 0.830f, -1000, -600, -1300, 0.76f, 1.53f, 0.26f, 100, 0.012f, 0.00f,0.00f,0.00f, 100, 0.016f, 0.00f,0.00f,0.00f, 0.143f, 0.080f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_COURTYARD \
+ { 26, 2.9f, 0.590f, -1000, -1100, -1000, 2.04f, 1.20f, 0.38f, -2000, 0.073f, 0.00f,0.00f,0.00f, -2200, 0.043f, 0.00f,0.00f,0.00f, 0.235f, 0.480f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+#define EAX30_PRESET_ICEPALACE_SMALLROOM \
+ { 26, 2.7f, 0.840f, -1000, -500, -1100, 1.51f, 1.53f, 0.27f, -100, 0.010f, 0.00f,0.00f,0.00f, -900, 0.011f, 0.00f,0.00f,0.00f, 0.164f, 0.140f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
+
+// SPACE STATION PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_SPACESTATION_ALCOVE \
+ { 26, 1.5f, 0.780f, -1100, -300, -100, 1.16f, 0.81f, 0.55f, 300, 0.007f, 0.00f,0.00f,0.00f, -500, 0.018f, 0.00f,0.00f,0.00f, 0.192f, 0.210f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_MEDIUMROOM \
+ { 26, 1.5f, 0.750f, -1000, -400, -100, 3.01f, 0.50f, 0.55f, -1000, 0.034f, 0.00f,0.00f,0.00f, -700, 0.035f, 0.00f,0.00f,0.00f, 0.209f, 0.310f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_SHORTPASSAGE \
+ { 26, 1.5f, 0.870f, -1000, -400, -100, 3.57f, 0.50f, 0.55f, 0, 0.012f, 0.00f,0.00f,0.00f, -600, 0.016f, 0.00f,0.00f,0.00f, 0.172f, 0.200f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_LONGPASSAGE \
+ { 26, 1.9f, 0.820f, -1000, -400, -100, 4.62f, 0.62f, 0.55f, 0, 0.012f, 0.00f,0.00f,0.00f, -800, 0.031f, 0.00f,0.00f,0.00f, 0.250f, 0.230f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_LARGEROOM \
+ { 26, 1.8f, 0.810f, -1000, -400, -100, 3.89f, 0.38f, 0.61f, -1200, 0.056f, 0.00f,0.00f,0.00f, -800, 0.035f, 0.00f,0.00f,0.00f, 0.233f, 0.280f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_HALL \
+ { 26, 1.9f, 0.870f, -1000, -400, -100, 7.11f, 0.38f, 0.61f, -1500, 0.100f, 0.00f,0.00f,0.00f, -1000, 0.047f, 0.00f,0.00f,0.00f, 0.250f, 0.250f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_CUPBOARD \
+ { 26, 1.4f, 0.560f, -1000, -300, -100, 0.79f, 0.81f, 0.55f, 200, 0.007f, 0.00f,0.00f,0.00f, 400, 0.018f, 0.00f,0.00f,0.00f, 0.181f, 0.310f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPACESTATION_SMALLROOM \
+ { 26, 1.5f, 0.700f, -1000, -300, -100, 1.72f, 0.82f, 0.55f, -400, 0.007f, 0.00f,0.00f,0.00f, -500, 0.013f, 0.00f,0.00f,0.00f, 0.188f, 0.260f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
+
+// WOODEN GALLEON PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_WOODEN_ALCOVE \
+ { 26, 7.5f, 1.000f, -1100, -1800, -1000, 1.22f, 0.62f, 0.91f, -100, 0.012f, 0.00f,0.00f,0.00f, -600, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_SHORTPASSAGE \
+ { 26, 7.5f, 1.000f, -1100, -1800, -1000, 1.45f, 0.50f, 0.87f, -300, 0.012f, 0.00f,0.00f,0.00f, -700, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_MEDIUMROOM \
+ { 26, 7.5f, 1.000f, -1200, -2000, -1100, 1.07f, 0.42f, 0.82f, -300, 0.039f, 0.00f,0.00f,0.00f, -400, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_LONGPASSAGE \
+ { 26, 7.5f, 1.000f, -1100, -2000, -1000, 1.79f, 0.40f, 0.79f, -200, 0.020f, 0.00f,0.00f,0.00f, -1000, 0.036f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_LARGEROOM \
+ { 26, 7.5f, 1.000f, -1200, -2100, -1100, 1.45f, 0.33f, 0.82f, -300, 0.056f, 0.00f,0.00f,0.00f, -500, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_HALL \
+ { 26, 7.5f, 1.000f, -1200, -2200, -1100, 1.95f, 0.30f, 0.82f, -300, 0.068f, 0.00f,0.00f,0.00f, -500, 0.063f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_CUPBOARD \
+ { 26, 7.5f, 1.000f, -1000, -1700, -1000, 0.56f, 0.46f, 0.91f, -100, 0.012f, 0.00f,0.00f,0.00f, -100, 0.028f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_SMALLROOM \
+ { 26, 7.5f, 1.000f, -1200, -1900, -1000, 0.79f, 0.32f, 0.87f, -200, 0.032f, 0.00f,0.00f,0.00f, -300, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+#define EAX30_PRESET_WOODEN_COURTYARD \
+ { 26, 7.5f, 0.650f, -1700, -2200, -1000, 1.79f, 0.35f, 0.79f, -700, 0.063f, 0.00f,0.00f,0.00f, -2300, 0.032f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
+
+
+// OTHER SCENARIOS
+
+// SPORTS PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_SPORT_EMPTYSTADIUM \
+ { 26, 7.2f, 1.000f, -1300, -700, -200, 6.26f, 0.51f, 1.10f, -2400, 0.183f, 0.00f,0.00f,0.00f, -1100, 0.038f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPORT_SQUASHCOURT \
+ { 26, 7.5f, 0.750f, -1100, -1000, -200, 2.22f, 0.91f, 1.16f, -700, 0.007f, 0.00f,0.00f,0.00f, -300, 0.011f, 0.00f,0.00f,0.00f, 0.126f, 0.190f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPORT_SMALLSWIMMINGPOOL \
+ { 26, 36.2f, 0.700f, -1400, -200, -100, 2.76f, 1.25f, 1.14f, -400, 0.020f, 0.00f,0.00f,0.00f, -300, 0.030f, 0.00f,0.00f,0.00f, 0.179f, 0.150f, 0.895f, 0.190f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_SPORT_LARGESWIMMINGPOOL\
+ { 26, 36.2f, 0.820f, -1200, -200, 0, 5.49f, 1.31f, 1.14f, -700, 0.039f, 0.00f,0.00f,0.00f, -800, 0.049f, 0.00f,0.00f,0.00f, 0.222f, 0.550f, 1.159f, 0.210f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_SPORT_GYMNASIUM \
+ { 26, 7.5f, 0.810f, -1200, -700, -100, 3.14f, 1.06f, 1.35f, -800, 0.029f, 0.00f,0.00f,0.00f, -700, 0.045f, 0.00f,0.00f,0.00f, 0.146f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPORT_FULLSTADIUM \
+ { 26, 7.2f, 1.000f, -1300, -2300, -200, 5.25f, 0.17f, 0.80f, -2000, 0.188f, 0.00f,0.00f,0.00f, -1300, 0.038f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_SPORT_STADIUMTANNOY \
+ { 26, 3.0f, 0.780f, -900, -500, -600, 2.53f, 0.88f, 0.68f, -1100, 0.230f, 0.00f,0.00f,0.00f, -600, 0.063f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+
+// PREFAB PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_PREFAB_WORKSHOP \
+ { 26, 1.9f, 1.000f, -1000, -1700, -800, 0.76f, 1.00f, 1.00f, 0, 0.012f, 0.00f,0.00f,0.00f, -200, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_PREFAB_SCHOOLROOM \
+ { 26, 1.86f, 0.690f, -1100, -400, -600, 0.98f, 0.45f, 0.18f, 300, 0.017f, 0.00f,0.00f,0.00f, 0, 0.015f, 0.00f,0.00f,0.00f, 0.095f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_PREFAB_PRACTISEROOM \
+ { 26, 1.86f, 0.870f, -1000, -800, -600, 1.12f, 0.56f, 0.18f, 200, 0.010f, 0.00f,0.00f,0.00f, -200, 0.011f, 0.00f,0.00f,0.00f, 0.095f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
+#define EAX30_PRESET_PREFAB_OUTHOUSE \
+ { 26, 80.3f, 0.820f, -1100, -1900, -1600, 1.38f, 0.38f, 0.35f, -100, 0.024f, 0.00f,0.00f,-0.00f, -800, 0.044f, 0.00f,0.00f,0.00f, 0.121f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
+#define EAX30_PRESET_PREFAB_CARAVAN \
+ { 26, 8.3f, 1.000f, -1000, -2100, -1800, 0.43f, 1.50f, 1.00f, 0, 0.012f, 0.00f,0.00f,0.00f, 400, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
+ // for US developers, a caravan is the same as a trailer =o)
+
+
+// DOME AND PIPE PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_DOME_TOMB \
+ { 26, 51.8f, 0.790f, -1000, -900, -1300, 4.18f, 0.21f, 0.10f, -825, 0.030f, 0.00f,0.00f,0.00f, -125, 0.022f, 0.00f,0.00f,0.00f, 0.177f, 0.190f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_PIPE_SMALL \
+ { 26, 50.3f, 1.000f, -1000, -900, -1300, 5.04f, 0.10f, 0.10f, -600, 0.032f, 0.00f,0.00f,0.00f, 400, 0.015f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_DOME_SAINTPAULS \
+ { 26, 50.3f, 0.870f, -1000, -900, -1300, 10.48f, 0.19f, 0.10f, -1500, 0.090f, 0.00f,0.00f,0.00f, -500, 0.042f, 0.00f,0.00f,0.00f, 0.250f, 0.120f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_PIPE_LONGTHIN \
+ { 26, 1.6f, 0.910f, -1200, -700, -1100, 9.21f, 0.18f, 0.10f, -300, 0.010f, 0.00f,0.00f,0.00f, -1000, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_PIPE_LARGE \
+ { 26, 50.3f, 1.000f, -1000, -900, -1300, 8.45f, 0.10f, 0.10f, -800, 0.046f, 0.00f,0.00f,0.00f, 0, 0.032f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_PIPE_RESONANT \
+ { 26, 1.3f, 0.910f, -1200, -700, -1100, 6.81f, 0.18f, 0.10f, -300, 0.010f, 0.00f,0.00f,0.00f, -700, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
+
+// OUTDOORS PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_OUTDOORS_BACKYARD \
+ { 26, 80.3f, 0.450f, -1100, -1200, -600, 1.12f, 0.34f, 0.46f, -1100, 0.049f, 0.00f,0.00f,-0.00f, -1300, 0.023f, 0.00f,0.00f,0.00f, 0.218f, 0.340f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
+#define EAX30_PRESET_OUTDOORS_ROLLINGPLAINS \
+ { 26, 80.3f, 0.000f, -1100, -3900, -400, 2.13f, 0.21f, 0.46f, -2000, 0.300f, 0.00f,0.00f,-0.00f, -1500, 0.019f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
+#define EAX30_PRESET_OUTDOORS_DEEPCANYON \
+ { 26, 80.3f, 0.740f, -1100, -1500, -400, 3.89f, 0.21f, 0.46f, -2000, 0.193f, 0.00f,0.00f,-0.00f, -1100, 0.019f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
+#define EAX30_PRESET_OUTDOORS_CREEK \
+ { 26, 80.3f, 0.350f, -1100, -1500, -600, 2.13f, 0.21f, 0.46f, -1700, 0.115f, 0.00f,0.00f,-0.00f, -1100, 0.031f, 0.00f,0.00f,0.00f, 0.218f, 0.340f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
+#define EAX30_PRESET_OUTDOORS_VALLEY \
+ { 26, 80.3f, 0.280f, -1100, -3100, -1600, 2.88f, 0.26f, 0.35f, -3200, 0.163f, 0.00f,0.00f,-0.00f, -1000, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 0.340f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
+
+
+// MOOD PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_MOOD_HEAVEN \
+ { 26, 19.6f, 0.940f, -1000, -200, -700, 5.04f, 1.12f, 0.56f, -1230, 0.020f, 0.00f,0.00f,0.00f, -200, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.080f, 2.742f, 0.050f, -2.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_MOOD_HELL \
+ { 26, 100.0f, 0.570f, -1000, -900, -700, 3.57f, 0.49f, 2.00f, -10000, 0.020f, 0.00f,0.00f,0.00f, 100, 0.030f, 0.00f,0.00f,0.00f, 0.110f, 0.040f, 2.109f, 0.520f, -5.0f, 5000.0f, 139.5f, 0.00f, 0x40 }
+#define EAX30_PRESET_MOOD_MEMORY \
+ { 26, 8.0f, 0.850f, -1000, -400, -900, 4.06f, 0.82f, 0.56f, -2800, 0.000f, 0.00f,0.00f,0.00f, -500, 0.000f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.474f, 0.450f, -2.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+
+// DRIVING SIMULATION PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_DRIVING_COMMENTATOR \
+ { 26, 3.0f, 0.000f, -900, -500, -600, 2.42f, 0.88f, 0.68f, -1400, 0.093f, 0.00f,0.00f,0.00f, -1200, 0.017f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_DRIVING_PITGARAGE \
+ { 26, 1.9f, 0.590f, -1400, -300, -500, 1.72f, 0.93f, 0.87f, -500, 0.000f, 0.00f,0.00f,0.00f, 0, 0.016f, 0.00f,0.00f,0.00f, 0.250f, 0.110f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+#define EAX30_PRESET_DRIVING_INCAR_RACER \
+ { 26, 1.1f, 0.800f, -700, 0, -200, 0.17f, 2.00f, 0.41f, 500, 0.007f, 0.00f,0.00f,0.00f, -500, 0.015f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_DRIVING_INCAR_SPORTS \
+ { 26, 1.1f, 0.800f, -900, -400, 0, 0.17f, 0.75f, 0.41f, 0, 0.010f, 0.00f,0.00f,0.00f, -600, 0.000f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_DRIVING_INCAR_LUXURY \
+ { 26, 1.6f, 1.000f, -800, -2000, -600, 0.13f, 0.41f, 0.46f, -200, 0.010f, 0.00f,0.00f,0.00f, 300, 0.010f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_DRIVING_FULLGRANDSTAND \
+ { 26, 8.3f, 1.000f, -1100, -1100, -400, 3.01f, 1.37f, 1.28f, -900, 0.090f, 0.00f,0.00f,0.00f, -1700, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 10420.2f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_DRIVING_EMPTYGRANDSTAND \
+ { 26, 8.3f, 1.000f, -700, 0, -200, 4.62f, 1.75f, 1.40f, -1363, 0.090f, 0.00f,0.00f,0.00f, -1900, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 10420.2f, 250.0f, 0.00f, 0x1f }
+#define EAX30_PRESET_DRIVING_TUNNEL \
+ { 26, 3.1f, 0.810f, -900, -800, -100, 3.42f, 0.94f, 1.31f, -300, 0.051f, 0.00f,0.00f,0.00f, -500, 0.047f, 0.00f,0.00f,0.00f, 0.214f, 0.050f, 0.250f, 0.000f, -0.0f, 5000.0f, 155.3f, 0.00f, 0x20 }
+
+// CITY PRESETS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_CITY_STREETS \
+ { 26, 3.0f, 0.780f, -1100, -300, -100, 1.79f, 1.12f, 0.91f, -1700, 0.046f, 0.00f,0.00f,0.00f, -2800, 0.028f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_CITY_SUBWAY \
+ { 26, 3.0f, 0.740f, -1100, -300, -100, 3.01f, 1.23f, 0.91f, -700, 0.046f, 0.00f,0.00f,0.00f, -1000, 0.028f, 0.00f,0.00f,0.00f, 0.125f, 0.210f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_CITY_MUSEUM \
+ { 26, 80.3f, 0.820f, -1100, -1500, -1500, 3.28f, 1.40f, 0.57f, -1600, 0.039f, 0.00f,0.00f,-0.00f, -600, 0.034f, 0.00f,0.00f,0.00f, 0.130f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
+#define EAX30_PRESET_CITY_LIBRARY \
+ { 26, 80.3f, 0.820f, -1100, -1100, -2100, 2.76f, 0.89f, 0.41f, -1100, 0.029f, 0.00f,0.00f,-0.00f, -500, 0.020f, 0.00f,0.00f,0.00f, 0.130f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
+#define EAX30_PRESET_CITY_UNDERPASS \
+ { 26, 3.0f, 0.820f, -1500, -700, -100, 3.57f, 1.12f, 0.91f, -1500, 0.059f, 0.00f,0.00f,0.00f, -1100, 0.037f, 0.00f,0.00f,0.00f, 0.250f, 0.140f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+#define EAX30_PRESET_CITY_ABANDONED \
+ { 26, 3.0f, 0.690f, -1100, -200, -100, 3.28f, 1.17f, 0.91f, -1400, 0.044f, 0.00f,0.00f,0.00f, -2400, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
+
+// MISC ROOMS
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+#define EAX30_PRESET_DUSTYROOM \
+ { 26, 1.8f, 0.560f, -1100, -200, -300, 1.79f, 0.38f, 0.21f, -600, 0.002f, 0.00f,0.00f,0.00f, 200, 0.006f, 0.00f,0.00f,0.00f, 0.202f, 0.050f, 0.250f, 0.000f, -3.0f, 13046.0f, 163.3f, 0.00f, 0x20 }
+#define EAX30_PRESET_CHAPEL \
+ { 26, 19.6f, 0.840f, -1000, -500, 0, 4.62f, 0.64f, 1.23f, -700, 0.032f, 0.00f,0.00f,0.00f, -800, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.110f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
+#define EAX30_PRESET_SMALLWATERROOM \
+ { 26, 36.2f, 0.700f, -1200, -698, 0, 1.51f, 1.25f, 1.14f, -100, 0.020f, 0.00f,0.00f,0.00f, 200, 0.030f, 0.00f,0.00f,0.00f, 0.179f, 0.150f, 0.895f, 0.190f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Effect Scenarios enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ EAX30_SCENARIO_CASTLE = 0,
+ EAX30_SCENARIO_FACTORY,
+ EAX30_SCENARIO_ICEPALACE,
+ EAX30_SCENARIO_SPACESTATION,
+ EAX30_SCENARIO_WOODGALLEON,
+ EAX30_SCENARIO_SPORTS,
+ EAX30_SCENARIO_PREFAB,
+ EAX30_SCENARIO_DOMESNPIPES,
+ EAX30_SCENARIO_OUTDOORS,
+ EAX30_SCENARIO_MOOD,
+ EAX30_SCENARIO_DRIVING,
+ EAX30_SCENARIO_CITY,
+ EAX30_SCENARIO_MISC,
+ EAX30_SCENARIO_ORIGINAL
+}
+EAX30_SCENARIO;
+
+//////////////////////////////////////////////////////
+// Number of Effect Scenarios //
+//////////////////////////////////////////////////////
+
+#define EAX30_NUM_SCENARIOS 14
+
+//////////////////////////////////////////////////////
+// Number of Effect Scenarios with standardised //
+// locations //
+//////////////////////////////////////////////////////
+
+#define EAX30_NUM_STANDARD_SCENARIOS 5
+
+//////////////////////////////////////////////////////
+// Array of scenario names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_SCENARIO_NAMES[];
+
+//////////////////////////////////////////////////////
+// Standardised Locations enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ EAX30_LOCATION_HALL = 0,
+ EAX30_LOCATION_LARGEROOM,
+ EAX30_LOCATION_MEDIUMROOM,
+ EAX30_LOCATION_SMALLROOM,
+ EAX30_LOCATION_CUPBOARD,
+ EAX30_LOCATION_ALCOVE,
+ EAX30_LOCATION_LONGPASSAGE,
+ EAX30_LOCATION_SHORTPASSAGE,
+ EAX30_LOCATION_COURTYARD
+}
+EAX30_LOCATION;
+
+//////////////////////////////////////////////////////
+// Number of Standardised Locations //
+//////////////////////////////////////////////////////
+
+#define EAX30_NUM_LOCATIONS 9
+
+//////////////////////////////////////////////////////
+// Array of standardised location names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_LOCATION_NAMES[];
+
+//////////////////////////////////////////////////////
+// Number of effects in each scenario //
+//////////////////////////////////////////////////////
+
+#define EAX30_NUM_ORIGINAL_PRESETS 26
+#define EAX30_NUM_CASTLE_PRESETS EAX30_NUM_LOCATIONS
+#define EAX30_NUM_FACTORY_PRESETS EAX30_NUM_LOCATIONS
+#define EAX30_NUM_ICEPALACE_PRESETS EAX30_NUM_LOCATIONS
+#define EAX30_NUM_SPACESTATION_PRESETS EAX30_NUM_LOCATIONS
+#define EAX30_NUM_WOODGALLEON_PRESETS EAX30_NUM_LOCATIONS
+#define EAX30_NUM_SPORTS_PRESETS 7
+#define EAX30_NUM_PREFAB_PRESETS 5
+#define EAX30_NUM_DOMESNPIPES_PRESETS 6
+#define EAX30_NUM_OUTDOORS_PRESETS 5
+#define EAX30_NUM_MOOD_PRESETS 3
+#define EAX30_NUM_DRIVING_PRESETS 8
+#define EAX30_NUM_CITY_PRESETS 6
+#define EAX30_NUM_MISC_PRESETS 3
+
+//////////////////////////////////////////////////////
+// Standardised Location effects can be accessed //
+// from a matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_STANDARD_PRESETS[EAX30_NUM_STANDARD_SCENARIOS][EAX30_NUM_LOCATIONS];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Original Preset effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ ORIGINAL_GENERIC = 0,
+ ORIGINAL_PADDEDCELL,
+ ORIGINAL_ROOM,
+ ORIGINAL_BATHROOM,
+ ORIGINAL_LIVINGROOM,
+ ORIGINAL_STONEROOM,
+ ORIGINAL_AUDITORIUM,
+ ORIGINAL_CONCERTHALL,
+ ORIGINAL_CAVE,
+ ORIGINAL_ARENA,
+ ORIGINAL_HANGAR,
+ ORIGINAL_CARPETTEDHALLWAY,
+ ORIGINAL_HALLWAY,
+ ORIGINAL_STONECORRIDOR,
+ ORIGINAL_ALLEY,
+ ORIGINAL_FOREST,
+ ORIGINAL_CITY,
+ ORIGINAL_MOUNTAINS,
+ ORIGINAL_QUARRY,
+ ORIGINAL_PLAIN,
+ ORIGINAL_PARKINGLOT,
+ ORIGINAL_SEWERPIPE,
+ ORIGINAL_UNDERWATER,
+ ORIGINAL_DRUGGED,
+ ORIGINAL_DIZZY,
+ ORIGINAL_PSYCHOTIC
+}
+EAX30_ORIGINAL_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of original environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_ORIGINAL_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Original effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_ORIGINAL_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Sports scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ SPORT_EMPTYSTADIUM=0,
+ SPORT_FULLSTADIUM,
+ SPORT_STADIUMTANNOY,
+ SPORT_SQUASHCOURT,
+ SPORT_SMALLSWIMMINGPOOL,
+ SPORT_LARGESWIMMINGPOOL,
+ SPORT_GYMNASIUM
+}
+EAX30_SPORTS_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of sport environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_SPORTS_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Sports effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_SPORTS_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Prefab scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ PREFAB_WORKSHOP,
+ PREFAB_SCHOOLROOM,
+ PREFAB_PRACTISEROOM,
+ PREFAB_OUTHOUSE,
+ PREFAB_CARAVAN
+}
+EAX30_PREFAB_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of prefab environment names //
+//////////////////////////////////////////////////////
+
+char* EAX30_PREFAB_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Prefab effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_PREFAB_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Domes & Pipes effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ DOME_TOMB,
+ DOME_SAINTPAULS,
+ PIPE_SMALL,
+ PIPE_LONGTHIN,
+ PIPE_LARGE,
+ PIPE_RESONANT
+}
+EAX30_DOMESNPIPES_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of Domes & Pipes environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_DOMESNPIPES_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Domes & Pipes effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_DOMESNPIPES_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Outdoors scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ OUTDOORS_BACKYARD,
+ OUTDOORS_ROLLINGPLAINS,
+ OUTDOORS_DEEPCANYON,
+ OUTDOORS_CREEK,
+ OUTDOORS_VALLEY
+}
+EAX30_OUTDOORS_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of Outdoors environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_OUTDOORS_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Outdoors effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_OUTDOORS_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Mood scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ MOOD_HEAVEN,
+ MOOD_HELL,
+ MOOD_MEMORY
+}
+EAX30_MOOD_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of Mood environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_MOOD_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Mood effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_MOOD_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Driving scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ DRIVING_COMMENTATOR,
+ DRIVING_PITGARAGE,
+ DRIVING_INCAR_RACER,
+ DRIVING_INCAR_SPORTS,
+ DRIVING_INCAR_LUXURY,
+ DRIVING_FULLGRANDSTAND,
+ DRIVING_EMPTYGRANDSTAND,
+ DRIVING_TUNNEL
+}
+EAX30_DRIVING_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of driving environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_DRIVING_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Driving effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_DRIVING_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// City scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ CITY_STREETS,
+ CITY_SUBWAY,
+ CITY_MUSEUM,
+ CITY_LIBRARY,
+ CITY_UNDERPASS,
+ CITY_ABANDONED
+}
+EAX30_CITY_PRESET_ENUMS;
+
+//////////////////////////////////////////////////////
+// Array of City environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_CITY_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// City effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_CITY_PRESETS[];
+
+/********************************************************************************************************/
+
+//////////////////////////////////////////////////////
+// Misc scenario effects enumerated //
+//////////////////////////////////////////////////////
+
+typedef enum
+{
+ DUSTYROOM,
+ CHAPEL,
+ SMALLWATERROOM
+}
+EAX30_MISC_PRESET_ENUMS;
+
+
+//////////////////////////////////////////////////////
+// Array of Misc environment names //
+//////////////////////////////////////////////////////
+
+extern char* EAX30_MISC_PRESET_NAMES[];
+
+//////////////////////////////////////////////////////
+// Misc effects matrix //
+//////////////////////////////////////////////////////
+
+extern EAXLISTENERPROPERTIES EAX30_MISC_PRESETS[];
+
+
+/***********************************************************************************************\
+*
+* Material transmission presets
+*
+* Three values in this order :-
+*
+* 1. Occlusion (or Obstruction)
+* 2. Occlusion LF Ratio (or Obstruction LF Ratio)
+* 3. Occlusion Room Ratio
+*
+************************************************************************************************/
+
+
+// Single window material preset
+#define EAX_MATERIAL_SINGLEWINDOW (-2800)
+#define EAX_MATERIAL_SINGLEWINDOWLF 0.71f
+#define EAX_MATERIAL_SINGLEWINDOWROOMRATIO 0.43f
+
+// Double window material preset
+#define EAX_MATERIAL_DOUBLEWINDOW (-5000)
+#define EAX_MATERIAL_DOUBLEWINDOWLF 0.40f
+#define EAX_MATERIAL_DOUBLEWINDOWROOMRATIO 0.24f
+
+// Thin door material preset
+#define EAX_MATERIAL_THINDOOR (-1800)
+#define EAX_MATERIAL_THINDOORLF 0.66f
+#define EAX_MATERIAL_THINDOORROOMRATIO 0.66f
+
+// Thick door material preset
+#define EAX_MATERIAL_THICKDOOR (-4400)
+#define EAX_MATERIAL_THICKDOORLF 0.64f
+#define EAX_MATERIAL_THICKDOORROOMRATIO 0.27f
+
+// Wood wall material preset
+#define EAX_MATERIAL_WOODWALL (-4000)
+#define EAX_MATERIAL_WOODWALLLF 0.50f
+#define EAX_MATERIAL_WOODWALLROOMRATIO 0.30f
+
+// Brick wall material preset
+#define EAX_MATERIAL_BRICKWALL (-5000)
+#define EAX_MATERIAL_BRICKWALLLF 0.60f
+#define EAX_MATERIAL_BRICKWALLROOMRATIO 0.24f
+
+// Stone wall material preset
+#define EAX_MATERIAL_STONEWALL (-6000)
+#define EAX_MATERIAL_STONEWALLLF 0.68f
+#define EAX_MATERIAL_STONEWALLROOMRATIO 0.20f
+
+// Curtain material preset
+#define EAX_MATERIAL_CURTAIN (-1200)
+#define EAX_MATERIAL_CURTAINLF 0.15f
+#define EAX_MATERIAL_CURTAINROOMRATIO 1.00f
+
+
+#endif // EAXUTIL_INCLUDED
diff --git a/eax/eax.h b/eax/eax.h
new file mode 100644
index 00000000..ecc93c15
--- /dev/null
+++ b/eax/eax.h
@@ -0,0 +1,535 @@
+/*******************************************************************\
+* *
+* EAX.H - Environmental Audio Extensions version 3.0 *
+* for OpenAL and DirectSound3D *
+* *
+********************************************************************/
+
+#ifndef EAX_H_INCLUDED
+#define EAX_H_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#ifndef OPENAL
+ #include <dsound.h>
+
+ /*
+ * EAX Wrapper Interface (using Direct X 7) {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
+ */
+ DEFINE_GUID(CLSID_EAXDirectSound,
+ 0x4ff53b81,
+ 0x1ce0,
+ 0x11d3,
+ 0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5);
+
+ /*
+ * EAX Wrapper Interface (using Direct X 8) {CA503B60-B176-11d4-A094-D0C0BF3A560C}
+ */
+ DEFINE_GUID(CLSID_EAXDirectSound8,
+ 0xca503b60,
+ 0xb176,
+ 0x11d4,
+ 0xa0, 0x94, 0xd0, 0xc0, 0xbf, 0x3a, 0x56, 0xc);
+
+
+
+#ifdef DIRECTSOUND_VERSION
+#if DIRECTSOUND_VERSION >= 0x0800
+ __declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate8(GUID*, LPDIRECTSOUND8*, IUnknown FAR *);
+ typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE8)(GUID*, LPDIRECTSOUND8*, IUnknown FAR*);
+#endif
+#endif
+
+ __declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *);
+ typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*);
+
+ __declspec(dllimport) void CDECL GetCurrentVersion(LPDWORD major, LPDWORD minor);
+ typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor);
+
+
+#else // OPENAL
+ #include <al.h>
+
+ #ifndef GUID_DEFINED
+ #define GUID_DEFINED
+ typedef struct _GUID
+ {
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+ } GUID;
+ #endif // !GUID_DEFINED
+
+ #ifndef DEFINE_GUID
+ #ifndef INITGUID
+ #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ extern const GUID /*FAR*/ name
+ #else
+ #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
+ #endif // INITGUID
+ #endif // DEFINE_GUID
+
+
+ /*
+ * EAX OpenAL Extension
+ */
+ typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
+ typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
+#endif
+
+#pragma pack(push, 4)
+
+/*
+ * EAX 3.0 listener property set {A8FA6880-B476-11d3-BDB9-00C0F02DDF87}
+ */
+DEFINE_GUID(DSPROPSETID_EAX30_ListenerProperties,
+ 0xa8fa6882,
+ 0xb476,
+ 0x11d3,
+ 0xbd, 0xb9, 0x00, 0xc0, 0xf0, 0x2d, 0xdf, 0x87);
+
+// For compatibility with future EAX versions:
+#define DSPROPSETID_EAX_ListenerProperties DSPROPSETID_EAX30_ListenerProperties
+
+typedef enum
+{
+ DSPROPERTY_EAXLISTENER_NONE,
+ DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
+ DSPROPERTY_EAXLISTENER_ENVIRONMENT,
+ DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
+ DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
+ DSPROPERTY_EAXLISTENER_ROOM,
+ DSPROPERTY_EAXLISTENER_ROOMHF,
+ DSPROPERTY_EAXLISTENER_ROOMLF,
+ DSPROPERTY_EAXLISTENER_DECAYTIME,
+ DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
+ DSPROPERTY_EAXLISTENER_DECAYLFRATIO,
+ DSPROPERTY_EAXLISTENER_REFLECTIONS,
+ DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
+ DSPROPERTY_EAXLISTENER_REFLECTIONSPAN,
+ DSPROPERTY_EAXLISTENER_REVERB,
+ DSPROPERTY_EAXLISTENER_REVERBDELAY,
+ DSPROPERTY_EAXLISTENER_REVERBPAN,
+ DSPROPERTY_EAXLISTENER_ECHOTIME,
+ DSPROPERTY_EAXLISTENER_ECHODEPTH,
+ DSPROPERTY_EAXLISTENER_MODULATIONTIME,
+ DSPROPERTY_EAXLISTENER_MODULATIONDEPTH,
+ DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
+ DSPROPERTY_EAXLISTENER_HFREFERENCE,
+ DSPROPERTY_EAXLISTENER_LFREFERENCE,
+ DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
+ DSPROPERTY_EAXLISTENER_FLAGS
+} DSPROPERTY_EAX_LISTENERPROPERTY;
+
+// OR these flags with property id
+#define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately
+#define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later
+#define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \
+ DSPROPERTY_EAXLISTENER_IMMEDIATE)
+
+typedef struct _EAXVECTOR {
+ float x;
+ float y;
+ float z;
+} EAXVECTOR;
+
+// Use this structure for DSPROPERTY_EAXLISTENER_ALLPARAMETERS
+// - all levels are hundredths of decibels
+// - all times and delays are in seconds
+//
+// NOTE: This structure may change in future EAX versions.
+// It is recommended to initialize fields by name:
+// myListener.lRoom = -1000;
+// myListener.lRoomHF = -100;
+// ...
+// myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ;
+// instead of:
+// myListener = { -1000, -100, ... , 0x00000009 };
+// If you want to save and load presets in binary form, you
+// should define your own structure to insure future compatibility.
+//
+typedef struct _EAXLISTENERPROPERTIES
+{
+ unsigned long ulEnvironment; // sets all listener properties
+ float flEnvironmentSize; // environment size in meters
+ float flEnvironmentDiffusion; // environment diffusion
+ long lRoom; // room effect level (at mid frequencies)
+ long lRoomHF; // relative room effect level at high frequencies
+ long lRoomLF; // relative room effect level at low frequencies
+ float flDecayTime; // reverberation decay time at mid frequencies
+ float flDecayHFRatio; // high-frequency to mid-frequency decay time ratio
+ float flDecayLFRatio; // low-frequency to mid-frequency decay time ratio
+ long lReflections; // early reflections level relative to room effect
+ float flReflectionsDelay; // initial reflection delay time
+ EAXVECTOR vReflectionsPan; // early reflections panning vector
+ long lReverb; // late reverberation level relative to room effect
+ float flReverbDelay; // late reverberation delay time relative to initial reflection
+ EAXVECTOR vReverbPan; // late reverberation panning vector
+ float flEchoTime; // echo time
+ float flEchoDepth; // echo depth
+ float flModulationTime; // modulation time
+ float flModulationDepth; // modulation depth
+ float flAirAbsorptionHF; // change in level per meter at high frequencies
+ float flHFReference; // reference high frequency
+ float flLFReference; // reference low frequency
+ float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
+ unsigned long ulFlags; // modifies the behavior of properties
+} EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES;
+
+// used by DSPROPERTY_EAXLISTENER_ENVIRONMENT
+enum
+{
+ EAX_ENVIRONMENT_GENERIC,
+ EAX_ENVIRONMENT_PADDEDCELL,
+ EAX_ENVIRONMENT_ROOM,
+ EAX_ENVIRONMENT_BATHROOM,
+ EAX_ENVIRONMENT_LIVINGROOM,
+ EAX_ENVIRONMENT_STONEROOM,
+ EAX_ENVIRONMENT_AUDITORIUM,
+ EAX_ENVIRONMENT_CONCERTHALL,
+ EAX_ENVIRONMENT_CAVE,
+ EAX_ENVIRONMENT_ARENA,
+ EAX_ENVIRONMENT_HANGAR,
+ EAX_ENVIRONMENT_CARPETEDHALLWAY,
+ EAX_ENVIRONMENT_HALLWAY,
+ EAX_ENVIRONMENT_STONECORRIDOR,
+ EAX_ENVIRONMENT_ALLEY,
+ EAX_ENVIRONMENT_FOREST,
+ EAX_ENVIRONMENT_CITY,
+ EAX_ENVIRONMENT_MOUNTAINS,
+ EAX_ENVIRONMENT_QUARRY,
+ EAX_ENVIRONMENT_PLAIN,
+ EAX_ENVIRONMENT_PARKINGLOT,
+ EAX_ENVIRONMENT_SEWERPIPE,
+ EAX_ENVIRONMENT_UNDERWATER,
+ EAX_ENVIRONMENT_DRUGGED,
+ EAX_ENVIRONMENT_DIZZY,
+ EAX_ENVIRONMENT_PSYCHOTIC,
+
+ EAX_ENVIRONMENT_UNDEFINED,
+
+ EAX_ENVIRONMENT_COUNT
+};
+
+// Used by DSPROPERTY_EAXLISTENER_FLAGS
+//
+// Note: The number and order of flags may change in future EAX versions.
+// It is recommended to use the flag defines as follows:
+// myFlags = EAXLISTENERFLAGS_DECAYTIMESCALE | EAXLISTENERFLAGS_REVERBSCALE;
+// instead of:
+// myFlags = 0x00000009;
+//
+// These flags determine what properties are affected by environment size.
+#define EAXLISTENERFLAGS_DECAYTIMESCALE 0x00000001 // reverberation decay time
+#define EAXLISTENERFLAGS_REFLECTIONSSCALE 0x00000002 // reflection level
+#define EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE 0x00000004 // initial reflection delay time
+#define EAXLISTENERFLAGS_REVERBSCALE 0x00000008 // reflections level
+#define EAXLISTENERFLAGS_REVERBDELAYSCALE 0x00000010 // late reverberation delay time
+#define EAXLISTENERFLAGS_ECHOTIMESCALE 0x00000040 // echo time
+#define EAXLISTENERFLAGS_MODULATIONTIMESCALE 0x00000080 // modulation time
+
+// This flag limits high-frequency decay time according to air absorption.
+#define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020
+
+#define EAXLISTENERFLAGS_RESERVED 0xFFFFFF00 // reserved future use
+
+// Property ranges and defaults:
+
+#define EAXLISTENER_MINENVIRONMENT 0
+#define EAXLISTENER_MAXENVIRONMENT (EAX_ENVIRONMENT_COUNT-1)
+#define EAXLISTENER_DEFAULTENVIRONMENT EAX_ENVIRONMENT_GENERIC
+
+#define EAXLISTENER_MINENVIRONMENTSIZE 1.0f
+#define EAXLISTENER_MAXENVIRONMENTSIZE 100.0f
+#define EAXLISTENER_DEFAULTENVIRONMENTSIZE 7.5f
+
+#define EAXLISTENER_MINENVIRONMENTDIFFUSION 0.0f
+#define EAXLISTENER_MAXENVIRONMENTDIFFUSION 1.0f
+#define EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION 1.0f
+
+#define EAXLISTENER_MINROOM (-10000)
+#define EAXLISTENER_MAXROOM 0
+#define EAXLISTENER_DEFAULTROOM (-1000)
+
+#define EAXLISTENER_MINROOMHF (-10000)
+#define EAXLISTENER_MAXROOMHF 0
+#define EAXLISTENER_DEFAULTROOMHF (-100)
+
+#define EAXLISTENER_MINROOMLF (-10000)
+#define EAXLISTENER_MAXROOMLF 0
+#define EAXLISTENER_DEFAULTROOMLF 0
+
+#define EAXLISTENER_MINDECAYTIME 0.1f
+#define EAXLISTENER_MAXDECAYTIME 20.0f
+#define EAXLISTENER_DEFAULTDECAYTIME 1.49f
+
+#define EAXLISTENER_MINDECAYHFRATIO 0.1f
+#define EAXLISTENER_MAXDECAYHFRATIO 2.0f
+#define EAXLISTENER_DEFAULTDECAYHFRATIO 0.83f
+
+#define EAXLISTENER_MINDECAYLFRATIO 0.1f
+#define EAXLISTENER_MAXDECAYLFRATIO 2.0f
+#define EAXLISTENER_DEFAULTDECAYLFRATIO 1.00f
+
+#define EAXLISTENER_MINREFLECTIONS (-10000)
+#define EAXLISTENER_MAXREFLECTIONS 1000
+#define EAXLISTENER_DEFAULTREFLECTIONS (-2602)
+
+#define EAXLISTENER_MINREFLECTIONSDELAY 0.0f
+#define EAXLISTENER_MAXREFLECTIONSDELAY 0.3f
+#define EAXLISTENER_DEFAULTREFLECTIONSDELAY 0.007f
+
+#define EAXLISTENER_MINREVERB (-10000)
+#define EAXLISTENER_MAXREVERB 2000
+#define EAXLISTENER_DEFAULTREVERB 200
+
+#define EAXLISTENER_MINREVERBDELAY 0.0f
+#define EAXLISTENER_MAXREVERBDELAY 0.1f
+#define EAXLISTENER_DEFAULTREVERBDELAY 0.011f
+
+#define EAXLISTENER_MINECHOTIME 0.075f
+#define EAXLISTENER_MAXECHOTIME 0.25f
+#define EAXLISTENER_DEFAULTECHOTIME 0.25f
+
+#define EAXLISTENER_MINECHODEPTH 0.0f
+#define EAXLISTENER_MAXECHODEPTH 1.0f
+#define EAXLISTENER_DEFAULTECHODEPTH 0.0f
+
+#define EAXLISTENER_MINMODULATIONTIME 0.04f
+#define EAXLISTENER_MAXMODULATIONTIME 4.0f
+#define EAXLISTENER_DEFAULTMODULATIONTIME 0.25f
+
+#define EAXLISTENER_MINMODULATIONDEPTH 0.0f
+#define EAXLISTENER_MAXMODULATIONDEPTH 1.0f
+#define EAXLISTENER_DEFAULTMODULATIONDEPTH 0.0f
+
+#define EAXLISTENER_MINAIRABSORPTIONHF (-100.0f)
+#define EAXLISTENER_MAXAIRABSORPTIONHF 0.0f
+#define EAXLISTENER_DEFAULTAIRABSORPTIONHF (-5.0f)
+
+#define EAXLISTENER_MINHFREFERENCE 1000.0f
+#define EAXLISTENER_MAXHFREFERENCE 20000.0f
+#define EAXLISTENER_DEFAULTHFREFERENCE 5000.0f
+
+#define EAXLISTENER_MINLFREFERENCE 20.0f
+#define EAXLISTENER_MAXLFREFERENCE 1000.0f
+#define EAXLISTENER_DEFAULTLFREFERENCE 250.0f
+
+#define EAXLISTENER_MINROOMROLLOFFFACTOR 0.0f
+#define EAXLISTENER_MAXROOMROLLOFFFACTOR 10.0f
+#define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f
+
+#define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \
+ EAXLISTENERFLAGS_REFLECTIONSSCALE | \
+ EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \
+ EAXLISTENERFLAGS_REVERBSCALE | \
+ EAXLISTENERFLAGS_REVERBDELAYSCALE | \
+ EAXLISTENERFLAGS_DECAYHFLIMIT)
+
+
+
+/*
+* EAX 3.0 buffer property set {A8FA6881-B476-11d3-BDB9-00C0F02DDF87}
+*/
+DEFINE_GUID(DSPROPSETID_EAX30_BufferProperties,
+ 0xa8fa6881,
+ 0xb476,
+ 0x11d3,
+ 0xbd, 0xb9, 0x0, 0xc0, 0xf0, 0x2d, 0xdf, 0x87);
+
+// For compatibility with future EAX versions:
+#define DSPROPSETID_EAX_BufferProperties DSPROPSETID_EAX30_BufferProperties
+#define DSPROPSETID_EAX_SourceProperties DSPROPSETID_EAX30_BufferProperties
+
+typedef enum
+{
+ DSPROPERTY_EAXBUFFER_NONE,
+ DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
+ DSPROPERTY_EAXBUFFER_OBSTRUCTIONPARAMETERS,
+ DSPROPERTY_EAXBUFFER_OCCLUSIONPARAMETERS,
+ DSPROPERTY_EAXBUFFER_EXCLUSIONPARAMETERS,
+ DSPROPERTY_EAXBUFFER_DIRECT,
+ DSPROPERTY_EAXBUFFER_DIRECTHF,
+ DSPROPERTY_EAXBUFFER_ROOM,
+ DSPROPERTY_EAXBUFFER_ROOMHF,
+ DSPROPERTY_EAXBUFFER_OBSTRUCTION,
+ DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
+ DSPROPERTY_EAXBUFFER_OCCLUSION,
+ DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
+ DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
+ DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO,
+ DSPROPERTY_EAXBUFFER_EXCLUSION,
+ DSPROPERTY_EAXBUFFER_EXCLUSIONLFRATIO,
+ DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
+ DSPROPERTY_EAXBUFFER_DOPPLERFACTOR,
+ DSPROPERTY_EAXBUFFER_ROLLOFFFACTOR,
+ DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
+ DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
+ DSPROPERTY_EAXBUFFER_FLAGS
+} DSPROPERTY_EAX_BUFFERPROPERTY;
+
+// OR these flags with property id
+#define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately
+#define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later
+#define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \
+ DSPROPERTY_EAXBUFFER_IMMEDIATE)
+
+// Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS
+// - all levels are hundredths of decibels
+// - all delays are in seconds
+//
+// NOTE: This structure may change in future EAX versions.
+// It is recommended to initialize fields by name:
+// myBuffer.lDirect = 0;
+// myBuffer.lDirectHF = -200;
+// ...
+// myBuffer.dwFlags = myFlags /* see EAXBUFFERFLAGS below */ ;
+// instead of:
+// myBuffer = { 0, -200, ... , 0x00000003 };
+//
+typedef struct _EAXBUFFERPROPERTIES
+{
+ long lDirect; // direct path level (at low and mid frequencies)
+ long lDirectHF; // relative direct path level at high frequencies
+ long lRoom; // room effect level (at low and mid frequencies)
+ long lRoomHF; // relative room effect level at high frequencies
+ long lObstruction; // main obstruction control (attenuation at high frequencies)
+ float flObstructionLFRatio; // obstruction low-frequency level re. main control
+ long lOcclusion; // main occlusion control (attenuation at high frequencies)
+ float flOcclusionLFRatio; // occlusion low-frequency level re. main control
+ float flOcclusionRoomRatio; // relative occlusion control for room effect
+ float flOcclusionDirectRatio; // relative occlusion control for direct path
+ long lExclusion; // main exlusion control (attenuation at high frequencies)
+ float flExclusionLFRatio; // exclusion low-frequency level re. main control
+ long lOutsideVolumeHF; // outside sound cone level at high frequencies
+ float flDopplerFactor; // like DS3D flDopplerFactor but per source
+ float flRolloffFactor; // like DS3D flRolloffFactor but per source
+ float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
+ float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
+ unsigned long ulFlags; // modifies the behavior of properties
+} EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES;
+
+// Use this structure for DSPROPERTY_EAXBUFFER_OBSTRUCTION,
+typedef struct _EAXOBSTRUCTIONPROPERTIES
+{
+ long lObstruction;
+ float flObstructionLFRatio;
+} EAXOBSTRUCTIONPROPERTIES, *LPEAXOBSTRUCTIONPROPERTIES;
+
+// Use this structure for DSPROPERTY_EAXBUFFER_OCCLUSION
+typedef struct _EAXOCCLUSIONPROPERTIES
+{
+ long lOcclusion;
+ float flOcclusionLFRatio;
+ float flOcclusionRoomRatio;
+ float flOcclusionDirectRatio;
+} EAXOCCLUSIONPROPERTIES, *LPEAXOCCLUSIONPROPERTIES;
+
+// Use this structure for DSPROPERTY_EAXBUFFER_EXCLUSION
+typedef struct _EAXEXCLUSIONPROPERTIES
+{
+ long lExclusion;
+ float flExclusionLFRatio;
+} EAXEXCLUSIONPROPERTIES, *LPEAXEXCLUSIONPROPERTIES;
+
+// Used by DSPROPERTY_EAXBUFFER_FLAGS
+// TRUE: value is computed automatically - property is an offset
+// FALSE: value is used directly
+//
+// Note: The number and order of flags may change in future EAX versions.
+// To insure future compatibility, use flag defines as follows:
+// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
+// instead of:
+// myFlags = 0x00000003;
+//
+#define EAXBUFFERFLAGS_DIRECTHFAUTO 0x00000001 // affects DSPROPERTY_EAXBUFFER_DIRECTHF
+#define EAXBUFFERFLAGS_ROOMAUTO 0x00000002 // affects DSPROPERTY_EAXBUFFER_ROOM
+#define EAXBUFFERFLAGS_ROOMHFAUTO 0x00000004 // affects DSPROPERTY_EAXBUFFER_ROOMHF
+
+#define EAXBUFFERFLAGS_RESERVED 0xFFFFFFF8 // reserved future use
+
+// Property ranges and defaults:
+
+#define EAXBUFFER_MINDIRECT (-10000)
+#define EAXBUFFER_MAXDIRECT 1000
+#define EAXBUFFER_DEFAULTDIRECT 0
+
+#define EAXBUFFER_MINDIRECTHF (-10000)
+#define EAXBUFFER_MAXDIRECTHF 0
+#define EAXBUFFER_DEFAULTDIRECTHF 0
+
+#define EAXBUFFER_MINROOM (-10000)
+#define EAXBUFFER_MAXROOM 1000
+#define EAXBUFFER_DEFAULTROOM 0
+
+#define EAXBUFFER_MINROOMHF (-10000)
+#define EAXBUFFER_MAXROOMHF 0
+#define EAXBUFFER_DEFAULTROOMHF 0
+
+#define EAXBUFFER_MINOBSTRUCTION (-10000)
+#define EAXBUFFER_MAXOBSTRUCTION 0
+#define EAXBUFFER_DEFAULTOBSTRUCTION 0
+
+#define EAXBUFFER_MINOBSTRUCTIONLFRATIO 0.0f
+#define EAXBUFFER_MAXOBSTRUCTIONLFRATIO 1.0f
+#define EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO 0.0f
+
+#define EAXBUFFER_MINOCCLUSION (-10000)
+#define EAXBUFFER_MAXOCCLUSION 0
+#define EAXBUFFER_DEFAULTOCCLUSION 0
+
+#define EAXBUFFER_MINOCCLUSIONLFRATIO 0.0f
+#define EAXBUFFER_MAXOCCLUSIONLFRATIO 1.0f
+#define EAXBUFFER_DEFAULTOCCLUSIONLFRATIO 0.25f
+
+#define EAXBUFFER_MINOCCLUSIONROOMRATIO 0.0f
+#define EAXBUFFER_MAXOCCLUSIONROOMRATIO 10.0f
+#define EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO 1.5f
+
+#define EAXBUFFER_MINOCCLUSIONDIRECTRATIO 0.0f
+#define EAXBUFFER_MAXOCCLUSIONDIRECTRATIO 10.0f
+#define EAXBUFFER_DEFAULTOCCLUSIONDIRECTRATIO 1.0f
+
+#define EAXBUFFER_MINEXCLUSION (-10000)
+#define EAXBUFFER_MAXEXCLUSION 0
+#define EAXBUFFER_DEFAULTEXCLUSION 0
+
+#define EAXBUFFER_MINEXCLUSIONLFRATIO 0.0f
+#define EAXBUFFER_MAXEXCLUSIONLFRATIO 1.0f
+#define EAXBUFFER_DEFAULTEXCLUSIONLFRATIO 1.0f
+
+#define EAXBUFFER_MINOUTSIDEVOLUMEHF (-10000)
+#define EAXBUFFER_MAXOUTSIDEVOLUMEHF 0
+#define EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF 0
+
+#define EAXBUFFER_MINDOPPLERFACTOR 0.0f
+#define EAXBUFFER_MAXDOPPLERFACTOR 10.f
+#define EAXBUFFER_DEFAULTDOPPLERFACTOR 0.0f
+
+#define EAXBUFFER_MINROLLOFFFACTOR 0.0f
+#define EAXBUFFER_MAXROLLOFFFACTOR 10.f
+#define EAXBUFFER_DEFAULTROLLOFFFACTOR 0.0f
+
+#define EAXBUFFER_MINROOMROLLOFFFACTOR 0.0f
+#define EAXBUFFER_MAXROOMROLLOFFFACTOR 10.f
+#define EAXBUFFER_DEFAULTROOMROLLOFFFACTOR 0.0f
+
+#define EAXBUFFER_MINAIRABSORPTIONFACTOR 0.0f
+#define EAXBUFFER_MAXAIRABSORPTIONFACTOR 10.0f
+#define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f
+
+#define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \
+ EAXBUFFERFLAGS_ROOMAUTO | \
+ EAXBUFFERFLAGS_ROOMHFAUTO )
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif
diff --git a/milessdk/include/mss.h b/milessdk/include/mss.h
new file mode 100644
index 00000000..fbc91c73
--- /dev/null
+++ b/milessdk/include/mss.h
@@ -0,0 +1,4805 @@
+//############################################################################
+//## ##
+//## 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.1a"
+#define MSS_MAJOR_VERSION 6
+#define MSS_MINOR_VERSION 1
+#define MSS_SUB_VERSION 1
+#define MSS_VERSION_DATE "06-Mar-01"
+
+#define MSS_COPYRIGHT "Copyright (C) 1991-2001, 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
+// IS_LE for little endian (PCs)
+// IS_BE for big endian (Macs)
+// IS_X86 for Intel
+// IS_MAC for Mac
+// IS_PPC for PPC Mac
+// IS_68K for 68K Mac
+
+
+#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 IS_LE
+#undef IS_LE
+#endif
+
+#ifdef IS_BE
+#undef IS_BE
+#endif
+
+#ifdef IS_X86
+#undef IS_X86
+#endif
+
+#ifdef IS_MAC
+#undef IS_MAC
+#endif
+
+#ifdef IS_PPC
+#undef IS_PPC
+#endif
+
+#ifdef IS_68K
+#undef IS_68K
+#endif
+
+#ifdef __DOS__
+ #define IS_DOS
+ #define IS_32
+ #define IS_LE
+ #define IS_X86
+#else
+ #ifdef _WIN32
+ #define IS_WINDOWS
+ #define IS_WIN32
+ #define IS_32
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef WIN32
+ #define IS_WINDOWS
+ #define IS_WIN32
+ #define IS_32
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef __NT__
+ #define IS_WINDOWS
+ #define IS_WIN32
+ #define IS_32
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef __WIN32__
+ #define IS_WINDOWS
+ #define IS_WIN32
+ #define IS_32
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef _WINDOWS
+ #define IS_WINDOWS
+ #define IS_WIN16
+ #define IS_16
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef _WINDLL
+ #define IS_WINDOWS
+ #define IS_WIN16
+ #define IS_16
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef WINDOWS
+ #define IS_WINDOWS
+ #define IS_WIN16
+ #define IS_16
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef __WINDOWS__
+ #define IS_WINDOWS
+ #define IS_WIN16
+ #define IS_16
+ #define IS_LE
+ #define IS_X86
+ #else
+ #ifdef _Windows
+ #define IS_WINDOWS
+ #define IS_WIN16
+ #define IS_16
+ #define IS_LE
+ #define IS_X86
+ #else
+ #if defined(macintosh) || defined(__powerc) || defined(powerc) || defined(__POWERPC__) || defined(__MC68K__)
+ #define IS_MAC
+ #define IS_32
+ #define IS_BE
+ #if defined(__powerc) || defined(powerc) || defined(__POWERPC__)
+ #define IS_PPC
+ #else
+ #if defined(__MC68K__)
+ #define IS_68K
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+#endif
+
+#if (!defined(IS_LE) && !defined(IS_BE))
+ #error MSS.H did not detect your platform. Define __DOS__, _WINDOWS, WIN32, or macintosh.
+#endif
+
+
+#if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH
+ #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"
+
+#define MSS_DIR_SEP "\\"
+#define MSS_DIR_UP ".." MSS_DIR_SEP
+#define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
+
+#else
+
+#ifdef IS_WINDOWS
+
+#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
+
+ #if 1 /*def __BORLANDC__*/
+ #define DXDEC extern
+ #define DXDEF
+ #else
+ #define DXDEC __declspec(dllimport)
+ #endif
+
+ #endif
+
+ #define MSSDLLNAME "MSS32.DLL"
+ #define MSS_REDIST_DIR_NAME "WIN32"
+
+ #define MSS_DIR_SEP "\\"
+ #define MSS_DIR_UP ".." MSS_DIR_SEP
+ #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
+
+#else
+
+ #define AILEXPORT __export WINAPI
+
+ #define DXDEC extern
+ #define DXDEF
+
+ #define MSSDLLNAME "MSS16.DLL"
+ #define MSS_REDIST_DIR_NAME "WIN16"
+
+ #define MSS_DIR_SEP "\\"
+ #define MSS_DIR_UP ".." MSS_DIR_SEP
+ #define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_UP
+
+#endif
+
+#define AILCALL WINAPI
+#define AILCALLBACK AILEXPORT
+
+typedef LPVOID AILLPDIRECTSOUND;
+typedef LPVOID AILLPDIRECTSOUNDBUFFER;
+
+#else
+
+#ifdef IS_MAC
+
+#include <string.h>
+#include <Files.h>
+#include <Sound.h>
+#include <Resources.h> // needed for GetResource, ReleaseResource
+
+#define FAR
+
+#define AILLIBCALLBACK //pascal
+#define AILCALL //pascal
+#define AILEXPORT //pascal
+#define AILCALLBACK //pascal
+
+#ifdef BUILD_MSS
+ #define DXDEC __declspec(export)
+ #define DXDEF
+#else
+ #define DXDEC extern
+ #define DXDEF
+#endif
+
+#define MSS_REDIST_DIR_NAME "MAC"
+
+#define MSS_DIR_SEP ":"
+#define MSS_DIR_UP ":" MSS_DIR_SEP
+#define MSS_DIR_UP_TWO MSS_DIR_UP MSS_DIR_SEP
+
+#define HIWORD(ptr) (((U32)ptr)>>16)
+#define LOWORD(ptr) ((U16)((U32)ptr))
+
+#define FOURCC U32
+
+#ifndef MAKEFOURCC
+#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
+ (((U32)(U8)(ch0) << 24) | ((U32)(U8)(ch1) << 16) | \
+ ((U32)(U8)(ch2) << 8) | ((U32)(U8)(ch3) ))
+#endif
+
+#define mmioFOURCC(w,x,y,z) MAKEFOURCC(w,x,y,z)
+
+#define MSS_MAIN_DEF
+
+#endif
+
+#endif
+
+#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.
+#ifdef IS_MAC
+#define MAX_INSTR 150 // Max # of instruments 128 + 32
+#endif
+
+#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
+
+#ifdef IS_WINDOWS
+
+//
+// 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
+
+#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 131 // Resampling triggered at +/- 0.2%
+
+#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
+
+#ifdef IS_X86
+
+#define MDI_DOUBLE_NOTE_OFF 9
+#define DEFAULT_MDNO NO // For stuck notes on SB daughterboards
+
+#endif
+
+#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
+
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+
+#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.
+
+#endif
+
+#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 AIL_TIMERS 13
+#define DEFAULT_AT 16 // 16 allocatable HTIMER handles
+
+#define DIG_MAX_CHAIN_ELEMENT_SIZE 14
+#define DEFAULT_MCES 8192 // max of 8192 bytes/waveOut buffer
+
+#define DIG_MIN_CHAIN_ELEMENT_TIME 45
+#define DEFAULT_MCET 100 // 100 milliseconds buffers
+
+#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 NO // Don't suspend foreground thread by default
+
+#define AIL_WIN32S_CALLBACK_SIZE 19
+#define DEFAULT_WCS 4096 // Size of callback data in bytes
+
+#define AIL_MUTEX_PROTECTION 44
+#define DEFAULT_AMPR YES // Lock each call into Miles with a mutex
+
+#else
+
+#ifdef IS_DOS
+
+#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
+
+#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)
+
+#ifdef IS_X86
+
+#define AIL_ENABLE_MMX_SUPPORT 27 // Enable MMX support if present
+#define DEFAULT_AEMS YES // (may be changed at any time)
+
+#endif
+
+#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
+
+//
+// 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
+
+#ifdef IS_WINDOWS
+
+#define DIG_USE_WAVEIN 43
+#define DEFAULT_DUWI YES // Use waveIn for input by default
+
+#endif
+
+#define N_PREFS 46 // # of preference types
+
+typedef struct _AILSOUNDINFO {
+ S32 format;
+ void const FAR* data_ptr;
+ U32 data_len;
+ U32 rate;
+ S32 bits;
+ S32 channels;
+ U32 samples;
+ U32 block_size;
+ void const 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 const 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 const FAR *interface_name,
+ S32 entry_count,
+ RIB_INTERFACE_ENTRY const FAR *rlist);
+
+DXDEC RIBRESULT AILCALL RIB_unregister_interface (HPROVIDER provider,
+ C8 const FAR *interface_name,
+ S32 entry_count,
+ RIB_INTERFACE_ENTRY const FAR *rlist);
+
+DXDEC RIBRESULT AILCALL RIB_request_interface (HPROVIDER provider,
+ C8 const FAR *interface_name,
+ S32 entry_count,
+ RIB_INTERFACE_ENTRY FAR *rlist);
+
+DXDEC RIBRESULT AILCALL RIB_request_interface_entry (HPROVIDER provider,
+ C8 const FAR *interface_name,
+ RIB_ENTRY_TYPE entry_type,
+ C8 const 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 const FAR *interface_name,
+ C8 const FAR *attribute_name,
+ C8 const FAR *file_suffix);
+
+DXDEC HPROVIDER AILCALL RIB_find_provider (C8 const FAR *interface_name,
+ C8 const FAR *attribute_name,
+ C8 const FAR *attribute_value);
+
+DXDEC HPROVIDER AILCALL RIB_find_files_provider (C8 const FAR *interface_name,
+ C8 const FAR *attribute_name_1,
+ C8 const FAR *file_suffix_1,
+ C8 const FAR *attribute_name_2,
+ C8 const FAR *file_suffix_2);
+
+DXDEC HPROVIDER AILCALL RIB_find_file_dec_provider (C8 const FAR *interface_name,
+ C8 const FAR *attribute_name_1,
+ U32 attribute_value_1,
+ C8 const FAR *attribute_name_2,
+ C8 const FAR *file_suffix_2);
+
+DXDEC S32 AILCALL RIB_load_application_providers
+ (C8 const FAR *filespec);
+
+DXDEC void AILCALL RIB_set_provider_user_data (HPROVIDER provider,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL RIB_provider_user_data (HPROVIDER provider,
+ U32 index);
+
+DXDEC void AILCALL RIB_set_provider_system_data
+ (HPROVIDER provider,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL RIB_provider_system_data (HPROVIDER provider,
+ U32 index);
+
+DXDEC C8 FAR * AILCALL RIB_error (void);
+
+#endif
+
+#ifndef MSS_ASI_VERSION // MSSASI.H contents included if MSSASI.H not already included
+
+// #include "mssasi.h"
+
+#define AIL_ASI_VERSION 1
+#define AIL_ASI_REVISION 0
+
+//
+// Handle to stream being managed by ASI codec
+//
+
+typedef S32 HASISTREAM;
+
+//
+// ASI result codes
+//
+
+typedef S32 ASIRESULT;
+
+#define ASI_NOERR 0 // Success -- no error
+#define ASI_NOT_ENABLED 1 // ASI not enabled
+#define ASI_ALREADY_STARTED 2 // ASI already started
+#define ASI_INVALID_PARAM 3 // Invalid parameters used
+#define ASI_INTERNAL_ERR 4 // Internal error in ASI driver
+#define ASI_OUT_OF_MEM 5 // Out of system RAM
+#define ASI_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
+#define ASI_NOT_FOUND 7 // ASI supported device not found
+#define ASI_NOT_INIT 8 // ASI not initialized
+#define ASI_CLOSE_ERR 9 // ASI not closed correctly
+
+// ----------------------------------
+// Application-provided ASI callbacks
+// ----------------------------------
+
+//
+// AILASIFETCHCB: Called by ASI to obtain data from stream source
+//
+// offset normally will be either 0 at the first call made by the codec
+// or -1 to specify a continuous stream, except when ASI_stream_seek()
+// is called to restart the stream codec at a new stream offset. In this
+// case, the application must execute the seek operation on the ASI codec's
+// behalf.
+//
+// In response to this callback, the application should read the requested
+// data and copy it to the specified destination buffer, returning the number
+// of bytes copied (which can be less than bytes_requested if the end of
+// the stream is reached).
+//
+
+typedef S32 (AILCALLBACK FAR * AILASIFETCHCB) (U32 user, // User value passed to ASI_open_stream()
+ void FAR *dest, // Location to which stream data should be copied by app
+ S32 bytes_requested, // # of bytes requested by ASI codec
+ S32 offset); // If not -1, application should seek to this point in stream
+
+//############################################################################
+//## ##
+//## Interface "ASI codec" ##
+//## ##
+//############################################################################
+
+//
+// Initialize ASI stream codec
+//
+// No other ASI functions may be called outside an ASI_startup() /
+// ASI_shutdown() pair, except for the standard RIB function
+// PROVIDER_query_attribute(). All provider attributes must be accessible
+// without starting up the codec.
+//
+
+typedef ASIRESULT (AILCALL FAR *ASI_STARTUP)(void);
+
+//
+// Shut down ASI codec
+//
+
+typedef ASIRESULT (AILCALL FAR * ASI_SHUTDOWN)(void);
+
+//
+// Return codec error message, or NULL if no errors have occurred since
+// last call
+//
+// The ASI error text state is global to all streams
+//
+
+typedef C8 FAR * (AILCALL FAR * ASI_ERROR)(void);
+
+//############################################################################
+//## ##
+//## Interface "ASI stream" ##
+//## ##
+//############################################################################
+
+//
+// Open a stream, returning handle to stream
+//
+
+typedef HASISTREAM (AILCALL FAR *ASI_STREAM_OPEN) (U32 user, // User value passed to fetch callback
+ AILASIFETCHCB fetch_CB, // Source data fetch handler
+ U32 total_size); // Total size for %-done calculations (0=unknown)
+
+//
+// Translate data in stream, returning # of bytes actually decoded or encoded
+//
+// Any number of bytes may be requested. Requesting more data than is
+// available in the codec's internal buffer will cause the AILASIFETCHCB
+// handler to be called to fetch more data from the stream.
+//
+
+typedef S32 (AILCALL FAR *ASI_STREAM_PROCESS) (HASISTREAM stream, // Handle of stream
+ void FAR *buffer, // Destination for processed data
+ S32 buffer_size); // # of bytes to return in buffer
+
+//
+// Restart stream decoding process at new offset
+//
+// Relevant for decoders only
+//
+// Seek destination is given as offset in bytes from beginning of stream
+//
+// At next ASI_stream_process() call, decoder will seek to the closest possible
+// point in the stream which occurs at or after the specified position
+//
+// This function has no effect for decoders which do not support random
+// seeks on a given stream type
+//
+// Warning: some decoders may need to implement seeking by reparsing
+// the entire stream up to the specified offset, through multiple calls
+// to the data-fetch callback. This operation may be extremely
+// time-consuming on large files or slow network connections.
+//
+// A stream_offset value of -1 may be used to inform the decoder that the
+// application has changed the input stream offset on its own, e.g. for a
+// double-buffering application where the ASI decoder is not accessing the
+// stream directly. ASI decoders should respond to this by flushing all
+// internal buffers and resynchronizing themselves to the data stream.
+//
+
+typedef ASIRESULT (AILCALL FAR *ASI_STREAM_SEEK) (HASISTREAM stream,
+ S32 stream_offset);
+
+//
+// Retrieve an ASI stream attribute or preference value by index
+//
+
+typedef S32 (AILCALL FAR *ASI_STREAM_ATTRIBUTE) (HASISTREAM stream,
+ HATTRIB attrib);
+
+//
+// Set an ASI stream preference value by index
+//
+
+typedef S32 (AILCALL FAR *ASI_STREAM_SET_PREFERENCE) (HASISTREAM stream,
+ HATTRIB preference,
+ void const FAR * value);
+
+//
+// Close stream, freeing handle and all internally-allocated resources
+//
+
+typedef ASIRESULT (AILCALL FAR *ASI_STREAM_CLOSE) (HASISTREAM stream);
+
+#endif
+
+//############################################################################
+//## ##
+//## Interface "MSS 3D audio services" ##
+//## ##
+//############################################################################
+
+//
+// 3D positioning services
+//
+
+
+typedef struct h3DPOBJECT
+{
+ U32 junk;
+} h3DPOBJECT;
+
+typedef h3DPOBJECT FAR * H3DPOBJECT;
+typedef H3DPOBJECT H3DSAMPLE;
+
+//
+// M3D result codes
+//
+
+typedef S32 M3DRESULT;
+
+#define M3D_NOERR 0 // Success -- no error
+#define M3D_NOT_ENABLED 1 // M3D not enabled
+#define M3D_ALREADY_STARTED 2 // M3D already started
+#define M3D_INVALID_PARAM 3 // Invalid parameters used
+#define M3D_INTERNAL_ERR 4 // Internal error in M3D driver
+#define M3D_OUT_OF_MEM 5 // Out of system RAM
+#define M3D_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
+#define M3D_NOT_FOUND 7 // M3D supported device not found
+#define M3D_NOT_INIT 8 // M3D not initialized
+#define M3D_CLOSE_ERR 9 // M3D not closed correctly
+
+
+typedef void (AILCALLBACK FAR* AIL3DSAMPLECB) (H3DSAMPLE sample);
+
+typedef M3DRESULT (AILCALL FAR *M3D_STARTUP)(void);
+
+typedef M3DRESULT (AILCALL FAR *M3D_SHUTDOWN)(void);
+
+typedef C8 FAR * (AILCALL FAR *M3D_ERROR)(void);
+
+typedef S32 (AILCALL FAR *M3D_SET_PROVIDER_PREFERENCE)(HATTRIB preference,
+ void const FAR * value);
+
+typedef M3DRESULT (AILCALL FAR * M3D_ACTIVATE)(S32 enable);
+
+typedef H3DSAMPLE (AILCALL FAR * M3D_ALLOCATE_3D_SAMPLE_HANDLE)(void);
+
+
+typedef void (AILCALL FAR * M3D_RELEASE_3D_SAMPLE_HANDLE)(H3DSAMPLE samp);
+
+
+typedef void (AILCALL FAR * M3D_START_3D_SAMPLE)(H3DSAMPLE samp);
+
+
+typedef void (AILCALL FAR * M3D_STOP_3D_SAMPLE)(H3DSAMPLE samp);
+
+
+typedef void (AILCALL FAR * M3D_RESUME_3D_SAMPLE)(H3DSAMPLE samp);
+
+typedef void (AILCALL FAR * M3D_END_3D_SAMPLE)(H3DSAMPLE samp);
+
+typedef S32 (AILCALL FAR * M3D_SET_3D_SAMPLE_DATA)(H3DSAMPLE samp,
+ AILSOUNDINFO const FAR *info);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_VOLUME)(H3DSAMPLE samp,
+ S32 volume);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp,
+ S32 playback_rate);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OFFSET)(H3DSAMPLE samp,
+ U32 offset);
+
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp,
+ U32 loops);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_LOOP_BLOCK)(H3DSAMPLE S,
+ S32 loop_start_offset,
+ S32 loop_end_offset);
+
+typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_STATUS)(H3DSAMPLE samp);
+
+typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_ATTRIBUTE)(H3DSAMPLE samp, HATTRIB index);
+
+typedef S32 (AILCALL FAR * M3D_3D_SET_SAMPLE_PREFERENCE)(H3DSAMPLE samp, HATTRIB preference, void const FAR * value);
+
+typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_VOLUME)(H3DSAMPLE samp);
+
+typedef S32 (AILCALL FAR * M3D_3D_SAMPLE_PLAYBACK_RATE)(H3DSAMPLE samp);
+
+typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_OFFSET)(H3DSAMPLE samp);
+
+typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LENGTH)(H3DSAMPLE samp);
+
+typedef U32 (AILCALL FAR * M3D_3D_SAMPLE_LOOP_COUNT)(H3DSAMPLE samp);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp,
+ F32 max_dist,
+ F32 min_dist);
+
+
+typedef void (AILCALL FAR * M3D_3D_SAMPLE_DISTANCES)(H3DSAMPLE samp,
+ F32 FAR * max_dist,
+ F32 FAR * min_dist);
+
+typedef S32 (AILCALL FAR * M3D_ACTIVE_3D_SAMPLE_COUNT)(void);
+
+typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_LISTENER)(void);
+
+typedef void (AILCALL FAR * M3D_3D_CLOSE_LISTENER)(H3DPOBJECT listener);
+
+typedef H3DPOBJECT (AILCALL FAR * M3D_3D_OPEN_OBJECT)(void);
+
+typedef void (AILCALL FAR * M3D_3D_CLOSE_OBJECT)(H3DPOBJECT obj);
+
+typedef void (AILCALL FAR * M3D_SET_3D_POSITION)(H3DPOBJECT obj,
+ F32 X,
+ F32 Y,
+ F32 Z);
+
+typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY)(H3DPOBJECT obj,
+ F32 dX_per_ms,
+ F32 dY_per_ms,
+ F32 dZ_per_ms,
+ F32 magnitude);
+
+typedef void (AILCALL FAR * M3D_SET_3D_VELOCITY_VECTOR)(H3DPOBJECT obj,
+ F32 dX_per_ms,
+ F32 dY_per_ms,
+ F32 dZ_per_ms);
+
+typedef void (AILCALL FAR * M3D_SET_3D_ORIENTATION)(H3DPOBJECT obj,
+ F32 X_face,
+ F32 Y_face,
+ F32 Z_face,
+ F32 X_up,
+ F32 Y_up,
+ F32 Z_up);
+
+typedef void (AILCALL FAR * M3D_3D_POSITION)(H3DPOBJECT obj,
+ F32 FAR *X,
+ F32 FAR *Y,
+ F32 FAR *Z);
+
+typedef void (AILCALL FAR * M3D_3D_VELOCITY)(H3DPOBJECT obj,
+ F32 FAR *dX_per_ms,
+ F32 FAR *dY_per_ms,
+ F32 FAR *dZ_per_ms);
+
+typedef void (AILCALL FAR * M3D_3D_ORIENTATION)(H3DPOBJECT obj,
+ F32 FAR *X_face,
+ F32 FAR *Y_face,
+ F32 FAR *Z_face,
+ F32 FAR *X_up,
+ F32 FAR *Y_up,
+ F32 FAR *Z_up);
+
+typedef void (AILCALL FAR * M3D_3D_UPDATE_POSITION)(H3DPOBJECT obj,
+ F32 dt_milliseconds);
+
+typedef void (AILCALL FAR * M3D_3D_AUTO_UPDATE_POSITION)(H3DPOBJECT obj,
+ S32 enable);
+
+typedef S32 (AILCALL FAR * M3D_3D_ROOM_TYPE)(void);
+typedef void (AILCALL FAR * M3D_SET_3D_ROOM_TYPE)(S32 EAX_room_type);
+typedef S32 (AILCALL FAR * M3D_3D_SPEAKER_TYPE)(void);
+typedef void (AILCALL FAR * M3D_SET_3D_SPEAKER_TYPE)(S32 speaker_type);
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp, F32 obstruction);
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp, F32 occlusion);
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp, F32 effects_level);
+typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OBSTRUCTION)(H3DSAMPLE samp);
+typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_OCCLUSION)(H3DSAMPLE samp);
+typedef F32 (AILCALL FAR * M3D_3D_SAMPLE_EFFECTS_LEVEL)(H3DSAMPLE samp);
+
+typedef AIL3DSAMPLECB (AILCALL FAR * M3D_SET_3D_EOS)(H3DSAMPLE client,H3DSAMPLE samp,AIL3DSAMPLECB cb);
+
+typedef void (AILCALL FAR * M3D_SET_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 inner_angle, F32 outer_angle, S32 outer_volume);
+typedef void (AILCALL FAR * M3D_3D_SAMPLE_CONE)(H3DSAMPLE samp, F32 FAR* inner_angle, F32 FAR* outer_angle, S32 FAR* outer_volume);
+
+//############################################################################
+//## ##
+//## Interface "MSS mixer services" ##
+//## ##
+//############################################################################
+
+//
+// Operation flags used by mixer module
+//
+
+#define M_DEST_STEREO 1 // Set to enable stereo mixer output
+#define M_SRC_16 2 // Set to enable mixing of 16-bit samples
+#define M_FILTER 4 // Set to enable filtering when resampling
+#define M_SRC_STEREO 8 // Set to enable mixing of stereo input samples
+#define M_VOL_SCALING 16 // Set to enable volume scalars other than 2047
+#define M_RESAMPLE 32 // Set to enable playback ratios other than 65536
+#define M_ORDER 64 // Set to reverse L/R stereo order for sample
+
+#ifdef IS_32
+
+//
+// Initialize mixer
+//
+// No other mixer functions may be called outside a MIXER_startup() /
+// MIXER_shutdown() pair, except for the standard RIB function
+// PROVIDER_query_attribute(). All provider attributes must be accessible
+// without starting up the module.
+//
+
+typedef void (AILCALL FAR *MIXER_STARTUP)(void);
+
+//
+// Shut down mixer
+//
+
+typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
+
+//
+// Flush mixer buffer
+//
+
+typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
+ S32 len,
+ S32 FAR *reverb_buffer,
+ S32 reverb_level
+#ifdef IS_X86
+ ,U32 MMX_available
+#endif
+ );
+
+//
+// Perform audio mixing operation
+//
+
+typedef void (AILCALL FAR *MIXER_MERGE) (void const FAR * FAR *src,
+ U32 FAR *src_fract,
+ void const FAR *src_end,
+ S32 FAR * FAR *dest,
+ void FAR *dest_end,
+ S32 FAR *left_val,
+ S32 FAR *right_val,
+ S32 playback_ratio,
+ S32 scale_left,
+ S32 scale_right,
+ U32 operation
+#ifdef IS_X86
+ ,U32 MMX_available
+#endif
+ );
+
+//
+// Translate mixer buffer contents to final output format
+//
+
+#ifdef IS_MAC
+
+typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src,
+ S32 src_len,
+ void FAR *dest,
+ U32 operation,
+ U32 big_endian_output);
+#else
+
+typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src,
+ S32 src_len,
+ void FAR *dest,
+ U32 operation,
+ U32 MMX_available);
+#endif
+#else
+
+//
+// Initialize mixer
+//
+// No other mixer functions may be called outside a MIXER_startup() /
+// MIXER_shutdown() pair, except for the standard RIB function
+// PROVIDER_query_attribute(). All provider attributes must be accessible
+// without starting up the module.
+//
+
+typedef void (AILCALL FAR *MIXER_STARTUP)(void);
+
+//
+// Shut down mixer
+//
+
+typedef void (AILCALL FAR *MIXER_SHUTDOWN)(void);
+
+//
+// Flush mixer buffer
+//
+
+typedef void (AILCALL FAR *MIXER_FLUSH) (S32 FAR *dest,
+ S32 len,
+ S32 FAR *reverb_buffer,
+ S32 reverb_level,
+ U32 MMX_available);
+
+//
+// Perform audio mixing operation
+//
+
+typedef void (AILCALL FAR *MIXER_MERGE) (U32 src_sel,
+ U32 dest_sel,
+ U32 FAR *src_fract,
+ U32 FAR *src_offset,
+ U32 FAR *dest_offset,
+ U32 src_end_offset,
+ U32 dest_end_offset,
+ S32 FAR *left_val,
+ S32 FAR *right_val,
+ S32 playback_ratio,
+ S32 scale_both,
+ U32 operation);
+
+//
+// Translate mixer buffer contents to final output format
+//
+
+typedef void (AILCALL FAR *MIXER_COPY) (void const FAR *src,
+ S32 src_len,
+ void FAR *dest,
+ U32 operation,
+ U32 MMX_available);
+#endif
+
+//
+// Type definitions
+//
+
+struct _DIG_DRIVER;
+
+struct _MDI_DRIVER;
+
+typedef struct _DIG_DRIVER FAR * HDIGDRIVER; // Handle to digital driver
+
+typedef struct _MDI_DRIVER FAR * HMDIDRIVER; // Handle to XMIDI driver
+
+typedef struct _SAMPLE FAR * HSAMPLE; // Handle to sample
+
+typedef struct _SEQUENCE FAR * HSEQUENCE; // Handle to sequence
+
+typedef S32 HTIMER; // Handle to timer
+
+
+#ifdef IS_DOS
+
+//
+// Type definitions
+//
+
+typedef struct // I/O parameters structure
+{
+ S16 IO;
+ S16 IRQ;
+ S16 DMA_8_bit;
+ S16 DMA_16_bit;
+ S32 IO_reserved[4];
+}
+IO_PARMS;
+
+typedef struct // Standard MSS 3.X VDI driver header
+{
+ S8 ID[8]; // "AIL3xxx" ID string, followed by ^Z
+
+ U32 driver_version;
+
+ REALFAR common_IO_configurations;
+ U16 num_IO_configurations;
+
+ REALFAR environment_string;
+
+ IO_PARMS IO;
+
+ S16 service_rate;
+
+ U16 busy;
+
+ U16 driver_num; // Driver number
+
+ U16 this_ISR; // Offset of INT 66H dispatcher
+ REALFAR prev_ISR; // Pointer to previous INT 66H ISR
+
+ S8 scratch[128]; // Shared scratch workspace
+
+ S8 dev_name[80]; // Device name (VDI version >= 1.12 only)
+}
+VDI_HDR;
+
+typedef struct
+{
+ U16 minimum_physical_sample_rate;
+ U16 nominal_physical_sample_rate;
+ U16 maximum_physical_sample_rate;
+
+ U16 minimum_DMA_half_buffer_size;
+ U16 maximum_DMA_half_buffer_size;
+
+ U32 flags;
+}
+DIG_MODE;
+
+typedef struct
+{
+ U8 format_supported[16];
+ DIG_MODE format_data[16];
+}
+DIG_DDT;
+
+typedef struct
+{
+ REALFAR DMA_buffer_A;
+ REALFAR DMA_buffer_B;
+ S16 active_buffer;
+}
+DIG_DST;
+
+typedef struct
+{
+ REALFAR library_environment;
+ REALFAR GTL_suffix;
+
+ U16 num_voices;
+
+ U16 max_melodic_channel;
+ U16 min_melodic_channel;
+ U16 percussion_channel;
+}
+MDI_DDT;
+
+typedef struct
+{
+ S8 library_directory[128];
+ S8 GTL_filename[128];
+
+ S8 MIDI_data[512];
+}
+MDI_DST;
+
+typedef struct // Initialization file structure
+{
+ char device_name[128]; // Device name
+ char driver_name[128]; // Driver filename
+ IO_PARMS IO; // I/O parameters for driver
+}
+AIL_INI;
+
+typedef struct // Handle to driver
+{
+ REALFAR seg; // Seg:off pointer to driver (off=0)
+ U32 sel; // Selector for driver (off=0)
+ void *buf; // Protected-mode pointer to driver
+ U32 size; // Size of driver image
+ VDI_HDR *VHDR; // Pointer to driver header (same as buf)
+ S32 type; // AIL3DIG or AIL3MDI (see below)
+
+ S32 initialized; // 1 if hardware successfully init'd, else 0
+
+ S32 PM_ISR; // -1 if no PM ISR hooked, else IRQ #
+
+ HTIMER server; // DRV_SERVE periodic timer, if requested
+
+ // Vector to high-level destructor, if any
+
+ void (AILCALL *destructor)(HDIGDRIVER);
+
+ // High-level descriptor (DIG_ or MDI_DRIVER)
+ void *descriptor;
+}
+AIL_DRIVER;
+
+typedef struct // VDI interface register structure
+{
+ S16 AX;
+ S16 BX;
+ S16 CX;
+ S16 DX;
+ S16 SI;
+ S16 DI;
+}
+VDI_CALL;
+
+#endif
+
+//
+// Function pointer types
+//
+
+typedef void (AILCALLBACK FAR* AILINCB) (void const FAR *data, S32 len, U32 user_data);
+
+typedef void (AILCALLBACK FAR* AILTIMERCB) (U32 user);
+
+typedef void (AILCALLBACK FAR* AILSAMPLECB) (HSAMPLE sample);
+
+typedef S32 (AILCALLBACK FAR* AILEVENTCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 status,S32 data_1,S32 data_2);
+
+typedef S32 (AILCALLBACK FAR* AILTIMBRECB) (HMDIDRIVER hmi,S32 bank,S32 patch);
+
+typedef S32 (AILCALLBACK FAR* AILPREFIXCB) (HSEQUENCE seq,S32 log,S32 data);
+
+typedef void (AILCALLBACK FAR* AILTRIGGERCB) (HSEQUENCE seq,S32 log,S32 data);
+
+typedef void (AILCALLBACK FAR* AILBEATCB) (HMDIDRIVER hmi,HSEQUENCE seq,S32 beat,S32 measure);
+
+typedef void (AILCALLBACK FAR* AILSEQUENCECB) (HSEQUENCE seq);
+
+//
+// Handle to sample and driver being managed by pipeline filter
+//
+
+typedef S32 HSAMPLESTATE;
+typedef S32 HDRIVERSTATE;
+
+//
+// Digital pipeline stages
+//
+// These are the points at which external modules may be installed into
+// a given HSAMPLE or HDIGDRIVER's processing pipeline
+//
+
+typedef enum
+{
+ DP_ASI_DECODER=0, // Must be "ASI codec stream" provider
+ DP_FILTER, // Must be "MSS pipeline filter" provider
+ DP_MERGE, // Must be "MSS mixer" provider
+ N_SAMPLE_STAGES, // Placeholder for end of list (= # of valid stages)
+ SAMPLE_ALL_STAGES // Used to signify all pipeline stages, for shutdown
+}
+SAMPLESTAGE;
+
+typedef enum
+{
+ DP_FLUSH = 0, // Must be "MSS mixer" provider
+ DP_DEFAULT_FILTER, // Must be "MSS pipeline filter" provider (sets the default)
+ DP_DEFAULT_MERGE, // Must be "MSS mixer" provider (sets the default)
+ DP_COPY, // Must be "MSS mixer" provider
+ N_DIGDRV_STAGES, // Placeholder for end of list (= # of valid stages)
+ DIGDRV_ALL_STAGES // Used to signify all pipeline stages, for shutdown
+}
+DIGDRVSTAGE;
+
+typedef struct
+ {
+ ASI_STREAM_OPEN ASI_stream_open;
+ ASI_STREAM_PROCESS ASI_stream_process;
+ ASI_STREAM_SEEK ASI_stream_seek;
+ ASI_STREAM_CLOSE ASI_stream_close;
+ ASI_STREAM_ATTRIBUTE ASI_stream_attribute;
+ ASI_STREAM_SET_PREFERENCE ASI_stream_set_preference;
+
+ HATTRIB INPUT_BIT_RATE;
+ HATTRIB INPUT_SAMPLE_RATE;
+ HATTRIB INPUT_BITS;
+ HATTRIB INPUT_CHANNELS;
+ HATTRIB OUTPUT_BIT_RATE;
+ HATTRIB OUTPUT_SAMPLE_RATE;
+ HATTRIB OUTPUT_BITS;
+ HATTRIB OUTPUT_CHANNELS;
+ HATTRIB POSITION;
+ HATTRIB PERCENT_DONE;
+ HATTRIB MIN_INPUT_BLOCK_SIZE;
+ HATTRIB RAW_RATE;
+ HATTRIB RAW_BITS;
+ HATTRIB RAW_CHANNELS;
+ HATTRIB REQUESTED_RATE;
+ HATTRIB REQUESTED_BITS;
+ HATTRIB REQUESTED_CHANS;
+
+ HASISTREAM stream;
+ }
+ASISTAGE;
+
+typedef struct
+ {
+ MIXER_FLUSH MSS_mixer_flush;
+ MIXER_MERGE MSS_mixer_merge;
+ MIXER_COPY MSS_mixer_copy;
+ }
+MIXSTAGE;
+
+typedef struct
+ {
+ struct _FLTPROVIDER FAR *provider;
+ HSAMPLESTATE sample_state;
+ }
+FLTSTAGE;
+
+typedef struct
+{
+ S32 active; // Pass-through if 0, active if 1
+ HPROVIDER provider;
+
+ union
+ {
+ ASISTAGE ASI;
+ MIXSTAGE MIX;
+ FLTSTAGE FLT;
+ }
+ TYPE;
+}
+DPINFO;
+
+//
+// Other data types
+//
+
+typedef struct _AIL_INPUT_INFO // Input descriptor type
+{
+ U32 device_ID; // DS LPGUID or wave device ID
+ U32 hardware_format; // e.g., DIG_F_STEREO_16
+ U32 hardware_rate; // e.g., 22050
+ AILINCB callback; // Callback function to receive incoming data
+ S32 buffer_size; // Maximum # of bytes to be passed to callback (-1 to use DIG_INPUT_LATENCY)
+ U32 user_data; // this is a user defined value
+}
+AIL_INPUT_INFO;
+
+typedef struct _AILTIMER // Timer instance
+{
+ U32 status;
+ AILTIMERCB callback;
+ U32 user;
+
+ S32 elapsed;
+ S32 value;
+ S32 callingCT; // Calling EXE's task number (16 bit only)
+ S32 callingDS; // Calling EXE's DS (used in 16 bit only)
+ S32 IsWin32s; // Is this a Win32s callback
+} AILTIMERSTR;
+
+typedef struct _ADPCMDATATAG
+{
+ U32 blocksize;
+ U32 extrasamples;
+ U32 blockleft;
+ U32 step;
+ U32 savesrc;
+ U32 sample;
+ U32 destend;
+ U32 srcend;
+ U32 samplesL;
+ U32 samplesR;
+ U16 moresamples[16];
+} ADPCMDATA;
+
+typedef struct _SAMPLE // Sample instance
+{
+ char tag[4]; // HSAM
+
+ HDIGDRIVER driver; // Driver for playback
+
+ U32 status; // SMP_ flags: _FREE, _DONE, _PLAYING
+
+ void const FAR *start[2]; // Sample buffer address (W)
+ U32 len [2]; // Sample buffer size in bytes (W)
+ U32 pos [2]; // Index to next byte (R/W)
+ U32 done [2]; // Nonzero if buffer with len=0 sent by app
+ S32 reset_ASI [2]; // Reset the ASI decoder at the end of the buffer
+
+ U32 src_fract; // Fractional part of source address
+ S32 left_val; // Mixer source value from end of last buffer
+ S32 right_val; // Mixer source value from end of last buffer
+
+ S32 current_buffer; // Buffer # active (0/1)
+ S32 last_buffer; // Last active buffer (for double-buffering)
+ S32 starved; // Buffer stream has run out of data
+
+ S32 loop_count; // # of cycles-1 (1=one-shot, 0=indefinite)
+ S32 loop_start; // Starting offset of loop block (0=SOF)
+ S32 loop_end; // End offset of loop block (-1=EOF)
+
+ S32 format; // DIG_F format (8/16 bits, mono/stereo)
+ U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo only)
+
+ S32 playback_rate; // Playback rate in hertz
+
+ S32 volume; // Sample volume 0-127
+ S32 pan; // Mono panpot/stereo balance (0=L ... 127=R)
+
+ S32 left_scale; // Left/mono volume scalar 0-2047
+ S32 right_scale; // Right volume scalar 0-2047
+
+ S32 service_type; // 1 if single-buffered; 2 if streamed
+
+ AILSAMPLECB SOB; // Start-of-block callback function
+ AILSAMPLECB EOB; // End-of-buffer callback function
+ AILSAMPLECB EOS; // End-of-sample callback function
+
+ S32 user_data [8]; // Miscellaneous user data
+ S32 system_data[8]; // Miscellaneous system data
+
+ ADPCMDATA adpcm;
+
+#ifdef IS_WINDOWS
+
+ S32 SOB_IsWin32s; // Is this a Win32s callback
+ S32 EOB_IsWin32s; // Is this a Win32s callback
+ S32 EOS_IsWin32s; // Is this a Win32s callback
+
+ //
+ // DirectSound-specific data
+ //
+
+ S32 secondary_buffer; // Secondary buffer index
+
+ S32 service_interval; // Service sample every n ms
+ S32 service_tick; // Current service countdown value
+ S32 buffer_segment_size; // Buffer segment size to fill
+
+ S32 prev_segment; // Previous segment # (0...n)
+ S32 prev_cursor; // Previous play cursor location
+
+ S32 bytes_remaining; // # of bytes left to play (if not -1)
+
+ S32 direct_control; // 1 if app controls buffer, 0 if MSS
+
+#endif
+
+ S32 doeob; // Flags to trigger callbacks
+ S32 dosob;
+ S32 doeos;
+
+ //
+ // Sample pipeline stages
+ //
+
+ DPINFO pipeline[N_SAMPLE_STAGES];
+
+ //
+ // Reverb parms
+ //
+
+ F32 reverb_level; // Level [0.0, 1.0]
+ F32 reverb_reflect_time; // Reflect time in milliseconds
+ F32 reverb_decay_time; // Decay time [0.1, 20.0]
+ S32 base_scale; // Original 12-bit volume scalar
+}
+SAMPLE;
+
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+
+DXDEC U32 AILCALL AIL_get_timer_highest_delay (void);
+
+DXDEC void AILCALL AIL_serve(void);
+
+#ifdef IS_MAC
+
+typedef void * LPSTR;
+
+#define WHDR_DONE 0
+
+typedef struct _WAVEIN
+{
+ long temp;
+} * HWAVEIN;
+
+typedef struct _WAVEHDR
+{
+ S32 dwFlags;
+ S32 dwBytesRecorded;
+ S32 dwUser;
+ S32 temp;
+ void * lpData;
+ S32 dwBufferLength;
+ S32 longdwLoops;
+ S32 dwLoops;
+ void * lpNext;
+ U32 * reserved;
+
+} WAVEHDR, * LPWAVEHDR;
+
+#endif
+
+typedef struct _DIG_INPUT_DRIVER FAR *HDIGINPUT; // Handle to digital input driver
+
+typedef struct _DIG_INPUT_DRIVER // Handle to digital input driver
+{
+ C8 tag[4]; // HDIN
+
+ HTIMER background_timer; // Background timer handle
+
+ AIL_INPUT_INFO info; // Input device descriptor
+
+ S32 input_enabled; // 1 if enabled, 0 if not
+
+#ifndef IS_MAC
+
+ U32 callback_user; // Callback user value
+
+ //
+ // Provider-independent data
+ //
+
+ U32 DMA_size; // Size of each DMA sub-buffer in bytes
+ void FAR *DMA[2]; // Simulated DMA buffers
+
+ U8 silence; // Silence value for current format (0 or 128)
+
+ S32 device_active; // 1 if buffers submittable, 0 if not
+
+ //
+ // waveOut-specific data
+ //
+
+ HWAVEIN hWaveIn; // Handle to wave input device
+ volatile WAVEHDR wavehdr[2]; // Handles to wave headers
+
+#else
+ Boolean timer_started;
+ Boolean locked;
+ Boolean enter_lock;
+ U32 saved_period;
+
+ void* my_vars;
+
+ //
+ // Input related
+ //
+
+ U32 input_buffer_size;
+ char * input_buffers[2];
+
+ //
+ // Mix related
+ //
+
+ char * build_buffer;
+ U32 build_buffer_size;
+
+ //
+ // Output related
+ //
+ struct
+ {
+ S8 * buffer;
+ S8 * buffer_end;
+
+ U32 size;
+ S8 * right_margine;
+ S8 * current_head;
+ S8 * current_tail;
+ } output_buffer;
+
+ S32 mix_operation;
+ S32 playback_ratio;
+ U32 src_fract;
+ S8 * current_head;
+ S32 left_val;
+ S32 right_val;
+
+ U32 stored_sample_size;
+ U32 stored_number_of_channels;
+
+ U32 last_rw_delta;
+ U32 period;
+
+#endif
+}
+DIG_INPUT_DRIVER;
+
+#endif
+
+typedef struct _DIG_DRIVER // Handle to digital audio driver
+{
+ char tag[4]; // HDIG
+
+ HTIMER backgroundtimer; // Background timer handle
+
+ S32 quiet; // # of consecutive quiet sample periods
+
+ S32 n_active_samples; // # of samples being processed
+
+ S32 master_volume; // Master sample volume 0-127
+
+ S32 DMA_rate; // Hardware sample rate
+ S32 hw_format; // DIG_F code in use
+ U32 hw_mode_flags; // DIG_PCM_ flags for mode in use
+
+ S32 channels_per_sample; // # of channels per sample (1 or 2)
+ S32 bytes_per_channel; // # of bytes per channel (1 or 2)
+ S32 channels_per_buffer; // # of channels per half-buffer
+ S32 samples_per_buffer; // # of samples per half-buffer
+
+ S32 playing; // Playback active if non-zero
+
+#ifdef IS_MAC
+ U32 n_samples_allocated;
+ U32 n_samples_used;
+ U32 n_samples_played;
+ SAMPLE *samples; // Pointer to SAMPLEs
+
+ HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
+ U32 reset_works; // TRUE if OK to do waveOutReset
+ U32 request_reset; // If nonzero, do waveOutReset ASAP
+ S32 released; // has the sound manager been released?
+
+ ExtSoundHeader sound_header;
+ SndChannelPtr sound_channel;
+ SndCallBackUPP global_callback;
+ Ptr buffers[2];
+ Boolean loaded[2];
+ U32 work_buffer;
+ U32 play_buffer;
+ U32 load_pos;
+ U32 load_size;
+ Boolean load;
+ U32 start_time;
+ void* background_processor;
+
+#else
+ HSAMPLE samples; // Pointer to list of SAMPLEs
+#endif
+
+ S32 n_samples; // # of SAMPLEs
+
+ S32 build_size; // # of bytes in build buffer
+ S32 FAR *build_buffer; // Build buffer (4 * samples_per_buffer)
+
+ S32 system_data[8]; // Miscellaneous system data
+
+ S32 buffer_size; // Size of each output buffer
+
+#ifdef IS_WINDOWS
+
+ //
+ // waveOut-specific interface data
+ //
+
+ HWAVEOUT hWaveOut; // Wave output driver
+
+ U32 reset_works; // TRUE if OK to do waveOutReset
+ U32 request_reset; // If nonzero, do waveOutReset ASAP
+
+ LPWAVEHDR first; // Pointer to first WAVEHDR in chain
+ S32 n_buffers; // # of output WAVEHDRs in chain
+
+ LPWAVEHDR volatile FAR *return_list; // Circular list of returned WAVEHDRs
+ S32 volatile return_head; // Head of WAVEHDR list (insertion point)
+ S32 volatile return_tail; // Tail of WAVEHDR list (retrieval point)
+
+
+ U32 deviceid; // id from waveout open
+ PCMWAVEFORMAT wformat; // format from waveout open
+
+ //
+ // DirectSound-specific interface data
+ //
+
+ U32 guid; // The guid id of the ds driver
+ AILLPDIRECTSOUND pDS; // DirectSound output driver (don't
+ // use with Smacker directly anymore!)
+
+ U32 ds_priority; // priority opened with
+
+ S32 emulated_ds; // is ds emulated or not?
+ AILLPDIRECTSOUNDBUFFER lppdsb; // primary buffer or null
+
+ U32 dsHwnd; // HWND used with DirectSound
+
+ AILLPDIRECTSOUNDBUFFER FAR * lpbufflist; // List of pointers to secondary buffers
+ HSAMPLE FAR *samp_list; // HSAMPLE associated with each buffer
+ S32 FAR *sec_format; // DIG_F_ format for secondary buffer
+ S32 max_buffs; // Max. allowable # of secondary buffers
+
+ //
+ // Misc. data
+ //
+
+ S32 released; // has the sound manager been released?
+
+ U32 foreground_timer; // Foreground timer handle
+
+ HDIGDRIVER next; // Pointer to next HDIGDRIVER in use
+ S32 callingCT; // Calling EXE's task number (16 bit only)
+ S32 callingDS; // Calling EXE's DS (used in 16 bit only)
+
+ //
+ // Vars for waveOut emulation
+ //
+
+ S32 DS_initialized;
+
+ AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none)
+ AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim)
+ S32 DS_buffer_size; // Size of entire output buffer
+
+ S32 DS_frag_cnt; // Total fragment count and size, and
+ S32 DS_frag_size; // last fragment occupied by play cursor
+ S32 DS_last_frag;
+ S32 DS_last_write;
+ S32 DS_last_timer;
+ S32 DS_skip_time;
+
+ S32 DS_use_default_format; // 1 to force use of default DS primary buffer format
+
+#else
+
+ #ifdef IS_DOS
+
+ // must be first in the DOS section
+ void *DMA[2]; // Protected-mode pointers to half-buffers
+ // (note that DMA[0] may != DMA_buf)
+
+
+ REALFAR DMA_seg; // Seg:off pointer to DMA buffers (off=0)
+ U32 DMA_sel; // Selector for DMA buffers (off=0)
+ void *DMA_buf; // Protected-mode pointer to DMA buffers
+
+ S16 *buffer_flag; // Protected-mode pointer to buffer flag
+ S32 last_buffer; // Last active buffer flag value in driver
+
+ AIL_DRIVER *drvr; // Base driver descriptor
+
+ DIG_DDT *DDT; // Protected-mode pointer to DDT
+ DIG_DST *DST; // Protected-mode pointer to DST
+
+ #endif
+
+#endif
+
+#ifdef IS_X86
+ S32 use_MMX; // Use MMX with this driver if TRUE
+#endif
+
+ void FAR *decode_buffer; // Buffer used by optional ASI pipeline decoder
+ S32 decode_buffer_size; // # of bytes in decode buffer
+
+ U32 us_count;
+ U32 ms_count;
+ U32 last_ms_polled;
+ U32 last_percent;
+
+ //
+ // Digital driver pipeline stages
+ //
+
+ DPINFO pipeline[N_DIGDRV_STAGES];
+
+ //
+ // Reverb buffer
+ //
+
+ S32 FAR *reverb_buffer;
+ S32 reverb_buffer_size;
+ S32 reverb_buffer_position;
+
+#ifdef IS_WINDOWS
+ S32 no_wom_done; // don't process WOM_DONEs on this driver
+ U32 wom_done_buffers;
+#endif
+}
+DIG_DRIVER;
+
+typedef struct // MIDI status log structure
+ {
+ S32 program [NUM_CHANS]; // Program Change
+ S32 pitch_l [NUM_CHANS]; // Pitch Bend LSB
+ S32 pitch_h [NUM_CHANS]; // Pitch Bend MSB
+
+ S32 c_lock [NUM_CHANS]; // Channel Lock
+ S32 c_prot [NUM_CHANS]; // Channel Lock Protection
+ S32 c_mute [NUM_CHANS]; // Channel Mute
+ S32 c_v_prot [NUM_CHANS]; // Voice Protection
+ S32 bank [NUM_CHANS]; // Patch Bank Select
+ S32 gm_bank_l [NUM_CHANS]; // GM Bank Select
+ S32 gm_bank_m [NUM_CHANS]; // GM Bank Select
+ S32 indirect [NUM_CHANS]; // ICA indirect controller value
+ S32 callback [NUM_CHANS]; // Callback Trigger
+
+ S32 mod [NUM_CHANS]; // Modulation
+ S32 vol [NUM_CHANS]; // Volume
+ S32 pan [NUM_CHANS]; // Panpot
+ S32 exp [NUM_CHANS]; // Expression
+ S32 sus [NUM_CHANS]; // Sustain
+ S32 reverb [NUM_CHANS]; // Reverb
+ S32 chorus [NUM_CHANS]; // Chorus
+
+ S32 bend_range[NUM_CHANS]; // Bender Range (data MSB, RPN 0 assumed)
+
+ S32 RPN_L [NUM_CHANS]; // RPN # LSB
+ S32 RPN_M [NUM_CHANS]; // RPN # MSB
+ }
+CTRL_LOG;
+
+typedef struct _SEQUENCE // XMIDI sequence state table
+{
+ char tag[4]; // HSEQ
+
+ HMDIDRIVER driver; // Driver for playback
+
+ U32 status; // SEQ_ flags
+
+ void const FAR *TIMB; // XMIDI IFF chunk pointers
+ void const FAR *RBRN;
+ void const FAR *EVNT;
+
+ U8 const FAR *EVNT_ptr; // Current event pointer
+
+ U8 FAR *ICA; // Indirect Controller Array
+
+ AILPREFIXCB prefix_callback; // XMIDI Callback Prefix handler
+ AILTRIGGERCB trigger_callback; // XMIDI Callback Trigger handler
+ AILBEATCB beat_callback; // XMIDI beat/bar change handler
+ AILSEQUENCECB EOS; // End-of-sequence callback function
+
+ S32 loop_count; // 0=one-shot, -1=indefinite, ...
+
+ S32 interval_count; // # of intervals until next event
+ S32 interval_num; // # of intervals since start
+
+ S32 volume; // Sequence volume 0-127
+ S32 volume_target; // Target sequence volume 0-127
+ S32 volume_accum; // Accumulated volume period
+ S32 volume_period; // Period for volume stepping
+
+ S32 tempo_percent; // Relative tempo percentage 0-100
+ S32 tempo_target; // Target tempo 0-100
+ S32 tempo_accum; // Accumulated tempo period
+ S32 tempo_period; // Period for tempo stepping
+ S32 tempo_error; // Error counter for tempo DDA
+
+ S32 beat_count; // Sequence playback position
+ S32 measure_count;
+
+ S32 time_numerator; // Sequence timing data
+ S32 time_fraction;
+ S32 beat_fraction;
+ S32 time_per_beat;
+
+ void const FAR *FOR_ptrs[FOR_NEST]; // Loop stack
+ S32 FOR_loop_count [FOR_NEST];
+
+ S32 chan_map [NUM_CHANS]; // Physical channel map for sequence
+
+ CTRL_LOG shadow; // Controller values for sequence
+
+ S32 note_count; // # of notes "on"
+
+ S32 note_chan [MAX_NOTES]; // Channel for queued note (-1=free)
+ S32 note_num [MAX_NOTES]; // Note # for queued note
+ S32 note_time [MAX_NOTES]; // Remaining duration in intervals
+
+ S32 user_data [8]; // Miscellaneous user data
+ S32 system_data[8]; // Miscellaneous system data
+
+#ifdef IS_WINDOWS
+ S32 PREFIX_IsWin32s; // Is this a Win32s callback
+ S32 TRIGGER_IsWin32s; // Is this a Win32s callback
+ S32 BEAT_IsWin32s; // Is this a Win32s callback
+ S32 EOS_IsWin32s; // Is this a Win32s callback
+#endif
+} SEQUENCE;
+
+#ifdef IS_MAC
+
+struct MIDIHDR;
+struct MIDIOUT;
+typedef struct MIDIOUT* HMIDIOUT;
+
+#endif
+
+typedef struct _MDI_DRIVER // Handle to XMIDI driver
+{
+ char tag[4]; // HMDI
+
+ HTIMER timer; // XMIDI quantization timer
+ S32 interval_time; // XMIDI quantization timer interval in uS
+
+ S32 disable; // > 0 to disable XMIDI service
+
+ HSEQUENCE sequences; // Pointer to list of SEQUENCEs
+ S32 n_sequences; // # of SEQUENCEs
+
+ S32 lock [NUM_CHANS]; // 1 if locked, 2 if protected, else 0
+ HSEQUENCE locker[NUM_CHANS]; // HSEQUENCE which locked channel
+ HSEQUENCE owner [NUM_CHANS]; // HSEQUENCE which owned locked channel
+ HSEQUENCE user [NUM_CHANS]; // Last sequence to use channel
+ S32 state [NUM_CHANS]; // Lock state prior to being locked
+
+ S32 notes [NUM_CHANS]; // # of active notes in channel
+
+ AILEVENTCB event_trap; // MIDI event trap callback function
+ AILTIMBRECB timbre_trap; // Timbre request callback function
+
+ S32 master_volume; // Master XMIDI note volume 0-127
+
+ S32 system_data[8]; // Miscellaneous system data
+
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+
+ S32 released; // has the hmidiout handle been released
+ U32 deviceid; // ID of the MIDI device
+ U8 FAR *sysdata; // SysEx buffer
+
+#endif
+
+#ifdef IS_WINDOWS
+
+ S32 EVENT_IsWin32s; // Is this a Win32s callback
+ S32 TIMBRE_IsWin32s; // Is this a Win32s callback
+
+ MIDIHDR FAR *mhdr; // SysEx header
+
+ HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
+ S32 callingCT; // Calling EXE's task number (16 bit only)
+ S32 callingDS; // Calling EXE's DS (used in 16 bit only)
+
+ HMIDIOUT hMidiOut; // MIDI output driver
+
+#else
+
+ #ifdef IS_DOS
+
+ S32 message_count; // MIDI message count
+ S32 offset; // MIDI buffer offset
+
+ AIL_DRIVER *drvr; // Base driver descriptor
+
+ MDI_DDT *DDT; // Protected-mode pointer to DDT
+ MDI_DST *DST; // Protected-mode pointer to DST
+ #else
+ #ifdef IS_MAC
+ struct MIDIHDR FAR *mhdr; // SysEx header
+ HMDIDRIVER next; // Pointer to next HMDIDRIVER in use
+ HMIDIOUT hMidiOut; // MIDI output driver
+ U32 last_us_time;
+ long period_counter;
+ long current_period_sum;
+ #endif
+ #endif
+
+#endif
+
+}
+MDI_DRIVER;
+
+typedef struct // XMIDI TIMB IFF chunk
+ {
+ S8 name[4];
+
+ U8 msb;
+ U8 lsb;
+ U8 lsb2;
+ U8 lsb3;
+
+ U16 n_entries;
+
+ U16 timbre[1];
+ }
+TIMB_chunk;
+
+typedef struct // XMIDI RBRN IFF entry
+ {
+ S16 bnum;
+ U32 offset;
+ }
+RBRN_entry;
+
+typedef struct // Wave library entry
+{
+ S32 bank; // XMIDI bank, MIDI patch for sample
+ S32 patch;
+
+ S32 root_key; // Root MIDI note # for sample (or -1)
+
+ U32 file_offset; // Offset of wave data from start-of-file
+ U32 size; // Size of wave sample in bytes
+
+ S32 format; // DIG_F format (8/16 bits, mono/stereo)
+ U32 flags; // DIG_PCM_SIGN / DIG_PCM_ORDER (stereo)
+ S32 playback_rate; // Playback rate in hertz
+}
+WAVE_ENTRY;
+
+typedef struct // Virtual "wave synthesizer" descriptor
+{
+ HMDIDRIVER mdi; // MIDI driver for use with synthesizer
+ HDIGDRIVER dig; // Digital driver for use with synthesizer
+
+ WAVE_ENTRY FAR *library; // Pointer to wave library
+
+ AILEVENTCB prev_event_fn; // Previous MIDI event trap function
+ AILTIMBRECB prev_timb_fn; // Previous timbre request trap function
+
+ CTRL_LOG controls; // MIDI controller states
+
+ WAVE_ENTRY FAR *wave [NUM_CHANS];// Pointer to WAVE_ENTRY for each channel
+
+ HSAMPLE S [MAX_W_VOICES]; // List of HSAMPLE voices
+ S32 n_voices; // Actual # of voices allocated to synth
+
+ S32 chan [MAX_W_VOICES]; // MIDI channel for each voice, or -1
+ S32 note [MAX_W_VOICES]; // MIDI note number for voice
+ S32 root [MAX_W_VOICES]; // MIDI root note for voice
+ S32 rate [MAX_W_VOICES]; // Playback rate for voice
+ S32 vel [MAX_W_VOICES]; // MIDI note velocity for voice
+ U32 time [MAX_W_VOICES]; // Timestamp for voice
+
+ U32 event; // Event counter for LRU timestamps
+}
+WAVE_SYNTH;
+
+typedef WAVE_SYNTH FAR * HWAVESYNTH;// Handle to virtual wave synthesizer
+
+//
+// Handle to thread which called AIL_startup()
+//
+// This thread is suspended by MSS callback threads, to simulate DOS-style
+// interrupt handler behavior
+//
+
+#ifdef IS_WIN32
+
+extern HANDLE hAppThread;
+
+#endif
+
+//
+// Background flag for timers
+//
+
+extern volatile S32 AIL_bkgnd_flag;
+
+//
+// Global preference array
+//
+
+extern S32 AIL_preference [N_PREFS];
+
+//
+// DIG_DRIVER list
+//
+
+extern HDIGDRIVER DIG_first;
+
+//
+// MDI_DRIVER list
+//
+
+extern HMDIDRIVER MDI_first;
+
+//
+// Miscellaneous system services
+//
+
+#define FILE_READ_WITH_SIZE ((void FAR*)(S32)-1)
+
+#ifndef NO_OLD_SYS_FUNCTIONS
+
+#define MEM_alloc_lock AIL_mem_alloc_lock
+#define MEM_free_lock AIL_mem_free_lock
+#define FILE_error AIL_file_error
+#define FILE_size AIL_file_size
+#define FILE_read AIL_file_read
+#define FILE_write AIL_file_write
+
+#ifdef IS_DOS
+
+#define MEM_alloc AIL_mem_alloc
+#define MEM_free AIL_mem_free
+#define MEM_use_malloc AIL_mem_use_malloc
+#define MEM_use_free AIL_mem_use_free
+#define MEM_alloc_DOS AIL_mem_alloc_DOS
+#define MEM_free_DOS AIL_mem_free_DOS
+#define VMM_lock_range AIL_vmm_lock_range
+#define VMM_unlock_range AIL_vmm_unlock_range
+#define VMM_lock AIL_vmm_lock
+#define VMM_unlock AIL_vmm_unlock
+
+#endif
+
+#endif
+
+extern S32 AILCALLBACK DP_ASI_DECODER_callback(U32 user,
+ void FAR *dest,
+ S32 bytes_requested,
+ S32 offset);
+
+DXDEC void FAR * AILCALL AIL_mem_alloc_lock(U32 size);
+DXDEC void AILCALL AIL_mem_free_lock (void FAR *ptr);
+
+DXDEC S32 AILCALL AIL_file_error (void);
+
+DXDEC S32 AILCALL AIL_file_size (char const FAR *filename);
+
+DXDEC void FAR * AILCALL AIL_file_read (char const FAR *filename,
+ void FAR *dest);
+
+DXDEC S32 AILCALL AIL_file_write (char const FAR *filename,
+ void const FAR *buf,
+ U32 len);
+
+DXDEC S32 AILCALL AIL_WAV_file_write
+ (char const FAR *filename,
+ void const FAR *buf,
+ U32 len,
+ S32 rate,
+ S32 format);
+
+DXDEC S32 AILCALL AIL_file_append (char const FAR *filename,
+ void const FAR *buf, U32 len);
+
+#ifdef IS_MAC
+
+
+DXDEC S32 AILCALL AIL_file_fss_size(FSSpec const FAR *filename);
+
+DXDEC void FAR * AILCALL AIL_file_fss_read(FSSpec const FAR *filename,
+ void FAR *dest);
+
+DXDEC S32 AILCALL AIL_file_fss_write(FSSpec const FAR *filename,
+ void const FAR *buf,
+ U32 len);
+
+DXDEC S32 AILCALL AIL_file_fss_attrib_write
+ (FSSpec const FAR *filename,
+ void const FAR *buf,
+ U32 len,
+ U32 type,
+ U32 creator );
+
+DXDEC S32 AILCALL AIL_WAV_file_fss_write
+ (FSSpec const FAR *filename,
+ void const FAR *buf,
+ U32 len,
+ S32 rate,
+ S32 format);
+
+DXDEC void * AILCALL AIL_mem_use_malloc(void * AILCALLBACK (*fn)(U32));
+DXDEC void * AILCALL AIL_mem_use_free (void AILCALLBACK (*fn)(void *));
+
+#endif
+
+#ifdef IS_DOS
+
+extern void * AILCALLBACK (*AIL_mem_alloc) (U32);
+extern void AILCALLBACK (*AIL_mem_free) (void *);
+
+void * cdecl AIL_mem_use_malloc(void * AILCALLBACK (*fn)(U32));
+void * cdecl AIL_mem_use_free (void AILCALLBACK (*fn)(void *));
+
+//
+// Other memory-management functions
+//
+
+DXDEC S32 AILCALL AIL_mem_alloc_DOS (U32 n_paras,
+ void **protected_ptr,
+ U32 *segment_far_ptr,
+ U32 *selector);
+
+DXDEC void AILCALL AIL_mem_free_DOS (void *protected_ptr,
+ U32 segment_far_ptr,
+ U32 selector);
+
+DXDEC S32 AILCALL AIL_vmm_lock_range (void *p1, void *p2);
+DXDEC S32 AILCALL AIL_vmm_unlock_range (void *p1, void *p2);
+
+DXDEC S32 AILCALL AIL_vmm_lock (void *start, U32 size);
+DXDEC S32 AILCALL AIL_vmm_unlock (void *start, U32 size);
+
+DXDEC U32 AILCALL AIL_sel_base (U32 sel);
+
+DXDEC void AILCALL AIL_sel_set_limit (U32 sel,
+ U32 limit);
+//
+// Last IO_PARMS structure used to attempt device detection
+//
+
+extern IO_PARMS AIL_last_IO_attempt;
+
+//
+// Low-level support services
+//
+
+DXDEC REALFAR AILCALL AIL_get_real_vect (U32 vectnum);
+
+DXDEC void AILCALL AIL_set_real_vect (U32 vectnum,
+ REALFAR real_ptr);
+
+DXDEC void AILCALL AIL_set_USE16_ISR (S32 IRQ,
+ REALFAR real_base,
+ U32 ISR_offset);
+
+DXDEC void AILCALL AIL_restore_USE16_ISR (S32 IRQ);
+
+DXDEC U32 AILCALL AIL_disable_interrupts (void);
+DXDEC void AILCALL AIL_restore_interrupts (U32 FD_register);
+
+DXDEC void AILCALL AIL_switch_stack (void *stack,
+ U32 size,
+ U32 *SS,
+ void **ESP,
+ void **EBP);
+
+DXDEC void AILCALL AIL_restore_stack (U32 SS,
+ void *ESP,
+ void *EBP);
+
+DXDEC S32 AILCALL AIL_call_driver (AIL_DRIVER *drvr,
+ S32 fn,
+ VDI_CALL *in,
+ VDI_CALL *out);
+
+DXDEC S32 AILCALL AIL_read_INI (AIL_INI *INI,
+ char *filename);
+
+DXDEC U32 AILCALL AIL_interrupt_divisor (void);
+
+#endif
+
+
+#ifdef __WATCOMC__
+
+void MSSBreakPoint();
+#pragma aux MSSBreakPoint = "int 3";
+
+#else
+
+#define MSSBreakPoint() __asm {int 3}
+
+#endif
+
+
+//
+// High-level support services
+//
+
+#ifdef IS_MAC
+
+#if !defined(max)
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+#if !defined(min)
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#endif
+
+#ifdef IS_DOS
+
+#ifdef IS_WATCOM
+
+#if !defined(max) // Watcom stdlib.h doesn't define these for C++
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+#if !defined(min)
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#endif
+
+#ifdef __SW_3R
+extern S32 AILCALL AIL_startup_reg (void);
+#define AIL_startup AIL_startup_reg
+#else
+extern S32 AILCALL AIL_startup_stack (void);
+#define AIL_startup AIL_startup_stack
+#endif
+
+#define AIL_quick_startup(ud,um,opr,opb,ops) AIL_quick_startup_with_start(&AIL_startup,ud,um,opr,opb,ops)
+
+#define AIL_get_preference(number) (AIL_preference[number])
+
+#else
+
+DXDEC S32 AILCALL AIL_startup (void);
+
+DXDEC S32 AILCALL AIL_get_preference (U32 number);
+
+#endif
+
+DXDEC void AILCALL AIL_shutdown (void);
+
+DXDEC S32 AILCALL AIL_set_preference (U32 number,
+ S32 value);
+
+DXDEC char FAR *AILCALL AIL_last_error (void);
+
+DXDEC void AILCALL AIL_set_error (char const FAR * error_msg);
+
+//
+// Low-level support services
+//
+
+DXDEC void
+#ifndef IS_MAC
+__cdecl
+#endif
+AIL_debug_printf (C8 const FAR *fmt, ...);
+
+#ifdef IS_X86
+
+DXDEC U32 AILCALL AIL_MMX_available (void);
+
+#endif
+
+DXDEC void AILCALL AIL_lock (void);
+DXDEC void AILCALL AIL_unlock (void);
+
+#ifdef IS_WIN32
+
+DXDEC void AILCALL AIL_lock_mutex (void);
+DXDEC void AILCALL AIL_unlock_mutex (void);
+
+#endif
+
+DXDEC void AILCALL AIL_delay (S32 intervals);
+
+DXDEC S32 AILCALL AIL_background (void);
+
+//
+// Process services
+//
+
+DXDEC HTIMER AILCALL AIL_register_timer (AILTIMERCB fn);
+
+DXDEC U32 AILCALL AIL_set_timer_user (HTIMER timer,
+ U32 user);
+
+DXDEC void AILCALL AIL_set_timer_period (HTIMER timer,
+ U32 microseconds);
+
+DXDEC void AILCALL AIL_set_timer_frequency (HTIMER timer,
+ U32 hertz);
+
+DXDEC void AILCALL AIL_set_timer_divisor (HTIMER timer,
+ U32 PIT_divisor);
+
+DXDEC void AILCALL AIL_start_timer (HTIMER timer);
+DXDEC void AILCALL AIL_start_all_timers (void);
+
+DXDEC void AILCALL AIL_stop_timer (HTIMER timer);
+DXDEC void AILCALL AIL_stop_all_timers (void);
+
+DXDEC void AILCALL AIL_release_timer_handle (HTIMER timer);
+DXDEC void AILCALL AIL_release_all_timers (void);
+
+#ifdef IS_WIN32
+
+#ifndef BUILD_MSS
+
+// static function that handles shutdown
+int __cdecl MSS_auto_cleanup(void);
+
+#ifdef _MSC_VER
+// on MSVC, automatically register a cleanup function
+//ODCODENOTE Remove
+//#define AIL_startup() (MSS_auto_cleanup(),AIL_startup())
+#endif
+
+#endif
+
+DXDEC HWND AILCALL AIL_HWND (void);
+
+#else
+ #ifdef IS_MAC
+ DXDEC ProcessSerialNumber AIL_Process(void);
+ #endif
+#endif
+
+//
+// high-level digital services
+//
+
+DXDEC HDIGDRIVER AILCALL AIL_open_digital_driver( U32 frequency,
+ S32 bits,
+ S32 channel,
+ U32 flags );
+
+#define AIL_OPEN_DIGITAL_FORCE_PREFERENCE 1
+
+DXDEC void AILCALL AIL_close_digital_driver( HDIGDRIVER dig );
+
+#ifdef IS_WINDOWS
+
+#define AIL_MSS_version(str,len) \
+{ \
+ HINSTANCE l=LoadLibrary(MSSDLLNAME); \
+ if ((U32)l<=32) \
+ *(str)=0; \
+ else { \
+ LoadString(l,1,str,len); \
+ FreeLibrary(l); \
+ } \
+}
+
+DXDEC S32 AILCALL AIL_waveOutOpen (HDIGDRIVER FAR *drvr,
+ LPHWAVEOUT FAR *lphWaveOut,
+ S32 wDeviceID,
+ LPWAVEFORMAT lpFormat);
+
+DXDEC void AILCALL AIL_waveOutClose (HDIGDRIVER drvr);
+
+DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
+
+DXDEC S32 AILCALL AIL_digital_handle_reacquire
+ (HDIGDRIVER drvr);
+
+#else
+
+#ifdef IS_MAC
+
+typedef struct MSS_VersionType_
+{
+ Str255 version_name;
+} MSS_VersionType;
+
+#define AIL_MSS_version(str,len) \
+{ \
+ long _res = OpenResFile("\pMiles Shared Library"); \
+ if (_res==-1) \
+ { \
+ str[0]=0; \
+ } \
+ else \
+ { \
+ Handle _H; \
+ short _Err; \
+ long _cur= CurResFile(); \
+ UseResFile(_res); \
+ _H = GetResource('vers', 2); \
+ _Err = ResError(); \
+ if((_Err != noErr) || (_H==0)) \
+ { \
+ str[0]=0; \
+ UseResFile(_cur); \
+ CloseResFile(_res); \
+ } \
+ else \
+ { \
+ if (GetHandleSize(_H)==0) \
+ { \
+ str[0]=0; \
+ UseResFile(_cur); \
+ CloseResFile(_res); \
+ } \
+ else \
+ { \
+ MSS_VersionType * _vt = (MSS_VersionType*)*_H; \
+ if ((U32)_vt->version_name[6]>4) \
+ _vt->version_name[6]-=4; \
+ else \
+ _vt->version_name[6]=0; \
+ if (((U32)len) <= ((U32)_vt->version_name[6])) \
+ _vt->version_name[6] = (U8)len-1; \
+ memcpy( str, _vt->version_name+11, _vt->version_name[6] ); \
+ str[_vt->version_name[6]]=0; \
+ UseResFile(_cur); \
+ CloseResFile(_res); \
+ } \
+ ReleaseResource(_H); \
+ } \
+ } \
+}
+
+DXDEC S32 AILCALL AIL_digital_handle_release(HDIGDRIVER drvr);
+
+DXDEC S32 AILCALL AIL_digital_handle_reacquire
+ (HDIGDRIVER drvr);
+
+#else
+
+//
+// DOS installation services
+//
+
+DXDEC IO_PARMS * AILCALL AIL_get_IO_environment (AIL_DRIVER *drvr);
+
+DXDEC AIL_DRIVER* AILCALL AIL_install_driver (U8 const *driver_image,
+ U32 n_bytes);
+
+DXDEC void AILCALL AIL_uninstall_driver (AIL_DRIVER *drvr);
+
+DXDEC S32 AILCALL AIL_install_DIG_INI (HDIGDRIVER *dig);
+
+DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_file
+ (char const *filename,
+ IO_PARMS *IO);
+
+DXDEC void AILCALL AIL_uninstall_DIG_driver (HDIGDRIVER dig);
+
+
+DXDEC HDIGDRIVER AILCALL AIL_install_DIG_driver_image
+ (void const *driver_image,
+ U32 size,
+ IO_PARMS *IO);
+#endif
+#endif
+
+DXDEC char FAR* AILCALL AIL_set_redist_directory(char const FAR*dir);
+
+DXDEC S32 AILCALL AIL_digital_CPU_percent (HDIGDRIVER dig);
+
+DXDEC S32 AILCALL AIL_digital_latency (HDIGDRIVER dig);
+
+DXDEC HSAMPLE AILCALL AIL_allocate_sample_handle
+ (HDIGDRIVER dig);
+
+DXDEC HSAMPLE AILCALL AIL_allocate_file_sample (HDIGDRIVER dig,
+ void const FAR *file_image,
+ S32 block);
+
+DXDEC void AILCALL AIL_release_sample_handle (HSAMPLE S);
+
+DXDEC void AILCALL AIL_init_sample (HSAMPLE S);
+
+DXDEC S32 AILCALL AIL_set_sample_file (HSAMPLE S,
+ void const FAR *file_image,
+ S32 block);
+
+DXDEC S32 AILCALL AIL_set_named_sample_file (HSAMPLE S,
+ C8 const FAR *file_type_suffix,
+ void const FAR *file_image,
+ S32 file_size,
+ S32 block);
+
+DXDEC HPROVIDER AILCALL AIL_set_sample_processor (HSAMPLE S,
+ SAMPLESTAGE pipeline_stage,
+ HPROVIDER provider);
+
+DXDEC HPROVIDER AILCALL AIL_set_digital_driver_processor
+ (HDIGDRIVER dig,
+ DIGDRVSTAGE pipeline_stage,
+ HPROVIDER provider);
+
+DXDEC void AILCALL AIL_set_sample_adpcm_block_size
+ (HSAMPLE S,
+ U32 blocksize);
+
+DXDEC void AILCALL AIL_set_sample_address (HSAMPLE S,
+ void const FAR *start,
+ U32 len);
+
+DXDEC void AILCALL AIL_set_sample_type (HSAMPLE S,
+ S32 format,
+ U32 flags);
+
+DXDEC void AILCALL AIL_start_sample (HSAMPLE S);
+
+DXDEC void AILCALL AIL_stop_sample (HSAMPLE S);
+
+DXDEC void AILCALL AIL_resume_sample (HSAMPLE S);
+
+DXDEC void AILCALL AIL_end_sample (HSAMPLE S);
+
+DXDEC void AILCALL AIL_set_sample_playback_rate
+ (HSAMPLE S,
+ S32 playback_rate);
+
+DXDEC void AILCALL AIL_set_sample_volume (HSAMPLE S,
+ S32 volume);
+
+DXDEC void AILCALL AIL_set_sample_pan (HSAMPLE S,
+ S32 pan);
+
+DXDEC void AILCALL AIL_set_sample_loop_count (HSAMPLE S,
+ S32 loop_count);
+
+DXDEC void AILCALL AIL_set_sample_loop_block (HSAMPLE S,
+ S32 loop_start_offset,
+ S32 loop_end_offset);
+
+DXDEC U32 AILCALL AIL_sample_status (HSAMPLE S);
+
+DXDEC S32 AILCALL AIL_sample_playback_rate (HSAMPLE S);
+
+DXDEC S32 AILCALL AIL_sample_volume (HSAMPLE S);
+
+DXDEC S32 AILCALL AIL_sample_pan (HSAMPLE S);
+
+DXDEC S32 AILCALL AIL_sample_loop_count (HSAMPLE S);
+
+DXDEC void AILCALL AIL_set_digital_master_volume
+ (HDIGDRIVER dig,
+ S32 master_volume);
+
+DXDEC S32 AILCALL AIL_digital_master_volume (HDIGDRIVER dig);
+
+DXDEC void AILCALL AIL_set_sample_reverb(HSAMPLE S,
+ F32 reverb_level,
+ F32 reverb_reflect_time,
+ F32 reverb_decay_time);
+
+DXDEC void AILCALL AIL_sample_reverb (HSAMPLE S,
+ F32 FAR *reverb_level,
+ F32 FAR *reverb_reflect_time,
+ F32 FAR *reverb_decay_time);
+
+//
+// low-level digital services
+//
+
+DXDEC S32 AILCALL AIL_minimum_sample_buffer_size(HDIGDRIVER dig,
+ S32 playback_rate,
+ S32 format);
+
+DXDEC S32 AILCALL AIL_sample_buffer_ready (HSAMPLE S);
+
+DXDEC void AILCALL AIL_load_sample_buffer (HSAMPLE S,
+ U32 buff_num,
+ void const FAR *buffer,
+ U32 len);
+
+DXDEC void AILCALL AIL_request_EOB_ASI_reset (HSAMPLE S,
+ U32 buff_num);
+
+DXDEC S32 AILCALL AIL_sample_buffer_info (HSAMPLE S, //)
+ U32 FAR *pos0,
+ U32 FAR *len0,
+ U32 FAR *pos1,
+ U32 FAR *len1);
+
+DXDEC U32 AILCALL AIL_sample_granularity (HSAMPLE S);
+
+DXDEC void AILCALL AIL_set_sample_position (HSAMPLE S,
+ U32 pos);
+
+DXDEC U32 AILCALL AIL_sample_position (HSAMPLE S);
+
+DXDEC AILSAMPLECB AILCALL AIL_register_SOB_callback
+ (HSAMPLE S,
+ AILSAMPLECB SOB);
+
+DXDEC AILSAMPLECB AILCALL AIL_register_EOB_callback
+ (HSAMPLE S,
+ AILSAMPLECB EOB);
+
+DXDEC AILSAMPLECB AILCALL AIL_register_EOS_callback
+ (HSAMPLE S,
+ AILSAMPLECB EOS);
+
+DXDEC AILSAMPLECB AILCALL AIL_register_EOF_callback
+ (HSAMPLE S,
+ AILSAMPLECB EOFILE);
+
+DXDEC void AILCALL AIL_set_sample_user_data (HSAMPLE S,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL AIL_sample_user_data (HSAMPLE S,
+ U32 index);
+
+DXDEC S32 AILCALL AIL_active_sample_count (HDIGDRIVER dig);
+
+DXDEC void AILCALL AIL_digital_configuration (HDIGDRIVER dig,
+ S32 FAR *rate,
+ S32 FAR *format,
+ char FAR *string);
+#ifdef IS_WIN32
+
+DXDEC S32 AILCALL AIL_set_direct_buffer_control (HSAMPLE S,
+ U32 command);
+
+DXDEC void AILCALL AIL_get_DirectSound_info (HSAMPLE S,
+ AILLPDIRECTSOUND *lplpDS,
+ AILLPDIRECTSOUNDBUFFER *lplpDSB);
+
+DXDEC S32 AILCALL AIL_set_DirectSound_HWND(HDIGDRIVER dig, HWND wnd);
+
+#endif
+
+DXDEC void AILCALL AIL_set_sample_ms_position (HSAMPLE S, //)
+ S32 milliseconds);
+
+DXDEC void AILCALL AIL_sample_ms_position (HSAMPLE S, //)
+ S32 FAR * total_milliseconds,
+ S32 FAR * current_milliseconds);
+
+
+//
+// Digital input services
+//
+
+#if defined(IS_WINDOWS) || defined (IS_MAC)
+
+DXDEC HDIGINPUT AILCALL AIL_open_input (AIL_INPUT_INFO FAR *info);
+
+DXDEC void AILCALL AIL_close_input (HDIGINPUT dig);
+
+DXDEC AIL_INPUT_INFO FAR *
+ AILCALL AIL_get_input_info (HDIGINPUT dig);
+
+DXDEC S32 AILCALL AIL_set_input_state (HDIGINPUT dig,
+ S32 enable);
+#endif
+
+
+//
+// High-level XMIDI services
+//
+
+DXDEC HMDIDRIVER AILCALL AIL_open_XMIDI_driver( U32 flags );
+
+#define AIL_OPEN_XMIDI_NULL_DRIVER 1
+
+DXDEC void AILCALL AIL_close_XMIDI_driver( HMDIDRIVER mdi );
+
+#ifdef IS_MAC
+
+DXDEC S32 AILCALL AIL_MIDI_handle_release
+ (HMDIDRIVER mdi);
+
+DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
+ (HMDIDRIVER mdi);
+
+#else
+
+#ifdef IS_WINDOWS
+
+DXDEC S32 AILCALL AIL_midiOutOpen(HMDIDRIVER FAR *drvr,
+ LPHMIDIOUT FAR *lphMidiOut,
+ S32 dwDeviceID);
+
+DXDEC void AILCALL AIL_midiOutClose (HMDIDRIVER mdi);
+
+DXDEC S32 AILCALL AIL_MIDI_handle_release
+ (HMDIDRIVER mdi);
+
+DXDEC S32 AILCALL AIL_MIDI_handle_reacquire
+ (HMDIDRIVER mdi);
+
+#else
+
+#ifdef IS_DOS
+
+DXDEC S32 AILCALL AIL_install_MDI_INI (HMDIDRIVER *mdi);
+
+DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_file
+ (char const *filename,
+ IO_PARMS *IO);
+
+DXDEC void AILCALL AIL_uninstall_MDI_driver (HMDIDRIVER mdi);
+
+
+DXDEC HMDIDRIVER AILCALL AIL_install_MDI_driver_image
+ (void const *driver_image,
+ U32 size,
+ IO_PARMS *IO);
+
+DXDEC S32 AILCALL AIL_MDI_driver_type (HMDIDRIVER mdi);
+
+DXDEC void AILCALL AIL_set_GTL_filename_prefix (char const*prefix);
+
+DXDEC S32 AILCALL AIL_timbre_status (HMDIDRIVER mdi,
+ S32 bank,
+ S32 patch);
+
+DXDEC S32 AILCALL AIL_install_timbre (HMDIDRIVER mdi,
+ S32 bank,
+ S32 patch);
+
+DXDEC void AILCALL AIL_protect_timbre (HMDIDRIVER mdi,
+ S32 bank,
+ S32 patch);
+
+DXDEC void AILCALL AIL_unprotect_timbre (HMDIDRIVER mdi,
+ S32 bank,
+ S32 patch);
+
+#endif
+
+#endif
+
+#endif
+
+DXDEC HSEQUENCE AILCALL AIL_allocate_sequence_handle
+ (HMDIDRIVER mdi);
+
+DXDEC void AILCALL AIL_release_sequence_handle
+ (HSEQUENCE S);
+
+DXDEC S32 AILCALL AIL_init_sequence (HSEQUENCE S,
+ void const FAR *start,
+ S32 sequence_num);
+
+DXDEC void AILCALL AIL_start_sequence (HSEQUENCE S);
+
+DXDEC void AILCALL AIL_stop_sequence (HSEQUENCE S);
+
+DXDEC void AILCALL AIL_resume_sequence (HSEQUENCE S);
+
+DXDEC void AILCALL AIL_end_sequence (HSEQUENCE S);
+
+DXDEC void AILCALL AIL_set_sequence_tempo (HSEQUENCE S,
+ S32 tempo,
+ S32 milliseconds);
+
+DXDEC void AILCALL AIL_set_sequence_volume (HSEQUENCE S,
+ S32 volume,
+ S32 milliseconds);
+
+DXDEC void AILCALL AIL_set_sequence_loop_count
+ (HSEQUENCE S,
+ S32 loop_count);
+
+DXDEC U32 AILCALL AIL_sequence_status (HSEQUENCE S);
+
+DXDEC S32 AILCALL AIL_sequence_tempo (HSEQUENCE S);
+
+DXDEC S32 AILCALL AIL_sequence_volume (HSEQUENCE S);
+
+DXDEC S32 AILCALL AIL_sequence_loop_count (HSEQUENCE S);
+
+DXDEC void AILCALL AIL_set_XMIDI_master_volume
+ (HMDIDRIVER mdi,
+ S32 master_volume);
+
+DXDEC S32 AILCALL AIL_XMIDI_master_volume (HMDIDRIVER mdi);
+
+
+//
+// Low-level XMIDI services
+//
+
+DXDEC S32 AILCALL AIL_active_sequence_count (HMDIDRIVER mdi);
+
+DXDEC S32 AILCALL AIL_controller_value (HSEQUENCE S,
+ S32 channel,
+ S32 controller_num);
+
+DXDEC S32 AILCALL AIL_channel_notes (HSEQUENCE S,
+ S32 channel);
+
+DXDEC void AILCALL AIL_sequence_position (HSEQUENCE S,
+ S32 FAR *beat,
+ S32 FAR *measure);
+
+DXDEC void AILCALL AIL_branch_index (HSEQUENCE S,
+ U32 marker);
+
+DXDEC AILPREFIXCB AILCALL AIL_register_prefix_callback
+ (HSEQUENCE S,
+ AILPREFIXCB callback);
+
+DXDEC AILTRIGGERCB AILCALL AIL_register_trigger_callback
+ (HSEQUENCE S,
+ AILTRIGGERCB callback);
+
+DXDEC AILSEQUENCECB AILCALL AIL_register_sequence_callback
+ (HSEQUENCE S,
+ AILSEQUENCECB callback);
+
+DXDEC AILBEATCB AILCALL AIL_register_beat_callback (HSEQUENCE S,
+ AILBEATCB callback);
+
+DXDEC AILEVENTCB AILCALL AIL_register_event_callback (HMDIDRIVER mdi,
+ AILEVENTCB callback);
+
+DXDEC AILTIMBRECB AILCALL AIL_register_timbre_callback
+ (HMDIDRIVER mdi,
+ AILTIMBRECB callback);
+
+DXDEC void AILCALL AIL_set_sequence_user_data (HSEQUENCE S,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL AIL_sequence_user_data (HSEQUENCE S,
+ U32 index);
+
+DXDEC void AILCALL AIL_register_ICA_array (HSEQUENCE S,
+ U8 FAR *array);
+
+DXDEC S32 AILCALL AIL_lock_channel (HMDIDRIVER mdi);
+
+DXDEC void AILCALL AIL_release_channel (HMDIDRIVER mdi,
+ S32 channel);
+
+DXDEC void AILCALL AIL_map_sequence_channel (HSEQUENCE S,
+ S32 seq_channel,
+ S32 new_channel);
+
+DXDEC S32 AILCALL AIL_true_sequence_channel (HSEQUENCE S,
+ S32 seq_channel);
+
+DXDEC void AILCALL AIL_send_channel_voice_message
+ (HMDIDRIVER mdi,
+ HSEQUENCE S,
+ S32 status,
+ S32 data_1,
+ S32 data_2);
+
+DXDEC void AILCALL AIL_send_sysex_message (HMDIDRIVER mdi,
+ void const FAR *buffer);
+
+DXDEC HWAVESYNTH
+ AILCALL AIL_create_wave_synthesizer (HDIGDRIVER dig,
+ HMDIDRIVER mdi,
+ void const FAR *wave_lib,
+ S32 polyphony);
+
+DXDEC void AILCALL AIL_destroy_wave_synthesizer (HWAVESYNTH W);
+
+DXDEC void AILCALL AIL_set_sequence_ms_position (HSEQUENCE S, //)
+ S32 milliseconds);
+
+DXDEC void AILCALL AIL_sequence_ms_position(HSEQUENCE S, //)
+ S32 FAR *total_milliseconds,
+ S32 FAR *current_milliseconds);
+
+
+
+//
+// red book functions
+//
+
+#ifdef IS_DOS
+typedef struct _REDBOOKTRACKINFO {
+ U32 tracks;
+ U32 trackstarts[100];
+} REDBOOKTRACKINFO;
+#endif
+
+typedef struct _REDBOOK {
+ U32 DeviceID;
+ U32 paused;
+ U32 pausedsec;
+ U32 lastendsec;
+#ifdef IS_DOS
+ U32 readcontents;
+ REDBOOKTRACKINFO info;
+#endif
+#ifdef IS_MAC
+ short vDRefNum;
+#endif
+} REDBOOK;
+
+typedef struct _REDBOOK FAR* HREDBOOK;
+
+#define REDBOOK_ERROR 0
+#define REDBOOK_PLAYING 1
+#define REDBOOK_PAUSED 2
+#define REDBOOK_STOPPED 3
+
+
+DXDEC HREDBOOK AILCALL AIL_redbook_open(U32 which);
+
+#ifdef IS_MAC
+DXDEC HREDBOOK AILCALL AIL_redbook_open_volume(char const * drive);
+#else
+DXDEC HREDBOOK AILCALL AIL_redbook_open_drive(S32 drive);
+#endif
+
+DXDEC void AILCALL AIL_redbook_close(HREDBOOK hand);
+
+DXDEC void AILCALL AIL_redbook_eject(HREDBOOK hand);
+
+DXDEC void AILCALL AIL_redbook_retract(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_status(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_tracks(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_track(HREDBOOK hand);
+
+DXDEC void AILCALL AIL_redbook_track_info(HREDBOOK hand,U32 tracknum,
+ U32 FAR* startmsec,U32 FAR* endmsec);
+
+DXDEC U32 AILCALL AIL_redbook_id(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_position(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_play(HREDBOOK hand,U32 startmsec, U32 endmsec);
+
+DXDEC U32 AILCALL AIL_redbook_stop(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_pause(HREDBOOK hand);
+
+DXDEC U32 AILCALL AIL_redbook_resume(HREDBOOK hand);
+
+DXDEC S32 AILCALL AIL_redbook_volume(HREDBOOK hand);
+
+DXDEC S32 AILCALL AIL_redbook_set_volume(HREDBOOK hand, S32 volume);
+
+#ifdef IS_WIN16
+ #define AIL_ms_count timeGetTime
+ DXDEC U32 AILCALL AIL_us_count(void);
+#else
+ DXDEC U32 AILCALL AIL_ms_count(void);
+ DXDEC U32 AILCALL AIL_us_count(void);
+#endif
+
+
+typedef struct _STREAM FAR* HSTREAM; // Handle to stream
+
+typedef void (AILCALLBACK FAR* AILSTREAMCB) (HSTREAM stream);
+
+typedef struct _STREAM {
+
+ S32 block_oriented; // 1 if this is an ADPCM or ASI-compressed stream
+ S32 using_ASI; // 1 if using ASI decoder to uncompress stream data
+ ASISTAGE FAR *ASI; // handy pointer to our ASI coded
+
+ HSAMPLE samp; // the sample handle
+
+ U32 fileh; // the open file handle
+
+ U8 FAR* bufs[3]; // the data buffers
+ U32 bufsizes[3]; // the size of each buffer
+ S32 reset_ASI[3]; // should we reset the ASI at the end of the buffer?
+ S32 bufstart[3]; // offset of where this buffer started
+ void FAR* asyncs[3];// async read structures
+
+ S32 loadedbufstart[2]; // offset of where the loaded buffer started
+ S32 loadedorder[2]; // order of the buffers as they were loaded
+ S32 loadorder; // incremented as each buffer is loaded
+
+ S32 bufsize; // size of each buffer
+ S32 readsize; // size of each read block
+
+ U32 buf1; // 0,1,2 (current buffer that we are reading into)
+ S32 size1; // holds the current amount of data read
+
+ U32 buf2; // 0,1,2 (the next buffer that we are reading into)
+ S32 size2; // next buffer loaded up to
+
+ U32 buf3; // 0,1,2 (the next buffer that we are reading into)
+ S32 size3; // next buffer loaded up to
+
+ U32 datarate; // datarate in bytes per second
+ S32 filerate; // original datarate of the file
+ S32 filetype; // file format type
+ U32 fileflags; // file format flags (signed or unsigned)
+ S32 totallen; // total length of the sound data
+
+ S32 substart; // subblock loop start
+ S32 sublen; // subblock loop len
+ S32 subpadding; // amount to pad the final block
+
+ U32 blocksize; // ADPCM block size
+ S32 padding; // padding to be done
+ S32 padded; // padding done
+
+ S32 loadedsome; // have we done any loads?
+
+ U32 startpos; // point that the sound data begins
+ U32 totalread; // total bytes read from the disk
+
+ U32 loopsleft; // how many loops are left
+
+ U32 error; // read error has occurred
+
+ S32 preload; // preload the file into the first buffer
+ U32 preloadpos; // position to use in preload
+ S32 noback; // no background processing
+ S32 alldone; // alldone
+ S32 primeamount; // amount to load after a seek
+ S32 readatleast; // forced amount to read on next service
+
+ S32 playcontrol; // control: 0=stopped, 1=started, |8=paused, |16=sample paused
+
+ AILSTREAMCB callback; // end of stream callback
+
+ S32 user_data[8]; // Miscellaneous user data
+ void FAR* next; // pointer to next stream
+
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+ S32 autostreaming; // are we autostreaming this stream
+#endif
+
+#ifdef IS_WINDOWS
+ S32 cb_IsWin32s; // Is the callback win32s?
+#endif
+
+ S32 docallback; // set when it time to poll for a callback
+
+#ifdef IS_MAC
+ IOParam stream_param;
+ S32 donext;
+ S32 donext1;
+ U32 fillup;
+ U32 session;
+ U32 tamt;
+ U32 buf;
+ S32* size;
+ S32* done;
+ S32 done1;
+ S32 done2;
+ S32 done3;
+ Boolean force_quit;
+#endif
+
+} MSTREAM_TYPE;
+
+
+DXDEC HSTREAM AILCALL AIL_open_stream(HDIGDRIVER dig, char const FAR * filename, S32 stream_mem);
+
+DXDEC void AILCALL AIL_close_stream(HSTREAM stream);
+
+DXDEC S32 AILCALL AIL_service_stream(HSTREAM stream, S32 fillup);
+
+DXDEC void AILCALL AIL_start_stream(HSTREAM stream);
+
+DXDEC void AILCALL AIL_pause_stream(HSTREAM stream, S32 onoff);
+
+DXDEC void AILCALL AIL_set_stream_volume(HSTREAM stream,S32 volume);
+
+DXDEC void AILCALL AIL_set_stream_pan(HSTREAM stream,S32 pan);
+
+DXDEC S32 AILCALL AIL_stream_volume(HSTREAM stream);
+
+DXDEC S32 AILCALL AIL_stream_pan(HSTREAM stream);
+
+DXDEC void AILCALL AIL_set_stream_playback_rate(HSTREAM stream, S32 rate);
+
+DXDEC S32 AILCALL AIL_stream_playback_rate(HSTREAM stream);
+
+DXDEC S32 AILCALL AIL_stream_loop_count(HSTREAM stream);
+
+DXDEC void AILCALL AIL_set_stream_loop_count(HSTREAM stream, S32 count);
+
+DXDEC void AILCALL AIL_set_stream_loop_block (HSTREAM S,
+ S32 loop_start_offset,
+ S32 loop_end_offset);
+
+DXDEC S32 AILCALL AIL_stream_status(HSTREAM stream);
+
+DXDEC void AILCALL AIL_set_stream_position(HSTREAM stream,S32 offset);
+
+DXDEC S32 AILCALL AIL_stream_position(HSTREAM stream);
+
+DXDEC void AILCALL AIL_stream_info(HSTREAM stream, S32 FAR* datarate, S32 FAR* sndtype, S32 FAR* length, S32 FAR* memory);
+
+DXDEC AILSTREAMCB AILCALL AIL_register_stream_callback(HSTREAM stream, AILSTREAMCB callback);
+
+DXDEC void AILCALL AIL_auto_service_stream(HSTREAM stream, S32 onoff);
+
+DXDEC void AILCALL AIL_set_stream_user_data (HSTREAM S,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL AIL_stream_user_data (HSTREAM S,
+ U32 index);
+
+DXDEC void AILCALL AIL_set_stream_ms_position (HSTREAM S,
+ S32 milliseconds);
+
+DXDEC void AILCALL AIL_stream_ms_position (HSTREAM S, //)
+ S32 FAR * total_milliseconds,
+ S32 FAR * current_milliseconds);
+
+DXDEC void AILCALL AIL_set_stream_reverb(HSTREAM S,
+ F32 reverb_level,
+ F32 reverb_reflect_time,
+ F32 reverb_decay_time);
+
+DXDEC void AILCALL AIL_stream_reverb (HSTREAM S,
+ F32 FAR *reverb_level,
+ F32 FAR *reverb_reflect_time,
+ F32 FAR *reverb_decay_time);
+
+DXDEC HPROVIDER AILCALL AIL_set_stream_processor (HSTREAM S,
+ SAMPLESTAGE pipeline_stage,
+ HPROVIDER provider);
+
+#ifdef IS_MAC
+typedef struct MSS_FILE
+{
+ S32 file_type; // 0 = char*, 1 = FSSpec*
+ void const FAR* file;
+} MSS_FILE;
+#else
+typedef char MSS_FILE;
+#endif
+
+typedef U32 (AILCALLBACK FAR*AIL_file_open_callback) (MSS_FILE const FAR* Filename,
+ U32 FAR* FileHandle);
+
+typedef void (AILCALLBACK FAR*AIL_file_close_callback) (U32 FileHandle);
+
+#define AIL_FILE_SEEK_BEGIN 0
+#define AIL_FILE_SEEK_CURRENT 1
+#define AIL_FILE_SEEK_END 2
+
+typedef S32 (AILCALLBACK FAR*AIL_file_seek_callback) (U32 FileHandle,
+ S32 Offset,
+ U32 Type);
+
+typedef U32 (AILCALLBACK FAR*AIL_file_read_callback) (U32 FileHandle,
+ void FAR* Buffer,
+ U32 Bytes);
+
+DXDEC void AILCALL AIL_set_file_callbacks (AIL_file_open_callback opencb,
+ AIL_file_close_callback closecb,
+ AIL_file_seek_callback seekcb,
+ AIL_file_read_callback readcb);
+
+#ifdef IS_32
+
+typedef void FAR* (AILCALLBACK FAR*AIL_file_async_read_callback) (U32 FileHandle,
+ void FAR* Buffer,
+ U32 Bytes);
+
+typedef S32 (AILCALLBACK FAR*AIL_file_async_status_callback) (void FAR* async,
+ S32 wait,
+ U32 FAR* BytesRead);
+
+DXDEC void AILCALL AIL_set_file_async_callbacks (AIL_file_open_callback opencb,
+ AIL_file_close_callback closecb,
+ AIL_file_seek_callback seekcb,
+ AIL_file_async_read_callback areadcb,
+ AIL_file_async_status_callback statuscb);
+
+#endif
+
+//
+// High-level DLS functions
+//
+
+typedef struct _DLSFILEID {
+ S32 id;
+ struct _DLSFILEID FAR* next;
+} DLSFILEID;
+
+typedef struct _DLSFILEID FAR* HDLSFILEID;
+
+typedef struct _DLSDEVICE {
+ void FAR* pGetPref;
+ void FAR* pSetPref;
+ void FAR* pMSSOpen;
+ void FAR* pOpen;
+ void FAR* pClose;
+ void FAR* pLoadFile;
+ void FAR* pLoadMem;
+ void FAR* pUnloadFile;
+ void FAR* pUnloadAll;
+ void FAR* pGetInfo;
+ void FAR* pCompact;
+ void FAR* pSetAttr;
+ S32 DLSHandle;
+ U32 format;
+ U32 buffer_size;
+ void FAR* buffer[2];
+ HSAMPLE sample;
+ HMDIDRIVER mdi;
+ HDIGDRIVER dig;
+ HDLSFILEID first;
+#ifdef IS_WINDOWS
+ HMODULE lib;
+#else
+ #ifdef IS_DOS
+ char FAR* DOSname;
+ #endif
+#endif
+} DLSDEVICE;
+
+typedef struct _DLSDEVICE FAR* HDLSDEVICE;
+
+typedef struct _AILDLSINFO {
+ char Description[128];
+ S32 MaxDLSMemory;
+ S32 CurrentDLSMemory;
+ S32 LargestSize;
+ S32 GMAvailable;
+ S32 GMBankSize;
+} AILDLSINFO;
+
+#ifdef IS_DOS
+
+typedef struct _AILDOSDLS {
+ char FAR* description;
+ void FAR* pDLSOpen;
+ void FAR* pMSSOpen;
+ void FAR* pOpen;
+ void FAR* pClose;
+ void FAR* pLoadFile;
+ void FAR* pLoadMem;
+ void FAR* pUnloadFile;
+ void FAR* pUnloadAll;
+ void FAR* pGetInfo;
+ void FAR* pCompact;
+ void FAR* pSetAttr;
+} AILDOSDLS;
+
+#endif
+
+
+DXDEC HDLSDEVICE AILCALL AIL_DLS_open(HMDIDRIVER mdi, HDIGDRIVER dig,
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+ char const FAR * libname,
+#else
+ AILDOSDLS const FAR * dosdls,
+#endif
+ U32 flags, U32 rate, S32 bits, S32 channels);
+
+//
+// Parameters for the dwFlag used in DLSClose() and flags in AIL_DLS_close
+//
+
+#define RETAIN_DLS_COLLECTION 0x00000001
+#define RETURN_TO_BOOTUP_STATE 0x00000002
+#define RETURN_TO_GM_ONLY_STATE 0x00000004
+#define DLS_COMPACT_MEMORY 0x00000008
+
+DXDEC void AILCALL AIL_DLS_close(HDLSDEVICE dls, U32 flags);
+
+DXDEC HDLSFILEID AILCALL AIL_DLS_load_file(HDLSDEVICE dls, char const FAR* filename, U32 flags);
+
+DXDEC HDLSFILEID AILCALL AIL_DLS_load_memory(HDLSDEVICE dls, void const FAR* memfile, U32 flags);
+
+//
+// other parameters for AIL_DLS_unload
+//
+
+#define AIL_DLS_UNLOAD_MINE 0
+#define AIL_DLS_UNLOAD_ALL ((HDLSFILEID)(U32)(S32)-1)
+
+DXDEC void AILCALL AIL_DLS_unload(HDLSDEVICE dls, HDLSFILEID dlsid);
+
+DXDEC void AILCALL AIL_DLS_compact(HDLSDEVICE dls);
+
+DXDEC void AILCALL AIL_DLS_get_info(HDLSDEVICE dls, AILDLSINFO FAR* info, S32 FAR* PercentCPU);
+
+DXDEC void AILCALL AIL_DLS_set_reverb(HDLSDEVICE dls,
+ F32 reverb_level,
+ F32 reverb_reflect_time,
+ F32 reverb_decay_time);
+
+DXDEC void AILCALL AIL_DLS_get_reverb(HDLSDEVICE dls,
+ F32 FAR* reverb_level,
+ F32 FAR* reverb_reflect_time,
+ F32 FAR* reverb_decay_time);
+
+DXDEC HPROVIDER AILCALL AIL_set_DLS_processor (HDLSDEVICE dev,
+ SAMPLESTAGE pipeline_stage,
+ HPROVIDER provider);
+
+
+//
+// Quick-integration service functions and data types
+//
+
+typedef struct
+{
+ U32 const FAR *data;
+ S32 size;
+ S32 type;
+ void FAR *handle;
+ S32 status;
+ void FAR* next;
+ S32 speed;
+ S32 volume;
+ S32 extravol;
+ F32 rlevel;
+ F32 rrtime;
+ F32 rdtime;
+ HDLSFILEID dlsid;
+ void FAR* dlsmem;
+ void FAR* dlsmemunc;
+ S32 milliseconds;
+ S32 length;
+ S32 userdata;
+}
+AUDIO_TYPE;
+
+
+#define QSTAT_DONE 1 // Data has finished playing
+#define QSTAT_LOADED 2 // Data has been loaded, but not yet played
+#define QSTAT_PLAYING 3 // Data is currently playing
+
+typedef AUDIO_TYPE FAR * HAUDIO; // Generic handle to any audio data type
+
+#define AIL_QUICK_USE_WAVEOUT 2
+#define AIL_QUICK_MIDI_AND_DLS 2
+#define AIL_QUICK_DLS_ONLY 3
+#define AIL_QUICK_MIDI_AND_VORTEX_DLS 4
+#define AIL_QUICK_MIDI_AND_SONICVIBES_DLS 5
+
+DXDEC S32 AILCALL
+#if defined(IS_WINDOWS) || defined(IS_MAC)
+ AIL_quick_startup (
+#else
+ AIL_quick_startup_with_start(void* startup,
+#endif
+ S32 use_digital,
+ S32 use_MIDI,
+ U32 output_rate,
+ S32 output_bits,
+ S32 output_channels);
+
+DXDEC void AILCALL AIL_quick_shutdown (void);
+
+DXDEC void AILCALL AIL_quick_handles (HDIGDRIVER FAR* pdig,
+ HMDIDRIVER FAR* pmdi,
+ HDLSDEVICE FAR* pdls );
+
+DXDEC HAUDIO AILCALL AIL_quick_load (char const FAR *filename);
+
+#ifdef IS_MAC
+DXDEC HAUDIO AILCALL AIL_quick_fss_load (FSSpec const FAR *filename);
+#endif
+
+DXDEC HAUDIO AILCALL AIL_quick_load_mem (void const FAR *mem,
+ U32 size);
+
+DXDEC HAUDIO AILCALL AIL_quick_copy (HAUDIO audio);
+
+DXDEC void AILCALL AIL_quick_unload (HAUDIO audio);
+
+DXDEC S32 AILCALL AIL_quick_play (HAUDIO audio,
+ U32 loop_count);
+
+DXDEC void AILCALL AIL_quick_halt (HAUDIO audio);
+
+DXDEC S32 AILCALL AIL_quick_status (HAUDIO audio);
+
+DXDEC HAUDIO AILCALL AIL_quick_load_and_play (char const FAR *filename,
+ U32 loop_count,
+ S32 wait_request);
+
+#ifdef IS_MAC
+DXDEC HAUDIO AILCALL AIL_quick_fss_load_and_play (FSSpec const FAR *filename,
+ U32 loop_count,
+ S32 wait_request);
+#endif
+
+DXDEC void AILCALL AIL_quick_set_speed (HAUDIO audio, S32 speed);
+
+DXDEC void AILCALL AIL_quick_set_volume (HAUDIO audio, S32 volume, S32 extravol);
+
+DXDEC void AILCALL AIL_quick_set_reverb (HAUDIO audio,
+ F32 reverb_level,
+ F32 reverb_reflect_time,
+ F32 reverb_decay_time);
+
+DXDEC void AILCALL AIL_quick_set_ms_position(HAUDIO audio,S32 milliseconds);
+
+DXDEC S32 AILCALL AIL_quick_ms_position(HAUDIO audio);
+
+DXDEC S32 AILCALL AIL_quick_ms_length(HAUDIO audio);
+
+
+#define AIL_QUICK_XMIDI_TYPE 1
+#define AIL_QUICK_DIGITAL_TYPE 2
+#define AIL_QUICK_DLS_XMIDI_TYPE 3
+#define AIL_QUICK_MPEG_DIGITAL_TYPE 4
+
+DXDEC S32 AILCALL AIL_quick_type(HAUDIO audio);
+
+//
+// used for AIL_process
+//
+
+typedef struct _AILMIXINFO {
+ AILSOUNDINFO Info;
+ ADPCMDATA mss_adpcm;
+ U32 src_fract;
+ S32 left_val;
+ S32 right_val;
+} AILMIXINFO;
+
+
+
+DXDEC S32 AILCALL AIL_WAV_info(void const FAR* data, AILSOUNDINFO FAR* info);
+
+DXDEC S32 AILCALL AIL_size_processed_digital_audio(
+ U32 dest_rate,
+ U32 dest_format,
+ S32 num_srcs,
+ AILMIXINFO const FAR* src);
+
+DXDEC S32 AILCALL AIL_process_digital_audio(
+ void FAR *dest_buffer,
+ S32 dest_buffer_size,
+ U32 dest_rate,
+ U32 dest_format,
+ S32 num_srcs,
+ AILMIXINFO FAR* src);
+
+#define AIL_LENGTHY_INIT 0
+#define AIL_LENGTHY_SET_PREFERENCE 1
+#define AIL_LENGTHY_UPDATE 2
+#define AIL_LENGTHY_DONE 3
+
+typedef S32 (AILCALLBACK FAR* AILLENGTHYCB)(U32 state,U32 user);
+
+typedef S32 (AILCALLBACK FAR* AILCODECSETPREF)(char const FAR* preference,U32 value);
+
+DXDEC S32 AILCALL AIL_compress_ASI(AILSOUNDINFO const FAR * info, //)
+ char const FAR* filename_ext,
+ void FAR* FAR* outdata,
+ U32 FAR* outsize,
+ AILLENGTHYCB callback);
+
+DXDEC S32 AILCALL AIL_decompress_ASI(void const FAR* indata, //)
+ U32 insize,
+ char const FAR* filename_ext,
+ void FAR* FAR* wav,
+ U32 FAR* wavsize,
+ AILLENGTHYCB callback);
+
+DXDEC S32 AILCALL AIL_compress_ADPCM(AILSOUNDINFO const FAR * info,
+ void FAR* FAR* outdata, U32 FAR* outsize);
+
+DXDEC S32 AILCALL AIL_decompress_ADPCM(AILSOUNDINFO const FAR * info,
+ void FAR* FAR* outdata, U32 FAR* outsize);
+
+DXDEC S32 AILCALL AIL_compress_DLS(void const FAR* dls,
+ char const FAR* compression_extension,
+ void FAR* FAR* mls, U32 FAR* mlssize,
+ AILLENGTHYCB callback);
+
+DXDEC S32 AILCALL AIL_merge_DLS_with_XMI(void const FAR* xmi, void const FAR* dls,
+ void FAR* FAR* mss, U32 FAR* msssize);
+
+DXDEC S32 AILCALL AIL_extract_DLS( void const FAR *source_image, //)
+ U32 source_size,
+ void FAR * FAR *XMI_output_data,
+ U32 FAR *XMI_output_size,
+ void FAR * FAR *DLS_output_data,
+ U32 FAR *DLS_output_size,
+ AILLENGTHYCB callback);
+
+#define AILFILTERDLS_USINGLIST 1
+
+DXDEC S32 AILCALL AIL_filter_DLS_with_XMI(void const FAR* xmi, void const FAR* dls,
+ void FAR* FAR* dlsout, U32 FAR* dlssize,
+ S32 flags, AILLENGTHYCB callback);
+
+#define AILMIDITOXMI_USINGLIST 1
+#define AILMIDITOXMI_TOLERANT 2
+
+DXDEC S32 AILCALL AIL_MIDI_to_XMI (void const FAR* MIDI,
+ U32 MIDI_size,
+ void FAR* FAR*XMIDI,
+ U32 FAR* XMIDI_size,
+ S32 flags);
+
+#define AILMIDILIST_ROLANDSYSEX 1
+#define AILMIDILIST_ROLANDUN 2
+#define AILMIDILIST_ROLANDAB 4
+
+DXDEC S32 AILCALL AIL_list_MIDI (void const FAR* MIDI,
+ U32 MIDI_size,
+ char FAR* FAR* lst,
+ U32 FAR* lst_size,
+ S32 flags);
+#define AILDLSLIST_ARTICULATION 1
+#define AILDLSLIST_DUMP_WAVS 2
+
+DXDEC S32 AILCALL AIL_list_DLS (void const FAR* DLS,
+ char FAR* FAR* lst,
+ U32 FAR* lst_size,
+ S32 flags,
+ C8 FAR* title);
+
+#define AILFILETYPE_UNKNOWN 0
+#define AILFILETYPE_PCM_WAV 1
+#define AILFILETYPE_ADPCM_WAV 2
+#define AILFILETYPE_OTHER_WAV 3
+#define AILFILETYPE_VOC 4
+#define AILFILETYPE_MIDI 5
+#define AILFILETYPE_XMIDI 6
+#define AILFILETYPE_XMIDI_DLS 7
+#define AILFILETYPE_XMIDI_MLS 8
+#define AILFILETYPE_DLS 9
+#define AILFILETYPE_MLS 10
+#define AILFILETYPE_MPEG_L1_AUDIO 11
+#define AILFILETYPE_MPEG_L2_AUDIO 12
+#define AILFILETYPE_MPEG_L3_AUDIO 13
+#define AILFILETYPE_OTHER_ASI_WAV 14
+
+
+DXDEC S32 AILCALL AIL_file_type(void const FAR* data, U32 size);
+
+DXDEC S32 AILCALL AIL_find_DLS (void const FAR* data, U32 size,
+ void FAR* FAR* xmi, U32 FAR* xmisize,
+ void FAR* FAR* dls, U32 FAR* dlssize);
+
+#if defined(IS_WIN32) || defined(IS_MAC)
+
+//
+// Auxiliary 2D interface calls
+//
+
+DXDEC HDIGDRIVER AILCALL AIL_primary_digital_driver (HDIGDRIVER new_primary);
+
+//
+// Filter result codes
+//
+
+typedef S32 FLTRESULT;
+
+#define FLT_NOERR 0 // Success -- no error
+#define FLT_NOT_ENABLED 1 // FLT not enabled
+#define FLT_ALREADY_STARTED 2 // FLT already started
+#define FLT_INVALID_PARAM 3 // Invalid parameters used
+#define FLT_INTERNAL_ERR 4 // Internal error in FLT driver
+#define FLT_OUT_OF_MEM 5 // Out of system RAM
+#define FLT_ERR_NOT_IMPLEMENTED 6 // Feature not implemented
+#define FLT_NOT_FOUND 7 // FLT supported device not found
+#define FLT_NOT_INIT 8 // FLT not initialized
+#define FLT_CLOSE_ERR 9 // FLT not closed correctly
+
+//############################################################################
+//## ##
+//## Interface "MSS pipeline filter" ##
+//## ##
+//############################################################################
+
+typedef FLTRESULT (AILCALL FAR *FLT_STARTUP)(void);
+
+typedef FLTRESULT (AILCALL FAR *FLT_SHUTDOWN)(void);
+
+typedef C8 FAR * (AILCALL FAR *FLT_ERROR)(void);
+
+typedef S32 (AILCALL FAR *FLT_SET_PROVIDER_PREFERENCE)(HATTRIB preference,
+ void const FAR* value);
+
+typedef HDRIVERSTATE (AILCALL FAR *FLT_OPEN_DRIVER) (HDIGDRIVER dig,
+ S32 FAR *build_buffer,
+ S32 build_buffer_size);
+
+typedef FLTRESULT (AILCALL FAR *FLT_CLOSE_DRIVER) (HDRIVERSTATE state);
+
+typedef void (AILCALL FAR *FLT_PREMIX_PROCESS) (HDRIVERSTATE driver
+#ifdef IS_MAC
+ ,U32 buffer_size
+#endif
+);
+
+typedef void (AILCALL FAR *FLT_POSTMIX_PROCESS) (HDRIVERSTATE driver
+#ifdef IS_MAC
+ ,U32 buffer_size
+#endif
+);
+
+//############################################################################
+//## ##
+//## Interface "Pipeline filter sample services" ##
+//## ##
+//############################################################################
+
+typedef HSAMPLESTATE (AILCALL FAR * FLTSMP_OPEN_SAMPLE) (HDRIVERSTATE driver,
+ HSAMPLE S);
+
+typedef FLTRESULT (AILCALL FAR * FLTSMP_CLOSE_SAMPLE) (HSAMPLESTATE state);
+
+typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_PROCESS) (HSAMPLESTATE state,
+ void const FAR * FAR *orig_src,
+ U32 FAR * orig_src_fract,
+ void FAR * orig_src_end,
+ S32 FAR * FAR *build_dest,
+ void FAR * build_dest_end,
+ S32 FAR * left_val,
+ S32 FAR * right_val,
+ S32 playback_ratio,
+ S32 left_scale,
+ S32 right_scale,
+ S32 base_scale,
+ MIXSTAGE FAR * mixer_provider,
+ U32 mixer_operation);
+
+typedef S32 (AILCALL FAR * FLTSMP_SAMPLE_ATTRIBUTE) (HSAMPLESTATE state,
+ HATTRIB attribute);
+
+typedef S32 (AILCALL FAR * FLTSMP_SET_SAMPLE_PREFERENCE) (HSAMPLESTATE state,
+ HATTRIB preference,
+ void const FAR* value);
+
+//
+// Pipeline filter calls
+//
+
+DXDEC S32 AILCALL AIL_enumerate_filters (HPROENUM FAR *next,
+ HPROVIDER FAR *dest,
+ C8 FAR * FAR *name);
+
+DXDEC HDRIVERSTATE
+ AILCALL AIL_open_filter (HPROVIDER lib,
+ HDIGDRIVER dig);
+
+DXDEC void AILCALL AIL_close_filter (HDRIVERSTATE filter);
+
+DXDEC S32 AILCALL AIL_enumerate_filter_attributes
+ (HPROVIDER lib,
+ HINTENUM FAR * next,
+ RIB_INTERFACE_ENTRY FAR * dest);
+
+DXDEC void AILCALL AIL_filter_attribute (HPROVIDER lib,
+ C8 const FAR* name,
+ void FAR * val);
+
+DXDEC void AILCALL AIL_set_filter_preference
+ (HPROVIDER lib,
+ C8 const FAR* name,
+ void const FAR* val);
+
+DXDEC S32 AILCALL AIL_enumerate_filter_sample_attributes
+ (HPROVIDER lib,
+ HINTENUM FAR * next,
+ RIB_INTERFACE_ENTRY FAR * dest);
+
+DXDEC void AILCALL AIL_filter_sample_attribute
+ (HSAMPLE S,
+ C8 const FAR* name,
+ void FAR * val);
+
+DXDEC void AILCALL AIL_filter_stream_attribute
+ (HSTREAM S,
+ C8 const FAR* name,
+ void FAR* val);
+
+DXDEC void AILCALL AIL_filter_DLS_attribute
+ (HDLSDEVICE dls,
+ C8 const FAR* name,
+ void FAR * val);
+
+DXDEC void AILCALL AIL_set_filter_sample_preference
+ (HSAMPLE S,
+ C8 const FAR * name,
+ void const FAR * val);
+
+DXDEC void AILCALL AIL_set_filter_stream_preference
+ (HSTREAM S,
+ C8 const FAR * name,
+ void const FAR * val);
+
+DXDEC void AILCALL AIL_set_filter_DLS_preference
+ (HDLSDEVICE dls,
+ C8 const FAR * name,
+ void const FAR * val);
+
+typedef struct _FLTPROVIDER
+{
+ PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute;
+
+ FLT_STARTUP startup;
+ FLT_ERROR error;
+ FLT_SHUTDOWN shutdown;
+ FLT_SET_PROVIDER_PREFERENCE set_provider_preference;
+ FLT_OPEN_DRIVER open_driver;
+ FLT_CLOSE_DRIVER close_driver;
+ FLT_PREMIX_PROCESS premix_process;
+ FLT_POSTMIX_PROCESS postmix_process;
+
+ FLTSMP_OPEN_SAMPLE open_sample;
+ FLTSMP_CLOSE_SAMPLE close_sample;
+ FLTSMP_SAMPLE_PROCESS sample_process;
+ FLTSMP_SAMPLE_ATTRIBUTE sample_attribute;
+ FLTSMP_SET_SAMPLE_PREFERENCE set_sample_preference;
+
+ HDIGDRIVER dig;
+ HPROVIDER provider;
+ HDRIVERSTATE driver_state;
+
+ struct _FLTPROVIDER FAR *next;
+}
+FLTPROVIDER;
+
+//
+// 3D provider calls
+//
+
+DXDEC S32 AILCALL AIL_enumerate_3D_providers (HPROENUM FAR *next,
+ HPROVIDER FAR *dest,
+ C8 FAR * FAR *name);
+
+DXDEC M3DRESULT AILCALL AIL_open_3D_provider (HPROVIDER lib);
+
+DXDEC void AILCALL AIL_close_3D_provider (HPROVIDER lib);
+
+DXDEC S32 AILCALL AIL_enumerate_3D_provider_attributes
+ (HPROVIDER lib,
+ HINTENUM FAR * next,
+ RIB_INTERFACE_ENTRY FAR * dest);
+
+DXDEC void AILCALL AIL_3D_provider_attribute (HPROVIDER lib,
+ C8 const FAR* name,
+ void FAR * val);
+
+DXDEC void AILCALL AIL_set_3D_provider_preference(HPROVIDER lib,
+ C8 const FAR* name,
+ void const FAR* val);
+
+struct H3D
+{
+ H3DPOBJECT actual;
+ HPROVIDER owner;
+ S32 user_data[8];
+};
+
+typedef struct _M3DPROVIDER
+{
+ PROVIDER_QUERY_ATTRIBUTE PROVIDER_query_attribute;
+ M3D_STARTUP startup;
+ M3D_ERROR error;
+ M3D_SHUTDOWN shutdown;
+ M3D_SET_PROVIDER_PREFERENCE set_provider_preference;
+ M3D_ACTIVATE activate;
+ M3D_ALLOCATE_3D_SAMPLE_HANDLE allocate_3D_sample_handle;
+ M3D_RELEASE_3D_SAMPLE_HANDLE release_3D_sample_handle;
+ M3D_START_3D_SAMPLE start_3D_sample;
+ M3D_STOP_3D_SAMPLE stop_3D_sample;
+ M3D_RESUME_3D_SAMPLE resume_3D_sample;
+ M3D_END_3D_SAMPLE end_3D_sample;
+ M3D_SET_3D_SAMPLE_DATA set_3D_sample_data;
+ M3D_SET_3D_SAMPLE_VOLUME set_3D_sample_volume;
+ M3D_SET_3D_SAMPLE_PLAYBACK_RATE set_3D_sample_playback_rate;
+ M3D_SET_3D_SAMPLE_OFFSET set_3D_sample_offset;
+ M3D_SET_3D_SAMPLE_LOOP_COUNT set_3D_sample_loop_count;
+ M3D_SET_3D_SAMPLE_LOOP_BLOCK set_3D_sample_loop_block;
+ M3D_3D_SAMPLE_STATUS sample_status;
+ M3D_3D_SAMPLE_VOLUME sample_volume;
+ M3D_3D_SAMPLE_PLAYBACK_RATE sample_playback_rate;
+ M3D_3D_SAMPLE_OFFSET sample_offset;
+ M3D_3D_SAMPLE_LENGTH sample_length;
+ M3D_3D_SAMPLE_LOOP_COUNT sample_loop_count;
+ M3D_SET_3D_SAMPLE_DISTANCES set_3D_sample_distances;
+ M3D_3D_SAMPLE_DISTANCES sample_distances;
+ M3D_ACTIVE_3D_SAMPLE_COUNT active_3D_sample_count;
+ M3D_3D_OPEN_LISTENER open_listener;
+ M3D_3D_CLOSE_LISTENER close_listener;
+ M3D_3D_OPEN_OBJECT open_object;
+ M3D_3D_CLOSE_OBJECT close_object;
+ M3D_SET_3D_POSITION set_3D_position;
+ M3D_SET_3D_VELOCITY set_3D_velocity;
+ M3D_SET_3D_VELOCITY_VECTOR set_3D_velocity_vector;
+ M3D_SET_3D_ORIENTATION set_3D_orientation;
+ M3D_3D_POSITION position;
+ M3D_3D_VELOCITY velocity;
+ M3D_3D_ORIENTATION orientation;
+ M3D_3D_UPDATE_POSITION update_position;
+ M3D_3D_AUTO_UPDATE_POSITION auto_update_position;
+ M3D_3D_SAMPLE_ATTRIBUTE sample_query_attribute;
+ M3D_3D_SET_SAMPLE_PREFERENCE set_sample_preference;
+ M3D_3D_ROOM_TYPE room_type;
+ M3D_SET_3D_ROOM_TYPE set_3D_room_type;
+ M3D_3D_SPEAKER_TYPE speaker_type;
+ M3D_SET_3D_SPEAKER_TYPE set_3D_speaker_type;
+ M3D_SET_3D_SAMPLE_OBSTRUCTION set_3D_sample_obstruction;
+ M3D_SET_3D_SAMPLE_OCCLUSION set_3D_sample_occlusion;
+ M3D_SET_3D_SAMPLE_CONE set_3D_sample_cone;
+ M3D_SET_3D_SAMPLE_EFFECTS_LEVEL set_3D_sample_effects_level;
+ M3D_3D_SAMPLE_OBSTRUCTION sample_obstruction;
+ M3D_3D_SAMPLE_OCCLUSION sample_occlusion;
+ M3D_3D_SAMPLE_CONE sample_cone;
+ M3D_3D_SAMPLE_EFFECTS_LEVEL sample_effects_level;
+ M3D_SET_3D_EOS set_3D_EOS;
+} M3DPROVIDER;
+
+//
+// Sample calls
+//
+
+DXDEC H3DSAMPLE AILCALL AIL_allocate_3D_sample_handle
+ (HPROVIDER lib);
+
+
+DXDEC void AILCALL AIL_release_3D_sample_handle
+ (H3DSAMPLE S);
+
+
+DXDEC void AILCALL AIL_start_3D_sample (H3DSAMPLE S);
+
+
+DXDEC void AILCALL AIL_stop_3D_sample (H3DSAMPLE S);
+
+
+DXDEC void AILCALL AIL_resume_3D_sample (H3DSAMPLE S);
+
+DXDEC void AILCALL AIL_end_3D_sample (H3DSAMPLE S);
+
+DXDEC S32 AILCALL AIL_set_3D_sample_file (H3DSAMPLE S,
+ void const FAR*file_image);
+
+DXDEC S32 AILCALL AIL_set_3D_sample_info (H3DSAMPLE S,
+ AILSOUNDINFO const FAR*info);
+
+DXDEC void AILCALL AIL_set_3D_sample_volume (H3DSAMPLE S,
+ S32 volume);
+
+DXDEC void AILCALL AIL_set_3D_sample_offset (H3DSAMPLE S,
+ U32 offset);
+
+DXDEC void AILCALL AIL_set_3D_sample_playback_rate
+ (H3DSAMPLE S,
+ S32 playback_rate);
+
+DXDEC void AILCALL AIL_set_3D_sample_loop_count(H3DSAMPLE S,
+ U32 loops);
+
+DXDEC void AILCALL AIL_set_3D_sample_loop_block(H3DSAMPLE S,
+ S32 loop_start_offset,
+ S32 loop_end_offset);
+
+DXDEC U32 AILCALL AIL_3D_sample_status (H3DSAMPLE S);
+
+DXDEC S32 AILCALL AIL_3D_sample_volume (H3DSAMPLE S);
+
+DXDEC U32 AILCALL AIL_3D_sample_offset (H3DSAMPLE S);
+
+DXDEC S32 AILCALL AIL_3D_sample_playback_rate (H3DSAMPLE S);
+
+DXDEC U32 AILCALL AIL_3D_sample_length (H3DSAMPLE S);
+
+DXDEC U32 AILCALL AIL_3D_sample_loop_count (H3DSAMPLE S);
+
+
+DXDEC S32 AILCALL AIL_3D_room_type (HPROVIDER lib);
+
+DXDEC void AILCALL AIL_set_3D_room_type (HPROVIDER lib,
+ S32 room_type);
+
+#define AIL_3D_2_SPEAKER 0
+#define AIL_3D_HEADPHONE 1
+#define AIL_3D_SURROUND 2
+#define AIL_3D_4_SPEAKER 3
+
+
+DXDEC S32 AILCALL AIL_3D_speaker_type (HPROVIDER lib);
+
+DXDEC void AILCALL AIL_set_3D_speaker_type (HPROVIDER lib,
+ S32 speaker_type);
+
+
+//
+// Changed the definition of distances to only be max and min, vs. front
+// min/max and back min/max. Only RSX supported the concept of different
+// front and distances, so we changed the API to make it more orthogonal
+// to most of the 3D providers. Sorry in advance.
+//
+
+DXDEC void AILCALL AIL_set_3D_sample_distances (H3DSAMPLE S,
+ F32 max_dist,
+ F32 min_dist);
+
+
+DXDEC void AILCALL AIL_3D_sample_distances (H3DSAMPLE S,
+ F32 FAR * max_dist,
+ F32 FAR * min_dist);
+
+DXDEC S32 AILCALL AIL_active_3D_sample_count (HPROVIDER lib);
+
+DXDEC S32 AILCALL AIL_enumerate_3D_sample_attributes
+ (HPROVIDER lib,
+ HINTENUM FAR * next,
+ RIB_INTERFACE_ENTRY FAR * dest);
+
+DXDEC void AILCALL AIL_3D_sample_attribute (H3DSAMPLE samp,
+ C8 const FAR* name,
+ void FAR * val);
+
+
+DXDEC void AILCALL AIL_set_3D_sample_preference (H3DSAMPLE samp,
+ C8 const FAR* name,
+ void const FAR* val);
+
+DXDEC void AILCALL AIL_set_3D_sample_obstruction (H3DSAMPLE S,
+ F32 obstruction);
+
+DXDEC void AILCALL AIL_set_3D_sample_occlusion (H3DSAMPLE S,
+ F32 occlusion);
+
+DXDEC void AILCALL AIL_set_3D_sample_cone (H3DSAMPLE S,
+ F32 inner_angle,
+ F32 outer_angle,
+ S32 outer_volume);
+
+DXDEC void AILCALL AIL_set_3D_sample_effects_level
+ (H3DSAMPLE S,
+ F32 effects_level);
+
+DXDEC F32 AILCALL AIL_3D_sample_obstruction (H3DSAMPLE S);
+
+DXDEC F32 AILCALL AIL_3D_sample_occlusion (H3DSAMPLE S);
+
+DXDEC void AILCALL AIL_3D_sample_cone (H3DSAMPLE S,
+ F32 FAR* inner_angle,
+ F32 FAR* outer_angle,
+ S32 FAR* outer_volume);
+
+DXDEC F32 AILCALL AIL_3D_sample_effects_level (H3DSAMPLE S);
+
+
+DXDEC AIL3DSAMPLECB AILCALL AIL_register_3D_EOS_callback
+ (H3DSAMPLE S,
+ AIL3DSAMPLECB EOS);
+
+
+//
+// Positioning-object allocation calls
+//
+
+DXDEC H3DPOBJECT AILCALL AIL_open_3D_listener (HPROVIDER lib);
+
+DXDEC void AILCALL AIL_close_3D_listener (H3DPOBJECT listener);
+
+DXDEC H3DPOBJECT AILCALL AIL_open_3D_object (HPROVIDER lib);
+
+DXDEC void AILCALL AIL_close_3D_object (H3DPOBJECT obj);
+
+//
+// 3D object calls
+//
+
+DXDEC void AILCALL AIL_set_3D_position (H3DPOBJECT obj,
+ F32 X,
+ F32 Y,
+ F32 Z);
+
+DXDEC void AILCALL AIL_set_3D_velocity (H3DPOBJECT obj,
+ F32 dX_per_ms,
+ F32 dY_per_ms,
+ F32 dZ_per_ms,
+ F32 magnitude);
+
+DXDEC void AILCALL AIL_set_3D_velocity_vector (H3DPOBJECT obj,
+ F32 dX_per_ms,
+ F32 dY_per_ms,
+ F32 dZ_per_ms);
+
+DXDEC void AILCALL AIL_set_3D_orientation (H3DPOBJECT obj,
+ F32 X_face,
+ F32 Y_face,
+ F32 Z_face,
+ F32 X_up,
+ F32 Y_up,
+ F32 Z_up);
+
+DXDEC void AILCALL AIL_3D_position (H3DPOBJECT obj,
+ F32 FAR *X,
+ F32 FAR *Y,
+ F32 FAR *Z);
+
+DXDEC void AILCALL AIL_3D_velocity (H3DPOBJECT obj,
+ F32 FAR *dX_per_ms,
+ F32 FAR *dY_per_ms,
+ F32 FAR *dZ_per_ms);
+
+DXDEC void AILCALL AIL_3D_orientation (H3DPOBJECT obj,
+ F32 FAR *X_face,
+ F32 FAR *Y_face,
+ F32 FAR *Z_face,
+ F32 FAR *X_up,
+ F32 FAR *Y_up,
+ F32 FAR *Z_up);
+
+DXDEC void AILCALL AIL_update_3D_position (H3DPOBJECT obj,
+ F32 dt_milliseconds);
+
+DXDEC void AILCALL AIL_auto_update_3D_position (H3DPOBJECT obj,
+ S32 enable);
+
+DXDEC void AILCALL AIL_set_3D_user_data (H3DPOBJECT obj,
+ U32 index,
+ S32 value);
+
+DXDEC S32 AILCALL AIL_3D_user_data (H3DPOBJECT obj,
+ U32 index);
+
+// Obsolete 3D function names:
+#define AIL_set_3D_object_user_data AIL_set_3D_user_data
+#define AIL_3D_object_user_data AIL_3D_user_data
+#define AIL_3D_open_listener AIL_open_3D_listener
+#define AIL_3D_close_listener AIL_close_3D_listener
+#define AIL_3D_open_object AIL_open_3D_object
+#define AIL_3D_close_object AIL_close_3D_object
+
+//
+// RAD room types - currently the same as EAX
+//
+
+enum
+{
+ ENVIRONMENT_GENERIC, // factory default
+ ENVIRONMENT_PADDEDCELL,
+ ENVIRONMENT_ROOM, // standard environments
+ ENVIRONMENT_BATHROOM,
+ ENVIRONMENT_LIVINGROOM,
+ ENVIRONMENT_STONEROOM,
+ ENVIRONMENT_AUDITORIUM,
+ ENVIRONMENT_CONCERTHALL,
+ ENVIRONMENT_CAVE,
+ ENVIRONMENT_ARENA,
+ ENVIRONMENT_HANGAR,
+ ENVIRONMENT_CARPETEDHALLWAY,
+ ENVIRONMENT_HALLWAY,
+ ENVIRONMENT_STONECORRIDOR,
+ ENVIRONMENT_ALLEY,
+ ENVIRONMENT_FOREST,
+ ENVIRONMENT_CITY,
+ ENVIRONMENT_MOUNTAINS,
+ ENVIRONMENT_QUARRY,
+ ENVIRONMENT_PLAIN,
+ ENVIRONMENT_PARKINGLOT,
+ ENVIRONMENT_SEWERPIPE,
+ ENVIRONMENT_UNDERWATER,
+ ENVIRONMENT_DRUGGED,
+ ENVIRONMENT_DIZZY,
+ ENVIRONMENT_PSYCHOTIC,
+
+ ENVIRONMENT_COUNT // total number of environments
+};
+
+//
+// enumerated values for EAX
+//
+
+#ifndef EAX_H_INCLUDED
+
+enum
+{
+ EAX_ENVIRONMENT_GENERIC, // factory default
+ EAX_ENVIRONMENT_PADDEDCELL,
+ EAX_ENVIRONMENT_ROOM, // standard environments
+ EAX_ENVIRONMENT_BATHROOM,
+ EAX_ENVIRONMENT_LIVINGROOM,
+ EAX_ENVIRONMENT_STONEROOM,
+ EAX_ENVIRONMENT_AUDITORIUM,
+ EAX_ENVIRONMENT_CONCERTHALL,
+ EAX_ENVIRONMENT_CAVE,
+ EAX_ENVIRONMENT_ARENA,
+ EAX_ENVIRONMENT_HANGAR,
+ EAX_ENVIRONMENT_CARPETEDHALLWAY,
+ EAX_ENVIRONMENT_HALLWAY,
+ EAX_ENVIRONMENT_STONECORRIDOR,
+ EAX_ENVIRONMENT_ALLEY,
+ EAX_ENVIRONMENT_FOREST,
+ EAX_ENVIRONMENT_CITY,
+ EAX_ENVIRONMENT_MOUNTAINS,
+ EAX_ENVIRONMENT_QUARRY,
+ EAX_ENVIRONMENT_PLAIN,
+ EAX_ENVIRONMENT_PARKINGLOT,
+ EAX_ENVIRONMENT_SEWERPIPE,
+ EAX_ENVIRONMENT_UNDERWATER,
+ EAX_ENVIRONMENT_DRUGGED,
+ EAX_ENVIRONMENT_DIZZY,
+ EAX_ENVIRONMENT_PSYCHOTIC,
+
+ EAX_ENVIRONMENT_COUNT // total number of environments
+};
+
+#define EAX_REVERBMIX_USEDISTANCE (-1.0F)
+
+#endif
+
+#else
+
+typedef struct _FLTPROVIDER
+{
+ U32 junk;
+} FLTPROVIDER;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#if defined(_PUSHPOP_SUPPORTED) || PRAGMA_STRUCT_PACKPUSH
+ #pragma pack(pop)
+#else
+ #pragma pack()
+#endif
+
+
+#endif
diff --git a/milessdk/lib/mss32.lib b/milessdk/lib/mss32.lib
new file mode 100644
index 00000000..031fd1bd
--- /dev/null
+++ b/milessdk/lib/mss32.lib
Binary files differ
diff --git a/premake5.lua b/premake5.lua
index 0d28573b..8b2373a1 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -17,6 +17,7 @@ workspace "re3"
files { "src/skel/win/*.*" }
files { "src/vehicles/*.*" }
files { "src/weapons/*.*" }
+ files { "eax/*.*" }
includedirs { "src" }
includedirs { "src/animation" }
@@ -33,11 +34,15 @@ workspace "re3"
includedirs { "src/skel/win" }
includedirs { "src/vehicles" }
includedirs { "src/weapons" }
+ includedirs { "eax" }
includedirs { "dxsdk/include" }
includedirs { "rwsdk/include/d3d8" }
+ includedirs { "milessdk/include" }
+ includedirs { "eax" }
libdirs { "dxsdk/lib" }
+ libdirs { "milessdk/lib" }
pbcommands = {
"setlocal EnableDelayedExpansion",
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index dfecafb2..ebf6a153 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -14,7 +14,7 @@
#include "Plane.h"
#include "PlayerPed.h"
#include "Pools.h"
-#include "SampleManager.h"
+#include "sampman.h"
#include "Stats.h"
#include "Vehicle.h"
#include "World.h"
@@ -148,9 +148,9 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
}
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.field_56 = 0;
@@ -350,9 +350,9 @@ cAudioManager::AgeCrimes()
}
int8
-cAudioManager::AutoDetect3DProviders()
+cAudioManager::GetCurrent3DProviderIndex()
{
- if(m_bIsInitialised) return cSampleManager.AutoDetect3DProviders();
+ if(m_bIsInitialised) return SampleManager.GetCurrent3DProviderIndex();
return -1;
}
@@ -369,7 +369,7 @@ cAudioManager::CalculateDistance(bool *ptr, float dist)
bool
cAudioManager::CheckForAnAudioFileOnCD()
{
- return cSampleManager.CheckForAnAudioFileOnCD();
+ return SampleManager.CheckForAnAudioFileOnCD();
}
void
@@ -521,12 +521,12 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bIsDistant = 1;
m_sQueueSample.field_16 = 10;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_SCANNER_CRACKLE);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_SCANNER_CRACKLE);
m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20u + 15;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
- m_sQueueSample.m_nLoopStart = cSampleManager.GetSampleLoopStartOffset(188);
- m_sQueueSample.m_nLoopEnd = cSampleManager.GetSampleLoopEndOffset(188);
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(188);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(188);
m_sQueueSample.field_56 = 0;
m_sQueueSample.m_bReverbFlag = 0;
m_sQueueSample.m_bOffset = 63;
@@ -568,9 +568,9 @@ cAudioManager::Initialise()
{
if(!m_bIsInitialised) {
PreInitialiseGameSpecificSetup();
- m_bIsInitialised = cSampleManager.Initialise();
+ m_bIsInitialised = SampleManager.Initialise();
if(m_bIsInitialised) {
- m_bActiveSamples = cSampleManager.GetActiveSamples();
+ m_bActiveSamples = SampleManager.GetMaximumSupportedChannels();
if(m_bActiveSamples <= 1u) {
Terminate();
} else {
@@ -650,10 +650,10 @@ cAudioManager::Terminate()
PreTerminateGameSpecificShutdown();
for(uint32 i = 0; i < 2; i++) {
- if(cSampleManager.IsSampleBankLoaded(i)) cSampleManager.UnloadSampleBank(i);
+ if(SampleManager.IsSampleBankLoaded(i)) SampleManager.UnloadSampleBank(i);
}
- cSampleManager.Terminate();
+ SampleManager.Terminate();
m_bIsInitialised = 0;
PostTerminateGameSpecificShutdown();
@@ -677,14 +677,14 @@ cAudioManager::GetMissionAudioLoadingStatus()
uint8
cAudioManager::GetNum3DProvidersAvailable()
{
- if(m_bIsInitialised) return num3DProvidersAvailable;
+ if(m_bIsInitialised) return SampleManager.GetNum3DProvidersAvailable();
return 0;
}
bool
cAudioManager::IsMP3RadioChannelAvailable()
{
- if(m_bIsInitialised) return cSampleManager.IsMP3RadioChannelAvailable();
+ if(m_bIsInitialised) return SampleManager.IsMP3RadioChannelAvailable();
return 0;
}
@@ -692,7 +692,7 @@ cAudioManager::IsMP3RadioChannelAvailable()
uint8
cAudioManager::GetCDAudioDriveLetter()
{
- if(m_bIsInitialised) return cSampleManager.GetCDAudioDriveLetter();
+ if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter();
return 0;
}
@@ -700,31 +700,31 @@ cAudioManager::GetCDAudioDriveLetter()
void
cAudioManager::SetEffectsMasterVolume(uint8 volume)
{
- cSampleManager.SetEffectsMasterVolume(volume);
+ SampleManager.SetEffectsMasterVolume(volume);
}
void
cAudioManager::SetMusicMasterVolume(uint8 volume)
{
- cSampleManager.SetMusicMasterVolume(volume);
+ SampleManager.SetMusicMasterVolume(volume);
}
void
-cAudioManager::SetEffectsFadeVol(uint8 volume)
+cAudioManager::SetEffectsFadeVolume(uint8 volume)
{
- cSampleManager.SetEffectsFadeVol(volume);
+ SampleManager.SetEffectsFadeVolume(volume);
}
void
-cAudioManager::SetMusicFadeVol(uint8 volume)
+cAudioManager::SetMusicFadeVolume(uint8 volume)
{
- cSampleManager.SetMusicFadeVol(volume);
+ SampleManager.SetMusicFadeVolume(volume);
}
void
cAudioManager::SetSpeakerConfig(int32 conf)
{
- cSampleManager.SetSpeakerConfig(conf);
+ SampleManager.SetSpeakerConfig(conf);
}
WRAPPER
@@ -802,8 +802,8 @@ char *
cAudioManager::Get3DProviderName(uint8 id)
{
if(!m_bIsInitialised) return 0;
- if(id >= num3DProvidersAvailable) return 0;
- return asName3DProviders[id];
+ if(id >= SampleManager.GetNum3DProvidersAvailable()) return 0;
+ return SampleManager.Get3DProviderName(id);
}
bool
@@ -824,16 +824,16 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_FLY_SOUND);
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSoundIntensity = 440.0f;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_48 = 4.0;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.field_76 = 5;
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
AddSampleToRequestedQueue();
}
return 1;
@@ -853,13 +853,13 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_bIsDistant = 1;
m_sQueueSample.field_16 = 1;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_JUMBO_RUMBLE_SOUND);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 4.0;
m_sQueueSample.m_fSoundIntensity = 240.0;
m_sQueueSample.field_56 = 0;
@@ -902,9 +902,9 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 4.0f;
m_sQueueSample.m_fSoundIntensity = 180.0f;
m_sQueueSample.field_56 = 0;
@@ -933,9 +933,9 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 4.0f;
m_sQueueSample.m_fSoundIntensity = 170.0f;
m_sQueueSample.field_56 = 0;
@@ -971,7 +971,7 @@ void
cAudioManager::ResetPoliceRadio()
{
if(m_bIsInitialised) {
- if(cSampleManager.GetChannelUsedFlag(28)) cSampleManager.StopChannel(28);
+ if(SampleManager.GetChannelUsedFlag(28)) SampleManager.StopChannel(28);
InitialisePoliceRadio();
}
}
@@ -1043,13 +1043,13 @@ cAudioManager::RandomDisplacement(uint32 seed)
void
cAudioManager::ReleaseDigitalHandle()
{
- if(m_bIsInitialised) { cSampleManager.ReleaseDigitalHandle(); }
+ if(m_bIsInitialised) { SampleManager.ReleaseDigitalHandle(); }
}
void
-cAudioManager::RequireDigitalHandle()
+cAudioManager::ReacquireDigitalHandle()
{
- if(m_bIsInitialised) { cSampleManager.RequireDigitalHandle(); }
+ if(m_bIsInitialised) { SampleManager.ReacquireDigitalHandle(); }
}
void
@@ -1141,7 +1141,7 @@ uint8 &jumboVolOffset = *(uint8 *)0x6508ED;
void
cAudioManager::DoJumboVolOffset()
{
- if(!(m_nTimeOfRecentCrime % (m_anRandomTable[0] % 6u + 3)))
+ if(!(m_FrameCounter % (m_anRandomTable[0] % 6u + 3)))
jumboVolOffset = m_anRandomTable[1] % 60u;
}
@@ -3447,7 +3447,7 @@ cAudioManager::ProcessActiveQueues()
v6 = (v6 + 92);
}
if(v5->m_nLoopCount) {
- if(m_nTimeOfRecentCrime & 1) {
+ if(m_FrameCounter & 1) {
if(!(j & 1)) {
v8 = 0;
goto LABEL_17;
@@ -3459,7 +3459,7 @@ cAudioManager::ProcessActiveQueues()
v8 = 0;
}
LABEL_17:
- if(v8 && !cSampleManager.GetChannelUsedFlag(j)) {
+ if(v8 && !SampleManager.GetChannelUsedFlag(j)) {
v5->m_bLoopEnded = 1;
m_asActiveSamples[0].m_bLoopEnded = 1;
m_asActiveSamples[0].m_nSampleIndex = NO_SAMPLE;
@@ -3482,8 +3482,8 @@ cAudioManager::ProcessActiveQueues()
} else {
v43 = v5->m_bEmittingVolume;
}
- cSampleManager.SetChannelFrequency(j, v5->m_nFrequency);
- cSampleManager.SetChannelEmittingVolume(j, v43);
+ SampleManager.SetChannelFrequency(j, v5->m_nFrequency);
+ SampleManager.SetChannelEmittingVolume(j, v43);
} else {
v10 = m_asActiveSamples[0].m_fDistance;
v11 = v5->m_fDistance;
@@ -3505,7 +3505,7 @@ cAudioManager::ProcessActiveQueues()
newFreq = activeSampleFreq + 6000;
}
v7->m_nFrequency = newFreq;
- cSampleManager.SetChannelFrequency(j, newFreq);
+ SampleManager.SetChannelFrequency(j, newFreq);
}
v40 = v7->m_bEmittingVolume;
v17 = v5->m_bEmittingVolume;
@@ -3527,16 +3527,16 @@ cAudioManager::ProcessActiveQueues()
} else {
v19 = v41;
}
- cSampleManager.SetChannelEmittingVolume(j, v19);
+ SampleManager.SetChannelEmittingVolume(j, v19);
v7->m_bEmittingVolume = v41;
}
TranslateEntity(&v5->m_vecPos, &a2);
- cSampleManager.SetChannel3DPosition(j, a2.x, a2.y, a2.z);
+ SampleManager.SetChannel3DPosition(j, a2.x, a2.y, a2.z);
v20 = 0.25f * v5->m_fSoundIntensity;
- cSampleManager.SetChannel3DDistances(
+ SampleManager.SetChannel3DDistances(
j, v5->m_fSoundIntensity, v20);
}
- cSampleManager.SetChannelReverbFlag(j, v5->m_bReverbFlag);
+ SampleManager.SetChannelReverbFlag(j, v5->m_bReverbFlag);
continue;
}
v5->m_bIsProcessed = 0;
@@ -3550,7 +3550,7 @@ cAudioManager::ProcessActiveQueues()
for(uint32 i = 0; v22 < m_bActiveSamples; i++) {
if(v23->m_asActiveSamples[0].m_nSampleIndex != NO_SAMPLE &&
!v23->m_asActiveSamples[0].m_bIsProcessed) {
- cSampleManager.StopChannel(i);
+ SampleManager.StopChannel(i);
v23->m_asActiveSamples[0].m_nSampleIndex = NO_SAMPLE;
v23->m_asActiveSamples[0].m_nEntityIndex = -5;
}
@@ -3577,7 +3577,7 @@ cAudioManager::ProcessActiveQueues()
if(!v26->m_nLoopCount) goto LABEL_80;
v28 = v26->m_nFrequency / field_19192;
v29 = v26->m_nLoopCount *
- cSampleManager.GetSampleLength(
+ SampleManager.GetSampleLength(
v26->m_nSampleIndex);
if(v28) {
v26->field_76 = v29 / v28 + 1;
@@ -3603,28 +3603,28 @@ cAudioManager::ProcessActiveQueues()
v45 = v27->m_asActiveSamples[0]
.m_bEmittingVolume;
}
- if(cSampleManager.InitialiseChannel(
+ if(SampleManager.InitialiseChannel(
l,
v27->m_asActiveSamples[0]
.m_nSampleIndex,
v27->m_asActiveSamples[0]
.m_bBankIndex)) {
- cSampleManager.SetChannelFrequency(
+ SampleManager.SetChannelFrequency(
l, v27->m_asActiveSamples[0]
.m_nFrequency);
cSampleManager
.SetChannelEmittingVolume(l,
v45);
- cSampleManager.SetChannelLoopPoints(
+ SampleManager.SetChannelLoopPoints(
l,
v27->m_asActiveSamples[0]
.m_nLoopStart,
v27->m_asActiveSamples[0]
.m_nLoopEnd);
- cSampleManager.SetChannelLoopCount(
+ SampleManager.SetChannelLoopCount(
l, v27->m_asActiveSamples[0]
.m_nLoopCount);
- cSampleManager.SetChannelReverbFlag(
+ SampleManager.SetChannelReverbFlag(
l, v27->m_asActiveSamples[0]
.m_bReverbFlag);
if(v27->m_asActiveSamples[0]
@@ -3655,7 +3655,7 @@ cAudioManager::ProcessActiveQueues()
v35 = v34;
v36 = v33;
v37 = v32;
- cSampleManager.SetChannel3DPosition(
+ SampleManager.SetChannel3DPosition(
l, v37, v36, v35);
v38 = 0.25f *
v27->m_asActiveSamples[0]
@@ -3666,7 +3666,7 @@ cAudioManager::ProcessActiveQueues()
v27->m_asActiveSamples[0]
.m_fSoundIntensity,
v38);
- cSampleManager.StartChannel(l);
+ SampleManager.StartChannel(l);
}
v27->m_asActiveSamples[0].m_bIsProcessed =
1;
@@ -3705,7 +3705,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
m_sQueueSample.field_4 = 13;
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_VEHICLE_AIR_BRAKES;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_AIR_BRAKES);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_VEHICLE_AIR_BRAKES);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
@@ -3758,7 +3758,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex =
(m_anRandomTable[1] & 3) + AUDIO_SAMPLE_AIRPORT_1;
m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_4 = counter++;
m_sQueueSample.m_bIsDistant = 0;
@@ -3814,9 +3814,9 @@ cAudioManager::ProcessBridgeMotor()
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 127;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_fSoundIntensity = 400.0f;
m_sQueueSample.field_56 = 0;
@@ -3846,13 +3846,13 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.field_16 = 1;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BRIDGE_WARNING);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BRIDGE_WARNING);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 100;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_fSoundIntensity = 450.0f;
m_sQueueSample.field_56 = 0;
@@ -3909,7 +3909,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = counter % 3 + AUDIO_SAMPLE_CINEMA_1;
m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency +=
RandomDisplacement(m_sQueueSample.m_nFrequency >> 2);
@@ -3971,7 +3971,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_DOCKS;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_DOCKS);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_DOCKS);
m_sQueueSample.m_nFrequency +=
RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
m_sQueueSample.field_4 = counter++;
@@ -4099,9 +4099,9 @@ cAudioManager::ProcessFireHydrant()
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 40;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_fSoundIntensity = 35.0f;
m_sQueueSample.field_56 = 0;
@@ -4248,7 +4248,7 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nFrequency = 48000;
} else {
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
}
m_sQueueSample.m_bVolume = 110;
m_sQueueSample.field_4 = counter++;
@@ -4316,7 +4316,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex =
m_anRandomTable[0] % 5u + AUDIO_SAMPLE_HOME_1;
m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency +=
RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
@@ -4481,7 +4481,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_1;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_1);
m_sQueueSample.field_4 = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_nLoopCount = 0;
@@ -4490,9 +4490,9 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_bEmittingVolume = 45;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
@@ -4503,7 +4503,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_LAUNDERETTE_2;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_LAUNDERETTE_2);
m_sQueueSample.field_4 = 1;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_nLoopCount = 0;
@@ -4512,9 +4512,9 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_bEmittingVolume = 110;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
@@ -4537,7 +4537,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4549,7 +4549,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4561,7 +4561,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4573,7 +4573,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4585,7 +4585,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4597,7 +4597,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_3);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4609,7 +4609,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4621,7 +4621,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_4);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4633,7 +4633,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4645,7 +4645,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_5);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4657,7 +4657,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4669,7 +4669,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_6);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4681,7 +4681,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4693,7 +4693,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_7);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4705,7 +4705,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4717,7 +4717,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_8);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4729,7 +4729,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4741,7 +4741,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_9);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4753,7 +4753,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4765,7 +4765,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_10);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4777,7 +4777,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4789,7 +4789,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_11);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4801,7 +4801,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4813,7 +4813,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_12);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4825,7 +4825,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4837,7 +4837,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_13);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4849,7 +4849,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4861,7 +4861,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_1);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4873,7 +4873,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4885,7 +4885,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_STRIP_CLUB_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4903,7 +4903,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409);
m_sQueueSample.field_16 = 6;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4915,7 +4915,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_409);
m_sQueueSample.field_16 = 6;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4929,7 +4929,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4941,7 +4941,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CHINATOWN_RESTAURANT);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4953,7 +4953,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4965,7 +4965,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_CIPRIANI_RESTAURANT);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4977,7 +4977,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -4989,7 +4989,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_414);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5001,7 +5001,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5013,7 +5013,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 110;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_MARCO_BISTRO);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5035,7 +5035,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FRANKIE_PIANO);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FRANKIE_PIANO);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5047,7 +5047,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_PARTY_1);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5067,7 +5067,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 90;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM);
m_sQueueSample.field_16 = 2;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5079,7 +5079,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 90;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_BANK_ALARM);
m_sQueueSample.field_16 = 2;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5091,7 +5091,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL);
m_sQueueSample.field_16 = 2;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5103,7 +5103,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_POLICE_BALL);
m_sQueueSample.field_16 = 2;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5115,7 +5115,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5127,7 +5127,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_INDUSTRIAL);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5144,7 +5144,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5157,7 +5157,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5169,7 +5169,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5181,7 +5181,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 127;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_RAVE_2);
m_sQueueSample.field_16 = 3;
m_sQueueSample.field_76 = 3;
m_sQueueSample.field_48 = 2.0f;
@@ -5193,7 +5193,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bBankIndex = 0;
emittingVolume = 80;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_FIRE_ENTITY);
m_sQueueSample.field_16 = 8;
m_sQueueSample.field_76 = 10;
m_sQueueSample.field_48 = 2.0f;
@@ -5214,9 +5214,9 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
}
@@ -5326,7 +5326,7 @@ cAudioManager::ProcessPornCinema(uint8 sound)
ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity,
m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_4 = 0;
m_sQueueSample.m_bIsDistant = 0;
@@ -5336,9 +5336,9 @@ cAudioManager::ProcessPornCinema(uint8 sound)
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_bEmittingVolume = maxVolume;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(
+ SampleManager.GetSampleLoopStartOffset(
m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = cSampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
@@ -5353,7 +5353,7 @@ cAudioManager::ProcessPornCinema(uint8 sound)
if(m_sQueueSample.m_bVolume) {
rand = m_anRandomTable[1] & 1;
m_sQueueSample.m_nSampleIndex = rand + sample;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency +=
RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
@@ -5405,7 +5405,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SAWMILL_1;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SAWMILL_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SAWMILL_1);
m_sQueueSample.field_4 = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_nLoopCount = 0;
@@ -5414,9 +5414,9 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
@@ -5428,7 +5428,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SAWMILL_2;
m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_4 = 1;
m_sQueueSample.m_bIsDistant = 0;
@@ -5479,7 +5479,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_SHOP_1;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SHOP_1);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_SHOP_1);
m_sQueueSample.field_4 = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_nLoopCount = 0;
@@ -5488,9 +5488,9 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
cAudioManager::AddSampleToRequestedQueue();
@@ -5503,7 +5503,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
rand = m_anRandomTable[1] & 1;
m_sQueueSample.m_nSampleIndex = rand + AUDIO_SAMPLE_SHOP_2;
m_sQueueSample.m_bBankIndex = 0;
- m_sQueueSample.m_nFrequency = cSampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_4 = rand + 1;
m_sQueueSample.m_bIsDistant = 0;
@@ -5529,8 +5529,8 @@ cAudioManager::ProcessSpecial()
if(m_bUserPause) {
if(!m_bPreviousUserPause) {
MusicManager.ChangeMusicMode(0);
- cSampleManager.SetEffectsFadeVol(maxVolume);
- cSampleManager.SetMusicFadeVol(maxVolume);
+ SampleManager.SetEffectsFadeVolume(maxVolume);
+ SampleManager.SetMusicFadeVolume(maxVolume);
}
} else {
if(m_bPreviousUserPause) {
@@ -5542,7 +5542,7 @@ cAudioManager::ProcessSpecial()
const PedState &state = playerPed->m_nPedState;
if(state != PED_ENTER_CAR && state != PED_STEAL_CAR &&
!playerPed->bInVehicle)
- cSampleManager.StopChannel(m_bActiveSamples);
+ SampleManager.StopChannel(m_bActiveSamples);
}
}
}
@@ -5595,7 +5595,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = AUDIO_SAMPLE_WORK_SHOP;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_nFrequency =
- cSampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WORK_SHOP);
+ SampleManager.GetSampleBaseFrequency(AUDIO_SAMPLE_WORK_SHOP);
m_sQueueSample.field_4 = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.m_nLoopCount = 0;
@@ -5604,9 +5604,9 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
m_sQueueSample.field_48 = 2.0;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
- cSampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- cSampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
@@ -5626,7 +5626,7 @@ InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP);
InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP);
// InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP);
InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP);
-InjectHook(0x57A8F0, &cAudioManager::AutoDetect3DProviders, PATCH_JUMP);
+InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP);
// InjectHook(0x580AF0, &cAudioManager::AgeCrimes, PATCH_JUMP);
InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP);
@@ -5660,8 +5660,8 @@ InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP);
InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP);
InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP);
-InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVol, PATCH_JUMP);
-InjectHook(0x57A790, &cAudioManager::SetMusicFadeVol, PATCH_JUMP);
+InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP);
+InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP);
InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP);
@@ -5697,7 +5697,7 @@ InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP);
InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
-InjectHook(0x57A9F0, &cAudioManager::RequireDigitalHandle, PATCH_JUMP);
+InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP);
InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 1ae50b2f..0cbd742d 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -187,6 +187,24 @@ struct cAudioScriptObject {
static_assert(sizeof(cAudioScriptObject) == 0x14, "cAudioScriptObject: error");
+enum
+{
+ /*
+ REFLECTION_YMAX = 0, top
+ REFLECTION_YMIN = 1, bottom
+ REFLECTION_XMIN = 2, left
+ REFLECTION_XMAX = 3, right
+ REFLECTION_ZMAX = 4,
+ */
+
+ REFLECTION_TOP = 0,
+ REFLECTION_BOTTOM,
+ REFLECTION_LEFT,
+ REFLECTION_RIGHT,
+ REFLECTION_UP,
+ MAX_REFLECTIONS,
+};
+
class cAudioManager
{
public:
@@ -234,7 +252,13 @@ public:
uint8 m_bUserPause;
uint8 m_bPreviousUserPause;
uint8 field_19195;
- int32 m_nTimeOfRecentCrime;
+ uint32 m_FrameCounter;
+
+ inline uint32 GetFrameCounter(void) { return m_FrameCounter; }
+ float GetReflectionsDistance(int32 idx) { return m_afReflectionsDistances[idx]; }
+ int32 GetRandomTabe(int32 idx) { return m_anRandomTable[idx]; }
+
+ //
void AddDetailsToRequestedOrderList(uint8 sample); /// ok
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
@@ -243,7 +267,7 @@ public:
void AddReleasingSounds(); // todo (difficult)
void AddSampleToRequestedQueue(); /// ok
void AgeCrimes(); // todo
- int8 AutoDetect3DProviders(); /// ok
+ int8 GetCurrent3DProviderIndex(); /// ok
void CalculateDistance(bool *ptr, float dist); /// ok
bool CheckForAnAudioFileOnCD(); /// ok
@@ -283,8 +307,8 @@ public:
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
- void SetEffectsFadeVol(uint8 volume);
- void SetMusicFadeVol(uint8 volume);
+ void SetEffectsFadeVolume(uint8 volume);
+ void SetMusicFadeVolume(uint8 volume);
void SetSpeakerConfig(int32 conf);
@@ -324,7 +348,7 @@ public:
int32 RandomDisplacement(uint32 seed);
void ReleaseDigitalHandle();
- void RequireDigitalHandle();
+ void ReacquireDigitalHandle();
void SetDynamicAcousticModelingStatus(bool status);
bool IsAudioInitialised() const;
diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h
index ba7bf7a8..7d71be54 100644
--- a/src/audio/AudioSamples.h
+++ b/src/audio/AudioSamples.h
@@ -3037,6 +3037,14 @@ enum eAudioSamples : uint32 {
AUDIO_SAMPLE_AMMUNATION_WELCOME_3 = 3031,
TOTAL_AUDIO_SAMPLES = 3032,
NO_SAMPLE = 3033,
+
+ // shorthands
+ SAMPLEBANK_START = AUDIO_SAMPLE_VEHICLE_HORN_0,
+ SAMPLEBANK_END = AUDIO_SAMPLE_PAGER,
+ SAMPLEBANK_MAX = AUDIO_SAMPLE_PAGER+1,
+ SAMPLEBANK_PED_START = AUDIO_SAMPLE_POLICE_COP_1_ARREST_1,
+ SAMPLEBANK_PED_END = AUDIO_SAMPLE_AMMUNATION_WELCOME_3,
+ SAMPLEBANK_PED_MAX = AUDIO_SAMPLE_AMMUNATION_WELCOME_3+1,
};
enum eScriptSounds : int16
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 71cc594b..0700ee63 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -8,7 +8,7 @@
#include "Camera.h"
#include "World.h"
#include "ModelIndices.h"
-#include "SampleManager.h"
+#include "sampman.h"
#include "Replay.h"
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
@@ -57,7 +57,7 @@ void cMusicManager::DisplayRadioStationName()
if (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)
pCurrentStation = nil;
- if (cSampleManager.IsMP3RadioChannelAvailable()) {
+ if (SampleManager.IsMP3RadioChannelAvailable()) {
gStreamedSound = MusicManager.m_nCurrentStreamedSound;
if (gStreamedSound != STREAMED_SOUND_CITY_AMBIENT && gStreamedSound != STREAMED_SOUND_WATER_AMBIENT) {
@@ -140,7 +140,7 @@ void cMusicManager::DisplayRadioStationName()
return;
};
- if (pRetune > CHATTERBOX && !CSampleManager::IsMP3RadioChannelAvailable()) {
+ if (pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) {
return;
}
diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h
index 6a08882f..cdea65ec 100644
--- a/src/audio/MusicManager.h
+++ b/src/audio/MusicManager.h
@@ -16,6 +16,15 @@ enum eRadioStation
RADIO_OFF,
};
+enum eMusicMode
+{
+ MUSICMODE_FRONTEND = 0,
+ MUSICMODE_GAME,
+ MUSICMODE_CUTSCENE,
+ MUSICMODE_OFF,
+ MUSICMODE_4,
+};
+
enum eStreamedSounds
{
STREAMED_SOUND_RADIO_HEAD = 0,
@@ -264,6 +273,10 @@ public:
uint8 field_2395;
public:
+ bool IsInitialised() { return m_bIsInitialised; }
+ uint32 GetMusicMode() { return m_nMusicMode; }
+ uint8 GetCurrentTrack() { return m_nCurrentStreamedSound; }
+
void Initialise();
void Terminate();
diff --git a/src/audio/SampleManager.cpp b/src/audio/SampleManager.cpp
deleted file mode 100644
index b2f0cf35..00000000
--- a/src/audio/SampleManager.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-#include "SampleManager.h"
-#include "common.h"
-#include "patcher.h"
-
-CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
-
-uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00;
-uint8 &num3DProvidersAvailable = *(uint8 *)0x734237;
-char **asName3DProviders = (char **)0x734238;
-
-bool
-CSampleManager::IsMP3RadioChannelAvailable()
-{
- return nNumOfMp3Files != 0;
-}
-
-WRAPPER
-void CSampleManager::SetChannelFrequency(int32, int32) { EAXJMP(0x5679D0); }
-
-WRAPPER
-void CSampleManager::SetChannelEmittingVolume(int32, uint32) { EAXJMP(0x567820); }
-
-WRAPPER
-void
-CSampleManager::SetChannel3DPosition(int32, float, float, float)
-{
- EAXJMP(0x567890);
-}
-
-WRAPPER
-void CSampleManager::SetChannelLoopCount(int32, int32) { EAXJMP(0x567AA0); }
-
-WRAPPER
-void CSampleManager::SetChannel3DDistances(int32, int32, int32) { EAXJMP(0x5678D0); }
-
-WRAPPER
-void CSampleManager::SetChannelReverbFlag(int32, uint8) { EAXJMP(0x567630); }
-
-WRAPPER
-int32 CSampleManager::GetSampleLength(int32) { EAXJMP(0x567300); }
-
-WRAPPER
-bool CSampleManager::InitialiseChannel(int32, int32, uint32, uint32) { EAXJMP(0x5676A0); }
-
-WRAPPER
-void CSampleManager::SetChannelLoopPoints(int32, int32, int32) { EAXJMP(0x567A30); }
-
-WRAPPER
-bool
-CSampleManager::CheckForAnAudioFileOnCD()
-{
- EAXJMP(0x566EA0);
-}
-
-WRAPPER
-int32 CSampleManager::GetSampleBaseFrequency(int32) { EAXJMP(0x5672A0); }
-
-WRAPPER
-int32 CSampleManager::GetSampleLoopStartOffset(int32) { EAXJMP(0x5672C0); }
-
-WRAPPER
-int32 CSampleManager::GetSampleLoopEndOffset(int32) { EAXJMP(0x5672E0); }
-
-WRAPPER
-bool CSampleManager::IsSampleBankLoaded(uint8) { EAXJMP(0x567130); }
-
-WRAPPER
-void CSampleManager::UnloadSampleBank(uint8) { EAXJMP(0x567110); }
-
-WRAPPER
-void
-CSampleManager::Terminate()
-{
- EAXJMP(0x566DC0);
-}
-
-WRAPPER
-bool
-CSampleManager::Initialise()
-{
- EAXJMP(0x566530);
-}
-
-WRAPPER
-int32
-CSampleManager::GetActiveSamples()
-{
- EAXJMP(0x565970);
-}
-
-WRAPPER void
-CSampleManager::ReleaseDigitalHandle()
-{
- EAXJMP(0x5664B0);
-}
-
-WRAPPER
-void
-CSampleManager::RequireDigitalHandle()
-{
- EAXJMP(0x5664F0);
-}
-
-WRAPPER
-char
-CSampleManager::AutoDetect3DProviders()
-{
- EAXJMP(0x565990);
-}
-
-WRAPPER
-uint8
-CSampleManager::GetCDAudioDriveLetter()
-{
- EAXJMP(0x566F20);
-}
-
-WRAPPER
-void
-CSampleManager::SetEffectsMasterVolume(uint8 volume)
-{
- EAXJMP(0x567010);
-}
-
-WRAPPER
-void
-CSampleManager::SetMusicMasterVolume(uint8 volume)
-{
- EAXJMP(0x567020);
-}
-
-WRAPPER
-void
-CSampleManager::SetEffectsFadeVol(uint8 volume)
-{
- EAXJMP(0x567030);
-}
-
-WRAPPER
-void
-CSampleManager::SetMusicFadeVol(uint8 volume)
-{
- EAXJMP(0x567040);
-}
-
-WRAPPER
-void
-CSampleManager::SetSpeakerConfig(uint32 config)
-{
- EAXJMP(0x565900);
-}
-
-WRAPPER
-bool
-CSampleManager::GetChannelUsedFlag(int32 id)
-{
- EAXJMP(0x567B00);
-}
-
-WRAPPER
-void
-CSampleManager::StartChannel(int32 id)
-{
- EAXJMP(0x567B80);
-}
-
-WRAPPER
-void
-CSampleManager::StopChannel(int32 id)
-{
- EAXJMP(0x567BE0);
-}
-
-STARTPATCHES
-InjectHook(0x566490, CSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/audio/SampleManager.h b/src/audio/SampleManager.h
deleted file mode 100644
index dc46e7ec..00000000
--- a/src/audio/SampleManager.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#pragma once
-
-#include "common.h"
-
-struct tSample {
- int m_nOffset;
- unsigned int m_nSize;
- int m_nFrequency;
- int m_nLoopStart;
- int m_nLoopEnd;
-};
-
-class CSampleManager
-{
-public:
- void SetChannelFrequency(int32, int32);
- void SetChannelEmittingVolume(int32, uint32);
- void SetChannel3DPosition(int32, float, float, float);
- void SetChannelLoopCount(int32, int32);
-
- void SetChannel3DDistances(int32, int32, int32);
- void SetChannelReverbFlag(int32, uint8);
-
- int32 GetSampleLength(int32);
-
- bool InitialiseChannel(int32, int32, uint32, uint32 something = 0);
-
- void SetChannelLoopPoints(int32, int32, int32);
-
- bool CheckForAnAudioFileOnCD();
-
- int32 GetSampleBaseFrequency(int32);
- int32 GetSampleLoopStartOffset(int32);
- int32 GetSampleLoopEndOffset(int32);
-
- bool IsSampleBankLoaded(uint8);
- void UnloadSampleBank(uint8);
- void Terminate();
-
- bool Initialise();
- int32 GetActiveSamples();
-
- void ReleaseDigitalHandle();
- void RequireDigitalHandle();
-
- char AutoDetect3DProviders();
- uint8 GetCDAudioDriveLetter();
-
- void SetEffectsMasterVolume(uint8 volume);
- void SetMusicMasterVolume(uint8 volume);
- void SetEffectsFadeVol(uint8 volume);
- void SetMusicFadeVol(uint8 volume);
-
- void SetSpeakerConfig(uint32 config);
-
- bool GetChannelUsedFlag(int32 id);
-
- void StartChannel(int32 id);
- void StopChannel(int32 id);
-
- static bool IsMP3RadioChannelAvailable();
-};
-
-extern uint32 &nNumOfMp3Files;
-extern uint8 &num3DProvidersAvailable;
-extern char **asName3DProviders;
-
-extern CSampleManager &cSampleManager; \ No newline at end of file
diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp
new file mode 100644
index 00000000..c758fc9f
--- /dev/null
+++ b/src/audio/sampman.cpp
@@ -0,0 +1,2331 @@
+#include <windows.h>
+#include <shobjidl.h>
+#include <shlguid.h>
+
+#include <time.h>
+
+#include "eax.h"
+#include "eax-util.h"
+#include "mss.h"
+
+#include "sampman.h"
+#include "AudioManager.h"
+#include "MusicManager.h"
+#include "Frontend.h"
+#include "Timer.h"
+#include "patcher.h"
+
+#pragma comment( lib, "mss32.lib" )
+
+cSampleManager &SampleManager = *(cSampleManager *)0x7341E0;
+int32 (&BankStartOffset)[2] = *(int32 (*)[2])*(int *)0x6FAB70;
+
+///////////////////////////////////////////////////////////////
+
+char SampleBankDescFilename[] = "AUDIO\\SFX.SDT";
+char SampleBankDataFilename[] = "AUDIO\\SFX.RAW";
+
+FILE *fpSampleDescHandle;
+FILE *fpSampleDataHandle;
+bool bSampleBankLoaded [MAX_SAMPLEBANKS];
+int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS];
+int32 nSampleBankSize [MAX_SAMPLEBANKS];
+int32 nSampleBankMemoryStartAddress[MAX_SAMPLEBANKS];
+int32 _nSampleDataEndOffset;
+
+int32 nPedSlotSfx [MAX_PEDSFX];
+int32 nPedSlotSfxAddr[MAX_PEDSFX];
+int32 nCurrentPedSlot;
+
+uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
+
+uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
+
+///////////////////////////////////////////////////////////////
+struct tMP3Entry
+{
+ char aFilename[MAX_PATH];
+
+ uint32 nTrackLength;
+ uint32 nTrackStreamPos;
+
+ tMP3Entry *pNext;
+ char *pLinkPath;
+};
+
+uint32 nNumMP3s;
+tMP3Entry *_pMP3List;
+char _mp3DirectoryPath[MAX_PATH];
+HSTREAM mp3Stream [MAX_MP3STREAMS];
+int8 nStreamPan [MAX_MP3STREAMS];
+int8 nStreamVolume[MAX_MP3STREAMS];
+uint32 _CurMP3Index;
+int32 _CurMP3Pos;
+bool _bIsMp3Active;
+
+#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
+bool _bUseHDDAudio;
+char _aHDDPath[MAX_PATH];
+#endif
+///////////////////////////////////////////////////////////////
+
+
+bool _bSampmanInitialised = false;
+
+//
+// Miscellaneous globals / defines
+
+// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
+
+EAXLISTENERPROPERTIES StartEAX3 =
+ {26, 1.7f, 0.8f, -1000, -1000, -100, 4.42f, 0.14f, 1.00f, 429, 0.014f, 0.00f,0.00f,0.00f, 1023, 0.021f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2727.1f, 250.0f, 0.00f, 0x3f };
+
+EAXLISTENERPROPERTIES FinishEAX3 =
+ {26, 100.0f, 1.0f, 0, -1000, -2200, 20.0f, 1.39f, 1.00f, 1000, 0.069f, 0.00f,0.00f,0.00f, 400, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 3.982f, 0.000f, -18.0f, 3530.8f, 417.9f, 6.70f, 0x3f };
+
+EAXLISTENERPROPERTIES EAX3Params;
+
+S32 prevprovider=-1;
+S32 curprovider=-1;
+S32 usingEAX=0;
+S32 usingEAX3=0;
+HPROVIDER opened_provider=0;
+H3DSAMPLE opened_samples[MAXCHANNELS] = {0};
+HSAMPLE opened_2dsamples[MAX2DCHANNELS] = {0};
+HDIGDRIVER DIG;
+S32 speaker_type=0;
+
+U32 _maxSamples;
+float _fPrevEaxRatioDestination;
+bool _usingMilesFast2D;
+float _fEffectsLevel;
+
+
+struct
+{
+ HPROVIDER id;
+ char name[80];
+}providers[MAXPROVIDERS];
+
+typedef struct provider_stuff
+{
+ char* name;
+ HPROVIDER id;
+} provider_stuff;
+
+
+static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2)
+{
+ return( _stricmp(s1->name,s2->name) );
+}
+
+static void
+add_providers()
+{
+ provider_stuff pi[MAXPROVIDERS];
+ U32 n,i,j;
+
+ SampleManager.SetNum3DProvidersAvailable(0);
+
+ HPROENUM next = HPROENUM_FIRST;
+
+ n=0;
+ while (AIL_enumerate_3D_providers(&next, &pi[n].id, &pi[n].name) && (n<MAXPROVIDERS))
+ {
+ ++n;
+ }
+
+ qsort(pi,n,sizeof(pi[0]), (int(__cdecl*)(void const*, void const*))comp);
+
+ for(i=0;i<n;i++)
+ {
+ providers[i].id=pi[i].id;
+ strcpy(providers[i].name, pi[i].name);
+ SampleManager.Set3DProviderName(i, providers[i].name);
+ }
+
+ SampleManager.SetNum3DProvidersAvailable(n);
+
+ for(j=n;j<MAXPROVIDERS;j++)
+ SampleManager.Set3DProviderName(j, NULL);
+}
+
+static void
+release_existing()
+{
+ for ( U32 i = 0; i < _maxSamples; i++ )
+ {
+ if ( opened_samples[i] )
+ {
+ AIL_release_3D_sample_handle(opened_samples[i]);
+ opened_samples[i] = NULL;
+ }
+ }
+
+ if ( opened_provider )
+ {
+ AIL_close_3D_provider(opened_provider);
+ opened_provider = NULL;
+ }
+
+ _fPrevEaxRatioDestination = 0.0f;
+ _usingMilesFast2D = false;
+ _fEffectsLevel = 0.0f;
+}
+
+static bool
+set_new_provider(S32 index)
+{
+ DWORD result;
+
+ if ( curprovider == index )
+ return true;
+
+ //close the already opened provider
+ curprovider = index;
+
+ release_existing();
+
+ if ( curprovider != -1 )
+ {
+ if ( !strcmp(providers[index].name, "Dolby Surround") )
+ _maxSamples = MAXCHANNELS_SURROUND;
+ else
+ _maxSamples = MAXCHANNELS;
+
+ AIL_set_3D_provider_preference(providers[index].id, "Maximum supported samples", &_maxSamples);
+
+ //load the new provider
+ result = AIL_open_3D_provider(providers[index].id);
+
+ if (result != M3D_NOERR)
+ {
+ curprovider=-1;
+
+ OutputDebugStringA(AIL_last_error());
+
+ release_existing();
+
+ return false;
+ }
+ else
+ {
+ opened_provider=providers[index].id;
+
+ //see if we're running under an EAX compatible provider
+
+ if ( !strcmp(providers[index].name, "Creative Labs EAX 3 (TM)") )
+ {
+ usingEAX = 1;
+ usingEAX3 = 1;
+ }
+ else
+ {
+ usingEAX3 = 0;
+
+ result=AIL_3D_room_type(opened_provider);
+ usingEAX=(((S32)result)!=-1)?1:0; // will be something other than -1 on EAX
+ }
+
+ if ( usingEAX3 )
+ {
+ OutputDebugString("DOING SPECIAL EAX 3 STUFF!");
+ AIL_set_3D_provider_preference(opened_provider, "EAX all parameters", &FinishEAX3);
+ }
+ else if ( usingEAX )
+ {
+ AIL_set_3D_room_type(opened_provider, ENVIRONMENT_CAVE);
+
+ if ( !strcmp(providers[index].name, "Miles Fast 2D Positional Audio") )
+ _usingMilesFast2D = true;
+ }
+
+ AIL_3D_provider_attribute(opened_provider, "Maximum supported samples", &_maxSamples);
+
+ if ( _maxSamples > MAXCHANNELS )
+ _maxSamples = MAXCHANNELS;
+
+ SampleManager.SetSpeakerConfig(speaker_type);
+
+ //obtain a 3D sample handles
+ for ( U32 i = 0; i < _maxSamples; ++i )
+ {
+ opened_samples[i] = AIL_allocate_3D_sample_handle(opened_provider);
+ if ( opened_samples[i] != NULL )
+ AIL_set_3D_sample_effects_level(opened_samples[i], 0.0f);
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void
+cSampleManager::SetSpeakerConfig(int32 which)
+{
+ switch ( which )
+ {
+ case 1:
+ speaker_type=AIL_3D_2_SPEAKER;
+ break;
+
+ case 2:
+ speaker_type=AIL_3D_HEADPHONE;
+ break;
+
+ case 3:
+ speaker_type=AIL_3D_4_SPEAKER;
+ break;
+
+ default:
+ return;
+ break;
+ }
+
+ if (opened_provider)
+ AIL_set_3D_speaker_type(opened_provider, speaker_type);
+}
+
+uint32
+cSampleManager::GetMaximumSupportedChannels(void) //[Y]
+{
+ if ( _maxSamples > MAXCHANNELS )
+ return MAXCHANNELS;
+
+ return _maxSamples;
+}
+
+int8
+cSampleManager::GetCurrent3DProviderIndex(void)
+{
+ return curprovider;
+}
+
+int8
+cSampleManager::SetCurrent3DProvider(uint8 nProvider)
+{
+ S32 savedprovider = curprovider;
+
+ if ( nProvider < m_nNumberOfProviders )
+ {
+ if ( set_new_provider(nProvider) )
+ return curprovider;
+ else if ( savedprovider != -1 && savedprovider < m_nNumberOfProviders && set_new_provider(savedprovider) )
+ return curprovider;
+ else
+ return -1;
+ }
+ else
+ return curprovider;
+}
+
+static bool
+_ResolveLink(char const *path, char *out)
+{
+ IShellLink* psl;
+ WIN32_FIND_DATA fd;
+ char filepath[MAX_PATH];
+
+ CoInitialize(NULL);
+
+ if (SUCCEEDED( CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl ) ))
+ {
+ IPersistFile *ppf;
+
+ if (SUCCEEDED(psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf)))
+ {
+ WCHAR wpath[MAX_PATH];
+
+ MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
+
+ if (SUCCEEDED(ppf->Load(wpath, STGM_READ)))
+ {
+ /* Resolve the link */
+ if (SUCCEEDED(psl->Resolve(NULL, SLR_ANY_MATCH|SLR_NO_UI|SLR_NOSEARCH)))
+ {
+ strcpy(filepath, path);
+
+ if (SUCCEEDED(psl->GetPath(filepath, MAX_PATH, &fd, SLGP_UNCPRIORITY)))
+ {
+ OutputDebugString(fd.cFileName);
+
+ strcpy(out, filepath);
+
+ return true;
+ }
+ }
+ }
+
+ ppf->Release();
+ }
+ psl->Release();
+ }
+
+ return false;
+}
+
+static void
+_FindMP3s(void)
+{
+ tMP3Entry *pList;
+ bool bShortcut;
+ bool bInitFirstEntry;
+ HANDLE hFind;
+ char path[MAX_PATH];
+ char filepath[MAX_PATH*2];
+ S32 total_ms;
+ WIN32_FIND_DATA fd;
+
+
+ if ( GetCurrentDirectory(MAX_PATH, _mp3DirectoryPath) == 0 )
+ {
+ GetLastError();
+ return;
+ }
+
+ OutputDebugString("Finding MP3s...");
+ strcpy(path, _mp3DirectoryPath);
+ strcat(path, "\\MP3\\");
+
+ strcpy(_mp3DirectoryPath, path);
+ OutputDebugString(_mp3DirectoryPath);
+
+ strcat(path, "*");
+
+ hFind = FindFirstFile(path, &fd);
+
+ if ( hFind == INVALID_HANDLE_VALUE )
+ {
+ GetLastError();
+ return;
+ }
+
+ strcpy(filepath, _mp3DirectoryPath);
+ strcat(filepath, fd.cFileName);
+
+ int32 filepathlen = strlen(filepath);
+
+ if ( filepathlen <= 0)
+ {
+ FindClose(hFind);
+ return;
+ }
+
+ FILE *f = fopen("MP3\\MP3Report.txt", "w");
+
+ if ( f )
+ {
+ fprintf(f, "MP3 Report File\n\n");
+ fprintf(f, "\"%s\"", fd.cFileName);
+ }
+
+
+ if ( filepathlen > 4 )
+ {
+ if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
+ {
+ if ( _ResolveLink(filepath, filepath) )
+ {
+ OutputDebugString("Resolving Link");
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - shortcut to \"%s\"", filepath);
+ }
+ else
+ {
+ if ( f )
+ fprintf(f, " - couldn't resolve shortcut");
+ }
+
+ bShortcut = true;
+ }
+ else
+ {
+ bShortcut = false;
+ }
+ }
+
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+ if ( mp3Stream[0] )
+ {
+ AIL_stream_ms_position(mp3Stream[0], &total_ms, NULL);
+
+ AIL_close_stream(mp3Stream[0]);
+ mp3Stream[0] = NULL;
+
+ OutputDebugString(fd.cFileName);
+
+ _pMP3List = new tMP3Entry;
+
+ if ( _pMP3List == NULL )
+ {
+ FindClose(hFind);
+
+ if ( f )
+ fclose(f);
+
+ return;
+ }
+
+ nNumMP3s = 1;
+
+ strcpy(_pMP3List->aFilename, fd.cFileName);
+
+ _pMP3List->nTrackLength = total_ms;
+
+ _pMP3List->pNext = NULL;
+
+ pList = _pMP3List;
+
+ if ( bShortcut )
+ {
+ _pMP3List->pLinkPath = new char[MAX_PATH*2];
+ strcpy(_pMP3List->pLinkPath, filepath);
+ }
+ else
+ {
+ _pMP3List->pLinkPath = NULL;
+ }
+
+ if ( f )
+ fprintf(f, " - OK\n");
+
+ bInitFirstEntry = false;
+ }
+ else
+ {
+ strcat(filepath, " - NOT A VALID MP3");
+
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - not an MP3 or supported MP3 type\n");
+
+ bInitFirstEntry = true;
+ }
+
+ while ( true )
+ {
+ if ( !FindNextFile(hFind, &fd) )
+ {
+ if ( f )
+ {
+ fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
+ fclose(f);
+ }
+
+ FindClose(hFind);
+
+ return;
+ }
+
+ if ( bInitFirstEntry )
+ {
+ strcpy(filepath, _mp3DirectoryPath);
+ strcat(filepath, fd.cFileName);
+
+ int32 filepathlen = strlen(filepath);
+
+ if ( f )
+ fprintf(f, "\"%s\"", fd.cFileName);
+
+ if ( filepathlen > 0 )
+ {
+ if ( filepathlen > 4 )
+ {
+ if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
+ {
+ if ( _ResolveLink(filepath, filepath) )
+ {
+ OutputDebugString("Resolving Link");
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - shortcut to \"%s\"", filepath);
+ }
+ else
+ {
+ if ( f )
+ fprintf(f, " - couldn't resolve shortcut");
+ }
+
+ bShortcut = true;
+ }
+ else
+ {
+ bShortcut = false;
+
+ if ( filepathlen > MAX_PATH )
+ {
+ if ( f )
+ fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
+
+ continue;
+ }
+ }
+ }
+
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+ if ( mp3Stream[0] )
+ {
+ AIL_stream_ms_position(mp3Stream[0], &total_ms, NULL);
+
+ AIL_close_stream(mp3Stream[0]);
+ mp3Stream[0] = NULL;
+
+ OutputDebugString(fd.cFileName);
+
+ _pMP3List = new tMP3Entry;
+
+ if ( _pMP3List == NULL)
+ {
+ if ( f )
+ {
+ fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
+ fclose(f);
+ }
+ FindClose(hFind);
+ return;
+ }
+
+ nNumMP3s = 1;
+
+ strcpy(_pMP3List->aFilename, fd.cFileName);
+
+ _pMP3List->nTrackLength = total_ms;
+ _pMP3List->pNext = NULL;
+
+ if ( bShortcut )
+ {
+ _pMP3List->pLinkPath = new char [MAX_PATH*2];
+ strcpy(_pMP3List->pLinkPath, filepath);
+ }
+ else
+ {
+ _pMP3List->pLinkPath = NULL;
+ }
+
+ pList = _pMP3List;
+
+ if ( f )
+ fprintf(f, " - OK\n");
+
+ bInitFirstEntry = false;
+ }
+ else
+ {
+ strcat(filepath, " - NOT A VALID MP3");
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - not an MP3 or supported MP3 type\n");
+ }
+ }
+ }
+ else
+ {
+ strcpy(filepath, _mp3DirectoryPath);
+ strcat(filepath, fd.cFileName);
+
+ int32 filepathlen = strlen(filepath);
+
+ if ( filepathlen > 0 )
+ {
+ if ( f )
+ fprintf(f, "\"%s\"", fd.cFileName);
+
+ if ( filepathlen > 4 )
+ {
+ if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
+ {
+ if ( _ResolveLink(filepath, filepath) )
+ {
+ OutputDebugString("Resolving Link");
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - shortcut to \"%s\"", filepath);
+ }
+ else
+ {
+ if ( f )
+ fprintf(f, " - couldn't resolve shortcut");
+ }
+
+ bShortcut = true;
+ }
+ else
+ {
+ bShortcut = false;
+ }
+ }
+
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+ if ( mp3Stream[0] )
+ {
+ AIL_stream_ms_position(mp3Stream[0], &total_ms, NULL);
+
+ AIL_close_stream(mp3Stream[0]);
+ mp3Stream[0] = NULL;
+
+ pList->pNext = new tMP3Entry;
+
+ tMP3Entry *e = pList->pNext;
+
+ if ( e == NULL)
+ {
+ if ( f )
+ {
+ fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
+ fclose(f);
+ }
+ FindClose(hFind);
+ return;
+ }
+
+ pList = pList->pNext;
+
+ strcpy(e->aFilename, fd.cFileName);
+ e->nTrackLength = total_ms;
+ e->pNext = NULL;
+
+ if ( bShortcut )
+ {
+ e->pLinkPath = new char [MAX_PATH*2];
+ strcpy(e->pLinkPath, filepath);
+ }
+ else
+ {
+ e->pLinkPath = NULL;
+ }
+
+ nNumMP3s++;
+
+ OutputDebugString(fd.cFileName);
+
+ if ( f )
+ fprintf(f, " - OK\n");
+ }
+ else
+ {
+ strcat(filepath, " - NOT A VALID MP3");
+ OutputDebugString(filepath);
+
+ if ( f )
+ fprintf(f, " - not an MP3 or supported MP3 type\n");
+ }
+ }
+ }
+ }
+}
+
+static void
+_DeleteMP3Entries(void)
+{
+ tMP3Entry *e = _pMP3List;
+
+ while ( e != NULL )
+ {
+ tMP3Entry *next = e->pNext;
+
+ if ( next == NULL )
+ next = NULL;
+
+ if ( e->pLinkPath != NULL )
+ {
+#ifndef FIX_BUGS
+ delete e->pLinkPath; // BUG: should be delete []
+#else
+ delete[] e->pLinkPath;
+#endif
+ e->pLinkPath = NULL;
+ }
+
+ delete e;
+
+ if ( next )
+ e = next;
+ else
+ e = NULL;
+
+ nNumMP3s--;
+ }
+
+
+ if ( nNumMP3s != 0 )
+ {
+ OutputDebugString("Not all MP3 entries were deleted");
+ nNumMP3s = 0;
+ }
+
+ _pMP3List = NULL;
+}
+
+static tMP3Entry *
+_GetMP3EntryByIndex(uint32 idx)
+{
+ uint32 n = ( idx < nNumMP3s ) ? idx : 0;
+
+ if ( _pMP3List != NULL )
+ {
+ tMP3Entry *e = _pMP3List;
+
+ for ( uint32 i = 0; i < n; i++ )
+ e = e->pNext;
+
+ return e;
+
+ }
+
+ return NULL;
+}
+
+static inline bool
+_GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry)
+{
+ _CurMP3Index = 0;
+
+ for ( *pEntry = _pMP3List; *pEntry != NULL; *pEntry = (*pEntry)->pNext )
+ {
+ if ( *pPosition >= (*pEntry)->nTrackStreamPos
+ && *pPosition < (*pEntry)->nTrackLength + (*pEntry)->nTrackStreamPos )
+ {
+ *pPosition -= (*pEntry)->nTrackStreamPos;
+ _CurMP3Pos = *pPosition;
+
+ return true;
+ }
+
+ _CurMP3Index++;
+ }
+
+ *pPosition = 0;
+ *pEntry = _pMP3List;
+ _CurMP3Pos = 0;
+ _CurMP3Index = 0;
+
+ return false;
+}
+
+bool
+cSampleManager::IsMP3RadioChannelAvailable(void)
+{
+ return nNumMP3s != 0;
+}
+
+void
+cSampleManager::ReleaseDigitalHandle(void)
+{
+ if ( DIG )
+ {
+ prevprovider = curprovider;
+ release_existing();
+ curprovider = -1;
+ AIL_digital_handle_release(DIG);
+ }
+}
+
+void
+cSampleManager::ReacquireDigitalHandle(void)
+{
+ if ( DIG )
+ {
+ AIL_digital_handle_reacquire(DIG);
+ if ( prevprovider != -1 )
+ set_new_provider(prevprovider);
+ }
+}
+
+bool
+cSampleManager::Initialise(void)
+{
+ TRACE("start");
+
+ if ( _bSampmanInitialised )
+ return true;
+
+ {
+ for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
+ {
+ m_aSamples[i].nOffset = 0;
+ m_aSamples[i].nSize = 0;
+ m_aSamples[i].nFrequency = 22050;
+ m_aSamples[i].nLoopStart = 0;
+ m_aSamples[i].nLoopEnd = -1;
+ }
+
+ m_nEffectsVolume = 127;
+ m_nMusicVolume = 127;
+ m_nEffectsFadeVolume = 127;
+ m_nMusicFadeVolume = 127;
+
+ m_nMonoMode = 0;
+ }
+
+ // miles
+ TRACE("MILES");
+ {
+ curprovider = -1;
+ prevprovider = -1;
+
+ _usingMilesFast2D = false;
+ usingEAX=0;
+ usingEAX3=0;
+
+ _fEffectsLevel = 0.0f;
+
+ _maxSamples = 0;
+
+ opened_provider = NULL;
+ DIG = NULL;
+
+ for ( int32 i = 0; i < MAXCHANNELS; i++ )
+ opened_samples[i] = NULL;
+ }
+
+ // banks
+ TRACE("banks");
+ {
+ fpSampleDescHandle = NULL;
+ fpSampleDataHandle = NULL;
+
+ _nSampleDataEndOffset = 0;
+
+ for ( int32 i = 0; i < MAX_SAMPLEBANKS; i++ )
+ {
+ bSampleBankLoaded[i] = false;
+ nSampleBankDiscStartOffset[i] = 0;
+ nSampleBankSize[i] = 0;
+ nSampleBankMemoryStartAddress[i] = 0;
+ }
+ }
+
+ // pedsfx
+ TRACE("pedsfx");
+ {
+ for ( int32 i = 0; i < MAX_PEDSFX; i++ )
+ {
+ nPedSlotSfx[i] = NO_SAMPLE;
+ nPedSlotSfxAddr[i] = 0;
+ }
+
+ nCurrentPedSlot = 0;
+ }
+
+ // channel volume
+ TRACE("vol");
+ {
+ for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
+ nChannelVolume[i] = 0;
+ }
+
+ TRACE("mss");
+ {
+ AIL_set_redist_directory( "mss" );
+
+ AIL_startup();
+
+ AIL_set_preference(DIG_MIXER_CHANNELS, MAX_DIGITAL_MIXER_CHANNELS);
+
+ DIG = AIL_open_digital_driver(DIGITALRATE, DIGITALBITS, DIGITALCHANNELS, 0);
+ if ( DIG == NULL )
+ {
+ OutputDebugString(AIL_last_error());
+ Terminate();
+ return false;
+ }
+
+ add_providers();
+
+ if ( !InitialiseSampleBanks() )
+ {
+ Terminate();
+ return false;
+ }
+
+ nSampleBankMemoryStartAddress[0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[0]);
+ if ( !nSampleBankMemoryStartAddress[0] )
+ {
+ Terminate();
+ return false;
+ }
+
+ nSampleBankMemoryStartAddress[1] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
+
+ }
+
+ TRACE("cdrom");
+
+ S32 tatalms;
+ char filepath[MAX_PATH];
+
+ {
+ m_bInitialised = false;
+
+ while (true)
+ {
+ int32 drive = 'C';
+
+ do
+ {
+ char latter[2];
+
+ latter[0] = drive;
+ latter[1] = '\0';
+
+ strcpy(m_szCDRomRootPath, latter);
+ strcat(m_szCDRomRootPath, ":\\");
+
+ if ( GetDriveType(m_szCDRomRootPath) == DRIVE_CDROM )
+ {
+ strcpy(filepath, m_szCDRomRootPath);
+ strcat(filepath, StreamedNameTable[0]);
+
+ FILE *f = fopen(filepath, "rb");
+
+ if ( f )
+ {
+ fclose(f);
+
+ bool bFileNotFound = false;
+
+ for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
+ {
+ strcpy(filepath, m_szCDRomRootPath);
+ strcat(filepath, StreamedNameTable[i]);
+
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+
+ if ( mp3Stream[0] )
+ {
+ AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
+
+ AIL_close_stream(mp3Stream[0]);
+ mp3Stream[0] = NULL;
+
+ nStreamLength[i] = tatalms;
+ }
+ else
+ {
+ bFileNotFound = true;
+ break;
+ }
+ }
+
+ if ( !bFileNotFound )
+ {
+ m_bInitialised = true;
+ break;
+ }
+ else
+ {
+ m_bInitialised = false;
+ continue;
+ }
+ }
+ }
+
+ } while ( ++drive <= 'Z' );
+
+ if ( !m_bInitialised )
+ {
+#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
+ FrontEndMenuManager.WaitForUserCD();
+ if ( FrontEndMenuManager.m_bQuitGameNoCD )
+ {
+ Terminate();
+ return false;
+ }
+ continue;
+#else
+ m_bInitialised = true;
+#endif
+ }
+
+ break;
+ }
+ }
+
+#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
+ // hddaudio
+ /**
+ Option for user to play audio files directly from hard disk.
+ Copy the contents of the PLAY discs Audio directory into your installed Grand Theft Auto III Audio directory.
+ Grand Theft Auto III still requires the presence of the PLAY disc when started.
+ This may give better performance on some machines (though worse on others).
+ **/
+ TRACE("hddaudio 1.1 patch");
+ {
+ int32 streamLength[TOTAL_STREAMED_SOUNDS];
+
+ bool bFileNotFound = false;
+ char rootpath[MAX_PATH];
+
+ strcpy(_aHDDPath, m_szCDRomRootPath);
+ rootpath[0] = '\0';
+
+ FILE *f = fopen(StreamedNameTable[0], "rb");
+
+ if ( f )
+ {
+ fclose(f);
+
+ for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
+ {
+ strcpy(filepath, rootpath);
+ strcat(filepath, StreamedNameTable[i]);
+
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+
+ if ( mp3Stream[0] )
+ {
+ AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
+
+ AIL_close_stream(mp3Stream[0]);
+ mp3Stream[0] = NULL;
+
+ streamLength[i] = tatalms;
+ }
+ else
+ {
+ bFileNotFound = true;
+ break;
+ }
+ }
+
+ }
+ else
+ bFileNotFound = true;
+
+ if ( !bFileNotFound )
+ {
+ strcpy(m_szCDRomRootPath, rootpath);
+
+ for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
+ nStreamLength[i] = streamLength[i];
+
+ _bUseHDDAudio = true;
+ }
+ else
+ _bUseHDDAudio = false;
+ }
+#endif
+
+ TRACE("stream");
+ {
+ for ( int32 i = 0; i < MAX_MP3STREAMS; i++ )
+ {
+ mp3Stream [i] = NULL;
+ nStreamPan [i] = 63;
+ nStreamVolume[i] = 100;
+ }
+ }
+
+ for ( int32 i = 0; i < MAX2DCHANNELS; i++ )
+ {
+ opened_2dsamples[i] = AIL_allocate_sample_handle(DIG);
+ if ( opened_2dsamples[i] )
+ {
+ AIL_init_sample(opened_2dsamples[i]);
+ AIL_set_sample_type(opened_2dsamples[i], DIG_F_MONO_16, DIG_PCM_SIGN);
+ }
+ }
+
+ TRACE("providerset");
+ {
+ _bSampmanInitialised = true;
+
+ U32 n = 0;
+
+ while ( n < m_nNumberOfProviders )
+ {
+ if ( !strcmp(providers[n].name, "Miles Fast 2D Positional Audio") )
+ {
+ set_new_provider(n);
+ break;
+ }
+ n++;
+ }
+
+ if ( n == m_nNumberOfProviders )
+ {
+ Terminate();
+ return false;
+ }
+ }
+
+ TRACE("bank");
+
+ LoadSampleBank(0);
+
+ // mp3
+ TRACE("mp3");
+ {
+ nNumMP3s = 0;
+
+ _pMP3List = NULL;
+
+ _FindMP3s();
+
+ if ( nNumMP3s != 0 )
+ {
+ nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] = 0;
+
+ for ( tMP3Entry *e = _pMP3List; e != NULL; e = e->pNext )
+ {
+ e->nTrackStreamPos = nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER];
+ nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] += e->nTrackLength;
+ }
+
+ time_t t = time(NULL);
+ tm *localtm;
+ bool bUseRandomTable;
+
+ if ( t == -1 )
+ bUseRandomTable = true;
+ else
+ {
+ bUseRandomTable = 0;
+ localtm = localtime(&t);
+ }
+
+ int32 randval;
+ if ( bUseRandomTable )
+ randval = AudioManager.GetRandomTabe(1);
+ else
+ randval = localtm->tm_sec * localtm->tm_min;
+
+ _CurMP3Index = randval % nNumMP3s;
+
+ tMP3Entry *randmp3 = _pMP3List;
+ for ( int32 i = randval % nNumMP3s; i > 0; --i)
+ randmp3 = randmp3->pNext;
+
+ if ( bUseRandomTable )
+ _CurMP3Pos = AudioManager.GetRandomTabe(0) % randmp3->nTrackLength;
+ else
+ {
+ if ( localtm->tm_sec > 0 )
+ {
+ int32 s = localtm->tm_sec;
+ _CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength;
+ }
+ else
+ _CurMP3Pos = AudioManager.GetRandomTabe(0) % randmp3->nTrackLength;
+ }
+ }
+ else
+ _CurMP3Pos = 0;
+
+ _bIsMp3Active = false;
+ }
+
+ TRACE("end");
+
+ return true;
+}
+
+void
+cSampleManager::Terminate(void)
+{
+ for ( int32 i = 0; i < MAX_MP3STREAMS; i++ )
+ {
+ if ( mp3Stream[i] )
+ {
+ AIL_pause_stream(mp3Stream[i], 1);
+ AIL_close_stream(mp3Stream[i]);
+ mp3Stream[i] = NULL;
+ }
+ }
+
+ for ( int32 i = 0; i < MAX2DCHANNELS; i++ )
+ {
+ if ( opened_2dsamples[i] )
+ {
+ AIL_release_sample_handle(opened_2dsamples[i]);
+ opened_2dsamples[i] = NULL;
+ }
+ }
+
+ release_existing();
+
+ _DeleteMP3Entries();
+
+ if ( nSampleBankMemoryStartAddress[0] != 0 )
+ {
+ AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[0]);
+ nSampleBankMemoryStartAddress[0] = 0;
+ }
+
+ if ( nSampleBankMemoryStartAddress[1] != 0 )
+ {
+ AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[1]);
+ nSampleBankMemoryStartAddress[1] = 0;
+ }
+
+ if ( DIG )
+ {
+ AIL_close_digital_driver(DIG);
+ DIG = NULL;
+ }
+
+ AIL_shutdown();
+
+ _bSampmanInitialised = false;
+}
+
+bool
+cSampleManager::CheckForAnAudioFileOnCD(void)
+{
+ char filepath[MAX_PATH];
+
+#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
+
+#if defined(GTA3_1_1_PATCH)
+ if (_bUseHDDAudio)
+ strcpy(filepath, _aHDDPath);
+ else
+ strcpy(filepath, m_szCDRomRootPath);
+#else
+ strcpy(filepath, m_szCDRomRootPath);
+#endif // #if defined(GTA3_1_1_PATCH)
+
+ strcat(filepath, StreamedNameTable[AudioManager.GetRandomTabe(1) % TOTAL_STREAMED_SOUNDS]);
+
+ FILE *f = fopen(filepath, "rb");
+
+ if ( f )
+ {
+ fclose(f);
+
+ return true;
+ }
+
+ return false;
+
+#else
+ return true;
+#endif // #if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
+}
+
+char
+cSampleManager::GetCDAudioDriveLetter(void)
+{
+#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
+ if (_bUseHDDAudio)
+ {
+ if ( strlen(_aHDDPath) != 0 )
+ return _aHDDPath[0];
+ else
+ return '\0';
+ }
+ else
+ {
+ if ( strlen(m_szCDRomRootPath) != 0 )
+ return m_szCDRomRootPath[0];
+ else
+ return '\0';
+ }
+#else
+ if ( strlen(m_szCDRomRootPath) != 0 )
+ return m_szCDRomRootPath[0];
+ else
+ return '\0';
+#endif
+}
+
+void
+cSampleManager::UpdateEffectsVolume(void) //[Y], cSampleManager::UpdateSoundBuffers ?
+{
+ if ( _bSampmanInitialised )
+ {
+ for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
+ {
+ if ( i < MAXCHANNELS )
+ {
+ if ( opened_samples[i] && GetChannelUsedFlag(i) )
+ {
+ if ( nChannelVolume[i] )
+ {
+ AIL_set_3D_sample_volume(opened_samples[i],
+ m_nEffectsFadeVolume * nChannelVolume[i] * m_nEffectsVolume >> 14);
+ }
+ }
+ }
+ else
+ {
+ if ( opened_2dsamples[i - MAXCHANNELS] )
+ {
+ if ( GetChannelUsedFlag(i - MAXCHANNELS) )
+ {
+ if ( nChannelVolume[i - MAXCHANNELS] )
+ {
+ AIL_set_sample_volume(opened_2dsamples[i - MAXCHANNELS],
+ m_nEffectsFadeVolume * nChannelVolume[i - MAXCHANNELS] * m_nEffectsVolume >> 14);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void
+cSampleManager::SetEffectsMasterVolume(uint8 nVolume)
+{
+ m_nEffectsVolume = nVolume;
+ UpdateEffectsVolume();
+}
+
+void
+cSampleManager::SetMusicMasterVolume(uint8 nVolume)
+{
+ m_nMusicVolume = nVolume;
+}
+
+void
+cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
+{
+ m_nEffectsFadeVolume = nVolume;
+ UpdateEffectsVolume();
+}
+
+void
+cSampleManager::SetMusicFadeVolume(uint8 nVolume)
+{
+ m_nMusicFadeVolume = nVolume;
+}
+
+bool
+cSampleManager::LoadSampleBank(uint8 nBank)
+{
+ if ( CTimer::GetIsCodePaused() )
+ return false;
+
+ if ( MusicManager.IsInitialised()
+ && MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
+ && nBank != 0 )
+ {
+ return false;
+ }
+
+ if ( fseek(fpSampleDataHandle, nSampleBankDiscStartOffset[nBank], SEEK_SET) != 0 )
+ return false;
+
+ if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank],fpSampleDataHandle) != nSampleBankSize[nBank] )
+ return false;
+
+ bSampleBankLoaded[nBank] = true;
+
+ return true;
+}
+
+void
+cSampleManager::UnloadSampleBank(uint8 nBank)
+{
+ bSampleBankLoaded[nBank] = false;
+}
+
+bool
+cSampleManager::IsSampleBankLoaded(uint8 nBank)
+{
+ return bSampleBankLoaded[nBank];
+}
+
+bool
+cSampleManager::IsPedCommentLoaded(uint32 nComment)
+{
+ int32 slot;
+
+ for ( int32 i = 0; i < _TODOCONST(3); i++ )
+ {
+ slot = nCurrentPedSlot - i - 1;
+ if ( nComment == nPedSlotSfx[slot] )
+ return true;
+ }
+
+ return false;
+}
+
+int32
+cSampleManager::_GetPedCommentSlot(uint32 nComment)
+{
+ int32 slot;
+
+ for ( int32 i = 0; i < _TODOCONST(3); i++ )
+ {
+ slot = nCurrentPedSlot - i - 1;
+ if ( nComment == nPedSlotSfx[slot] )
+ return slot;
+ }
+
+ return -1;
+}
+
+bool
+cSampleManager::LoadPedComment(uint32 nComment)
+{
+ if ( CTimer::GetIsCodePaused() )
+ return false;
+
+ // no talking peds during cutsenes or the game end
+ if ( MusicManager.IsInitialised() )
+ {
+ switch ( MusicManager.GetMusicMode() )
+ {
+ case MUSICMODE_CUTSCENE:
+ {
+ return false;
+
+ break;
+ }
+
+ case MUSICMODE_FRONTEND:
+ {
+ if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_GAME_COMPLETED )
+ return false;
+
+ break;
+ }
+ }
+ }
+
+ if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
+ return false;
+
+ if ( fread((void *)(nSampleBankMemoryStartAddress[1] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
+ return false;
+
+ nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[1] + PED_BLOCKSIZE*nCurrentPedSlot;
+ nPedSlotSfx [nCurrentPedSlot] = nComment;
+
+ if ( ++nCurrentPedSlot >= MAX_PEDSFX )
+ nCurrentPedSlot = 0;
+
+ return true;
+}
+
+int32
+cSampleManager::GetSampleBaseFrequency(uint32 nSample)
+{
+ return m_aSamples[nSample].nFrequency;
+}
+
+int32
+cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
+{
+ return m_aSamples[nSample].nLoopStart;
+}
+
+int32
+cSampleManager::GetSampleLoopEndOffset(uint32 nSample)
+{
+ return m_aSamples[nSample].nLoopEnd;
+}
+
+uint32
+cSampleManager::GetSampleLength(uint32 nSample)
+{
+ return m_aSamples[nSample].nSize >> 1;
+}
+
+bool
+cSampleManager::UpdateReverb(void)
+{
+ if ( !usingEAX )
+ return false;
+
+ if ( AudioManager.GetFrameCounter() & 15 )
+ return false;
+
+ float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM);
+ float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT);
+ float z = AudioManager.GetReflectionsDistance(REFLECTION_UP);
+
+ float normy = norm(y, 5.0f, 40.0f);
+ float normx = norm(x, 5.0f, 40.0f);
+ float normz = norm(z, 5.0f, 40.0f);
+
+ float fRatio;
+
+ if ( normy == 0.0f )
+ {
+ if ( normx == 0.0f )
+ {
+ if ( normz == 0.0f )
+ fRatio = 0.3f;
+ else
+ fRatio = 0.5f;
+ }
+ else
+ {
+ fRatio = 0.3f;
+ }
+ }
+ else
+ {
+ if ( normx == 0.0f )
+ {
+ if ( normz == 0.0f )
+ fRatio = 0.3f;
+ else
+ fRatio = 0.5f;
+ }
+ else
+ {
+ if ( normz == 0.0f )
+ fRatio = 0.3f;
+ else
+ fRatio = (normy+normx+normz) / 3.0f;
+ }
+ }
+
+ fRatio = clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
+
+ if ( fRatio == _fPrevEaxRatioDestination )
+ return false;
+
+ if ( usingEAX3 )
+ {
+ if ( EAX3ListenerInterpolate(&StartEAX3, &FinishEAX3, fRatio, &EAX3Params, false) )
+ {
+ AIL_set_3D_provider_preference(opened_provider, "EAX all parameters", &EAX3Params);
+ _fEffectsLevel = 1.0f - fRatio * 0.5f;
+ }
+ }
+ else
+ {
+ if ( _usingMilesFast2D )
+ _fEffectsLevel = (1.0f - fRatio) * 0.4f;
+ else
+ _fEffectsLevel = (1.0f - fRatio) * 0.7f;
+ }
+
+ _fPrevEaxRatioDestination = fRatio;
+
+ return true;
+}
+
+void
+cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( usingEAX )
+ {
+ if ( nReverbFlag != 0 )
+ {
+ if ( !b2d )
+ AIL_set_3D_sample_effects_level(opened_samples[nChannel], _fEffectsLevel);
+ }
+ else
+ {
+ if ( !b2d )
+ AIL_set_3D_sample_effects_level(opened_samples[nChannel], 0.0f);
+ }
+ }
+}
+
+bool
+cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ int32 addr;
+
+ if ( nSfx < SAMPLEBANK_MAX )
+ {
+ if ( !IsSampleBankLoaded(nBank) )
+ return false;
+
+ addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
+ }
+ else
+ {
+ if ( !IsPedCommentLoaded(nSfx) )
+ return false;
+
+ int32 slot = _GetPedCommentSlot(nSfx);
+
+ addr = nPedSlotSfxAddr[slot];
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ {
+ AIL_set_sample_address(opened_2dsamples[nChannel - MAXCHANNELS], (void *)addr, m_aSamples[nSfx].nSize);
+ return true;
+ }
+ else
+ return false;
+ }
+ else
+ {
+ AILSOUNDINFO info;
+
+ info.format = WAVE_FORMAT_PCM;
+ info.data_ptr = (void *)addr;
+ info.channels = 1;
+ info.data_len = m_aSamples[nSfx].nSize;
+ info.rate = m_aSamples[nSfx].nFrequency;
+ info.bits = 16;
+
+ if ( AIL_set_3D_sample_info(opened_samples[nChannel], &info) == 0 )
+ {
+ OutputDebugString(AIL_last_error());
+ return false;
+ }
+
+ return true;
+ }
+}
+
+void
+cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
+{
+ uint32 vol = nVolume;
+ if ( vol > 127 ) vol = 127;
+
+ nChannelVolume[nChannel] = vol;
+
+ // increase the volume for JB.MP3 and S4_BDBD.MP3
+ if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
+ {
+ nChannelVolume[nChannel] >>= 2;
+ }
+
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_sample_volume(opened_samples[nChannel], m_nEffectsFadeVolume*nChannelVolume[nChannel]*m_nEffectsVolume >> 14);
+
+}
+
+void
+cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
+{
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_position(opened_samples[nChannel], -fX, fY, fZ);
+}
+
+void
+cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
+{
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_sample_distances(opened_samples[nChannel], fMax, fMin);
+}
+
+void
+cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
+{
+ uint32 vol = nVolume;
+ if ( vol > 127 ) vol = 127;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ nChannelVolume[nChannel] = vol;
+
+ // increase the volume for JB.MP3 and S4_BDBD.MP3
+ if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
+ {
+ nChannelVolume[nChannel] >>= 2;
+ }
+
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ {
+ AIL_set_sample_volume(opened_2dsamples[nChannel - MAXCHANNELS],
+ m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
+ }
+
+ break;
+ }
+ }
+}
+
+void
+cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
+{
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+#ifndef FIX_BUGS
+ if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
+#else
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+#endif
+ AIL_set_sample_pan(opened_2dsamples[nChannel - MAXCHANNELS], nPan);
+
+ break;
+ }
+ }
+}
+
+void
+cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ AIL_set_sample_playback_rate(opened_2dsamples[nChannel - MAXCHANNELS], nFreq);
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_sample_playback_rate(opened_samples[nChannel], nFreq);
+ }
+}
+
+void
+cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ AIL_set_sample_loop_block(opened_2dsamples[nChannel - MAXCHANNELS], nLoopStart, nLoopEnd);
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_sample_loop_block(opened_samples[nChannel], nLoopStart, nLoopEnd);
+ }
+}
+
+void
+cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ AIL_set_sample_loop_count(opened_2dsamples[nChannel - MAXCHANNELS], nLoopCount);
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ AIL_set_3D_sample_loop_count(opened_samples[nChannel], nLoopCount);
+ }
+}
+
+bool
+cSampleManager::GetChannelUsedFlag(uint32 nChannel)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ return AIL_sample_status(opened_2dsamples[nChannel - MAXCHANNELS]) == SMP_PLAYING;
+ else
+ return false;
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ return AIL_3D_sample_status(opened_samples[nChannel]) == SMP_PLAYING;
+ else
+ return false;
+ }
+
+}
+
+void
+cSampleManager::StartChannel(uint32 nChannel)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ AIL_start_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ AIL_start_3D_sample(opened_samples[nChannel]);
+ }
+}
+
+void
+cSampleManager::StopChannel(uint32 nChannel)
+{
+ bool b2d = false;
+
+ switch ( nChannel )
+ {
+ case CHANNEL2D:
+ {
+ b2d = true;
+ break;
+ }
+ }
+
+ if ( b2d )
+ {
+ if ( opened_2dsamples[nChannel - MAXCHANNELS] )
+ AIL_end_sample(opened_2dsamples[nChannel - MAXCHANNELS]);
+ }
+ else
+ {
+ if ( opened_samples[nChannel] )
+ {
+ if ( AIL_3D_sample_status(opened_samples[nChannel]) == SMP_PLAYING )
+ AIL_end_3D_sample(opened_samples[nChannel]);
+ }
+ }
+}
+
+void
+cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
+{
+ if ( m_bInitialised )
+ {
+ if ( nFile < TOTAL_STREAMED_SOUNDS )
+ {
+ if ( mp3Stream[nStream] )
+ {
+ AIL_pause_stream(mp3Stream[nStream], 1);
+ AIL_close_stream(mp3Stream[nStream]);
+ }
+
+ char filepath[MAX_PATH];
+
+ strcpy(filepath, m_szCDRomRootPath);
+ strcat(filepath, StreamedNameTable[nFile]);
+
+ mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
+
+ if ( mp3Stream[nStream] )
+ {
+ AIL_set_stream_loop_count(mp3Stream[nStream], 1);
+ AIL_service_stream(mp3Stream[nStream], 1);
+ }
+ else
+ OutputDebugString(AIL_last_error());
+ }
+ }
+}
+
+void
+cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream)
+{
+ if ( m_bInitialised )
+ {
+ if ( mp3Stream[nStream] )
+ AIL_pause_stream(mp3Stream[nStream], nPauseFlag != 0);
+ }
+}
+
+void
+cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
+{
+ if ( m_bInitialised )
+ {
+ if ( mp3Stream[nStream] )
+ AIL_start_stream(mp3Stream[nStream]);
+ }
+}
+
+bool
+cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
+{
+ uint32 position = nPos;
+ char filename[MAX_PATH];
+
+ if ( m_bInitialised && nFile < TOTAL_STREAMED_SOUNDS )
+ {
+ if ( mp3Stream[nStream] )
+ {
+ AIL_pause_stream(mp3Stream[nStream], 1);
+ AIL_close_stream(mp3Stream[nStream]);
+ }
+
+ if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
+ {
+ uint32 i = 0;
+
+ if ( !_bIsMp3Active ) goto FIND_MP3TRACK;
+
+ do
+ {
+ if ( ++_CurMP3Index >= nNumMP3s )
+ _CurMP3Index = 0;
+
+ _CurMP3Pos = 0;
+
+ tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
+
+ if ( mp3 )
+ {
+ mp3 = _pMP3List;
+ if ( mp3 == NULL )
+ {
+ _bIsMp3Active = false;
+ nFile = 0;
+ goto PLAY_STREAMEDTRACK;
+ }
+ }
+
+ if ( mp3->pLinkPath != NULL )
+ mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0);
+ else
+ {
+ strcpy(filename, _mp3DirectoryPath);
+ strcat(filename, mp3->aFilename);
+
+ mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ }
+
+ if ( mp3Stream[nStream] )
+ {
+ AIL_set_stream_loop_count(mp3Stream[nStream], 1);
+ AIL_set_stream_ms_position(mp3Stream[nStream], 0);
+ AIL_pause_stream(mp3Stream[nStream], 0);
+ return true;
+ }
+
+ goto NEXT_MP3TRACK;
+
+FIND_MP3TRACK:
+ if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
+ position = 0;
+
+ tMP3Entry *e;
+ if ( !_GetMP3PosFromStreamPos(&position, &e) )
+ {
+ if ( e == NULL )
+ {
+ nFile = 0;
+ goto PLAY_STREAMEDTRACK;
+ }
+ }
+
+ if ( e->pLinkPath != NULL )
+ mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
+ else
+ {
+ strcpy(filename, _mp3DirectoryPath);
+ strcat(filename, e->aFilename);
+
+ mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ }
+
+ if ( mp3Stream[nStream] )
+ {
+ AIL_set_stream_loop_count(mp3Stream[nStream], 1);
+ AIL_set_stream_ms_position(mp3Stream[nStream], position);
+ AIL_pause_stream(mp3Stream[nStream], 0);
+
+ _bIsMp3Active = true;
+
+ return true;
+ }
+
+NEXT_MP3TRACK:
+ _bIsMp3Active = false;
+
+ } while ( ++i < nNumMP3s );
+
+ position = 0;
+ nFile = 0;
+ goto PLAY_STREAMEDTRACK;
+ }
+
+PLAY_STREAMEDTRACK:
+ strcpy(filename, m_szCDRomRootPath);
+ strcat(filename, StreamedNameTable[nFile]);
+
+ mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ if ( mp3Stream[nStream] )
+ {
+ AIL_set_stream_loop_count(mp3Stream[nStream], 1);
+ AIL_set_stream_ms_position(mp3Stream[nStream], position);
+ AIL_pause_stream(mp3Stream[nStream], 0);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void
+cSampleManager::StopStreamedFile(uint8 nStream)
+{
+ if ( m_bInitialised )
+ {
+ if ( mp3Stream[nStream] )
+ {
+ AIL_pause_stream(mp3Stream[nStream], 1);
+
+ AIL_close_stream(mp3Stream[nStream]);
+ mp3Stream[nStream] = NULL;
+
+ if ( nStream == 0 )
+ _bIsMp3Active = false;
+ }
+ }
+}
+
+int32
+cSampleManager::GetStreamedFilePosition(uint8 nStream)
+{
+ S32 currentms;
+
+ if ( m_bInitialised )
+ {
+ if ( mp3Stream[nStream] )
+ {
+ if ( _bIsMp3Active )
+ {
+ tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
+
+ if ( mp3 != NULL )
+ {
+ AIL_stream_ms_position(mp3Stream[nStream], NULL, &currentms);
+ return currentms + mp3->nTrackStreamPos;
+ }
+ else
+ return 0;
+ }
+ else
+ {
+ AIL_stream_ms_position(mp3Stream[nStream], NULL, &currentms);
+ return currentms;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void
+cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
+{
+ uint8 vol = nVolume;
+
+ if ( m_bInitialised )
+ {
+ if ( vol > 127 ) vol = 127;
+ if ( vol > 127 ) vol = 127;
+
+ nStreamVolume[nStream] = vol;
+ nStreamPan[nStream] = nPan;
+
+ if ( mp3Stream[nStream] )
+ {
+ if ( nEffectFlag )
+ AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
+ else
+ AIL_set_stream_volume(mp3Stream[nStream], m_nMusicFadeVolume*vol*m_nMusicVolume >> 14);
+
+ AIL_set_stream_pan(mp3Stream[nStream], nPan);
+ }
+ }
+}
+
+int32
+cSampleManager::GetStreamedFileLength(uint8 nStream)
+{
+ if ( m_bInitialised )
+ return nStreamLength[nStream];
+
+ return 0;
+}
+
+bool
+cSampleManager::IsStreamPlaying(uint8 nStream)
+{
+ if ( m_bInitialised )
+ {
+ if ( mp3Stream[nStream] )
+ {
+ if ( AIL_stream_status(mp3Stream[nStream]) == SMP_PLAYING )
+ return true;
+ else
+ return false;
+ }
+ }
+
+ return false;
+}
+
+bool
+cSampleManager::InitialiseSampleBanks(void)
+{
+ int32 nBank = 0;
+
+ fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
+ if ( fpSampleDescHandle == NULL )
+ return false;
+
+ fpSampleDataHandle = fopen(SampleBankDataFilename, "rb");
+ if ( fpSampleDataHandle == NULL )
+ {
+ fclose(fpSampleDescHandle);
+ fpSampleDescHandle = NULL;
+
+ return false;
+ }
+
+ fseek(fpSampleDataHandle, 0, SEEK_END);
+ _nSampleDataEndOffset = ftell(fpSampleDataHandle);
+ rewind(fpSampleDataHandle);
+
+ fread(m_aSamples, sizeof(tSample), TOTAL_AUDIO_SAMPLES, fpSampleDescHandle);
+
+ fclose(fpSampleDescHandle);
+ fpSampleDescHandle = NULL;
+
+ for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
+ {
+ if ( BankStartOffset[nBank] == BankStartOffset[0] + i )
+ {
+ nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset;
+ nBank++;
+ }
+ }
+
+ nSampleBankSize[0] = nSampleBankDiscStartOffset[1] - nSampleBankDiscStartOffset[0];
+ nSampleBankSize[1] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[1];
+
+ return true;
+}
+
+STARTPATCHES
+ //InjectHook(0x565500, cSampleManager::cSampleManager, PATCH_JUMP);
+ //InjectHook(0x565510, cSampleManager::~cSampleManager, PATCH_JUMP);
+ InjectHook(0x565520, comp, PATCH_JUMP);
+ InjectHook(0x565540, add_providers, PATCH_JUMP);
+ InjectHook(0x565680, release_existing, PATCH_JUMP);
+ InjectHook(0x5656F0, set_new_provider, PATCH_JUMP);
+ InjectHook(0x565900, &cSampleManager::SetSpeakerConfig, PATCH_JUMP);
+ InjectHook(0x565970, &cSampleManager::GetMaximumSupportedChannels, PATCH_JUMP);
+ InjectHook(0x565990, &cSampleManager::GetCurrent3DProviderIndex, PATCH_JUMP);
+ InjectHook(0x5659A0, &cSampleManager::SetCurrent3DProvider, PATCH_JUMP);
+ InjectHook(0x565A10, _ResolveLink, PATCH_JUMP);
+ InjectHook(0x565B40, _FindMP3s, PATCH_JUMP);
+ InjectHook(0x566380, _DeleteMP3Entries, PATCH_JUMP);
+ InjectHook(0x566400, _GetMP3EntryByIndex, PATCH_JUMP);
+ InjectHook(0x566490, &cSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
+ InjectHook(0x5664B0, &cSampleManager::ReleaseDigitalHandle, PATCH_JUMP);
+ InjectHook(0x5664F0, &cSampleManager::ReacquireDigitalHandle, PATCH_JUMP);
+ InjectHook(0x566530, &cSampleManager::Initialise, PATCH_JUMP);
+ InjectHook(0x566DC0, &cSampleManager::Terminate, PATCH_JUMP);
+ InjectHook(0x566EA0, &cSampleManager::CheckForAnAudioFileOnCD, PATCH_JUMP);
+ InjectHook(0x566F20, &cSampleManager::GetCDAudioDriveLetter, PATCH_JUMP);
+ InjectHook(0x566F50, &cSampleManager::UpdateEffectsVolume, PATCH_JUMP);
+ InjectHook(0x567010, &cSampleManager::SetEffectsMasterVolume, PATCH_JUMP);
+ InjectHook(0x567020, &cSampleManager::SetMusicMasterVolume, PATCH_JUMP);
+ InjectHook(0x567030, &cSampleManager::SetEffectsFadeVolume, PATCH_JUMP);
+ InjectHook(0x567040, &cSampleManager::SetMusicFadeVolume, PATCH_JUMP);
+ InjectHook(0x567050, &cSampleManager::LoadSampleBank, PATCH_JUMP);
+ InjectHook(0x567110, &cSampleManager::UnloadSampleBank, PATCH_JUMP);
+ InjectHook(0x567130, &cSampleManager::IsSampleBankLoaded, PATCH_JUMP);
+ InjectHook(0x567150, &cSampleManager::IsPedCommentLoaded, PATCH_JUMP);
+ InjectHook(0x5671A0, &cSampleManager::LoadPedComment, PATCH_JUMP);
+ InjectHook(0x5672A0, &cSampleManager::GetSampleBaseFrequency, PATCH_JUMP);
+ InjectHook(0x5672C0, &cSampleManager::GetSampleLoopStartOffset, PATCH_JUMP);
+ InjectHook(0x5672E0, &cSampleManager::GetSampleLoopEndOffset, PATCH_JUMP);
+ InjectHook(0x567300, &cSampleManager::GetSampleLength, PATCH_JUMP);
+ InjectHook(0x567320, &cSampleManager::UpdateReverb, PATCH_JUMP);
+ InjectHook(0x567630, &cSampleManager::SetChannelReverbFlag, PATCH_JUMP);
+ InjectHook(0x5676A0, &cSampleManager::InitialiseChannel, PATCH_JUMP);
+ InjectHook(0x567820, &cSampleManager::SetChannelEmittingVolume, PATCH_JUMP);
+ InjectHook(0x567890, &cSampleManager::SetChannel3DPosition, PATCH_JUMP);
+ InjectHook(0x5678D0, &cSampleManager::SetChannel3DDistances, PATCH_JUMP);
+ InjectHook(0x567900, &cSampleManager::SetChannelVolume, PATCH_JUMP);
+ InjectHook(0x567980, &cSampleManager::SetChannelPan, PATCH_JUMP);
+ InjectHook(0x5679D0, &cSampleManager::SetChannelFrequency, PATCH_JUMP);
+ InjectHook(0x567A30, &cSampleManager::SetChannelLoopPoints, PATCH_JUMP);
+ InjectHook(0x567AA0, &cSampleManager::SetChannelLoopCount, PATCH_JUMP);
+ InjectHook(0x567B00, &cSampleManager::GetChannelUsedFlag, PATCH_JUMP);
+ InjectHook(0x567B80, &cSampleManager::StartChannel, PATCH_JUMP);
+ InjectHook(0x567BE0, &cSampleManager::StopChannel, PATCH_JUMP);
+ InjectHook(0x567C50, &cSampleManager::PreloadStreamedFile, PATCH_JUMP);
+ InjectHook(0x567D30, &cSampleManager::PauseStream, PATCH_JUMP);
+ InjectHook(0x567D60, &cSampleManager::StartPreloadedStreamedFile, PATCH_JUMP);
+ InjectHook(0x567D80, &cSampleManager::StartStreamedFile, PATCH_JUMP);
+ InjectHook(0x5680E0, &cSampleManager::StopStreamedFile, PATCH_JUMP);
+ InjectHook(0x568130, &cSampleManager::GetStreamedFilePosition, PATCH_JUMP);
+ InjectHook(0x5681D0, &cSampleManager::SetStreamedVolumeAndPan, PATCH_JUMP);
+ InjectHook(0x568270, &cSampleManager::GetStreamedFileLength, PATCH_JUMP);
+ InjectHook(0x568290, &cSampleManager::IsStreamPlaying, PATCH_JUMP);
+ InjectHook(0x5682D0, &cSampleManager::InitialiseSampleBanks, PATCH_JUMP);
+ //InjectHook(0x5683F0, `global constructor keyed to'sampman.cpp, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
new file mode 100644
index 00000000..ba2381b5
--- /dev/null
+++ b/src/audio/sampman.h
@@ -0,0 +1,334 @@
+#pragma once
+#include "common.h"
+#include "AudioSamples.h"
+
+struct tSample {
+ int32 nOffset;
+ uint32 nSize;
+ int32 nFrequency;
+ int32 nLoopStart;
+ int32 nLoopEnd;
+};
+
+#define MAXPROVIDERS 64
+
+#define MAXCHANNELS 28
+#define MAXCHANNELS_SURROUND 24
+#define MAX2DCHANNELS 1
+#define CHANNEL2D MAXCHANNELS
+
+
+#define MAX_MP3STREAMS 2
+
+
+#define MAX_SAMPLEBANKS 2
+#define MAX_PEDSFX 7
+#define PED_BLOCKSIZE 79000
+
+
+#define MAX_DIGITAL_MIXER_CHANNELS 32
+
+#define DIGITALRATE 32000
+#define DIGITALBITS 16
+#define DIGITALCHANNELS 2
+
+
+
+class cSampleManager
+{
+ uint8 m_nEffectsVolume;
+ uint8 m_nMusicVolume;
+ uint8 m_nEffectsFadeVolume;
+ uint8 m_nMusicFadeVolume;
+ uint8 m_nMonoMode;
+ char _pad0[1];
+ char m_szCDRomRootPath[80];
+ bool m_bInitialised;
+ uint8 m_nNumberOfProviders;
+ char *m_aAudioProviders[MAXPROVIDERS];
+ tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
+
+public:
+
+
+
+ cSampleManager(void) :
+ m_nNumberOfProviders(0)
+ { }
+
+ ~cSampleManager(void)
+ { }
+
+ void SetSpeakerConfig(int32 nConfig);
+ uint32 GetMaximumSupportedChannels(void);
+
+ uint32 GetNum3DProvidersAvailable() { return m_nNumberOfProviders; }
+ void SetNum3DProvidersAvailable(uint32 num) { m_nNumberOfProviders = num; }
+
+ char *Get3DProviderName(uint8 id) { return m_aAudioProviders[id]; }
+ void Set3DProviderName(uint8 id, char *name) { m_aAudioProviders[id] = name; }
+
+ int8 GetCurrent3DProviderIndex(void);
+ int8 SetCurrent3DProvider(uint8 which);
+
+ bool IsMP3RadioChannelAvailable(void);
+
+ void ReleaseDigitalHandle (void);
+ void ReacquireDigitalHandle(void);
+
+ bool Initialise(void);
+ void Terminate (void);
+
+ bool CheckForAnAudioFileOnCD(void);
+ char GetCDAudioDriveLetter (void);
+
+ void UpdateEffectsVolume(void);
+
+ void SetEffectsMasterVolume(uint8 nVolume);
+ void SetMusicMasterVolume (uint8 nVolume);
+ void SetEffectsFadeVolume (uint8 nVolume);
+ void SetMusicFadeVolume (uint8 nVolume);
+
+ bool LoadSampleBank (uint8 nBank);
+ void UnloadSampleBank (uint8 nBank);
+ bool IsSampleBankLoaded(uint8 nBank);
+
+ bool IsPedCommentLoaded(uint32 nComment);
+ bool LoadPedComment (uint32 nComment);
+
+ int32 _GetPedCommentSlot(uint32 nComment);
+
+ int32 GetSampleBaseFrequency (uint32 nSample);
+ int32 GetSampleLoopStartOffset(uint32 nSample);
+ int32 GetSampleLoopEndOffset (uint32 nSample);
+ uint32 GetSampleLength (uint32 nSample);
+
+ bool UpdateReverb(void);
+
+ void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
+ bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
+ void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
+ void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
+ void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
+ void SetChannelVolume (uint32 nChannel, uint32 nVolume);
+ void SetChannelPan (uint32 nChannel, uint32 nPan);
+ void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
+ void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
+ void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
+ bool GetChannelUsedFlag (uint32 nChannel);
+ void StartChannel (uint32 nChannel);
+ void StopChannel (uint32 nChannel);
+
+ void PreloadStreamedFile (uint8 nFile, uint8 nStream);
+ void PauseStream (uint8 nPauseFlag, uint8 nStream);
+ void StartPreloadedStreamedFile (uint8 nStream);
+ bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream);
+ void StopStreamedFile (uint8 nStream);
+ int32 GetStreamedFilePosition (uint8 nStream);
+ void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
+ int32 GetStreamedFileLength (uint8 nStream);
+ bool IsStreamPlaying (uint8 nStream);
+ bool InitialiseSampleBanks(void);
+};
+
+extern cSampleManager &SampleManager;
+
+static char StreamedNameTable[][25]=
+{
+ "AUDIO\\HEAD.WAV",
+ "AUDIO\\CLASS.WAV",
+ "AUDIO\\KJAH.WAV",
+ "AUDIO\\RISE.WAV",
+ "AUDIO\\LIPS.WAV",
+ "AUDIO\\GAME.WAV",
+ "AUDIO\\MSX.WAV",
+ "AUDIO\\FLASH.WAV",
+ "AUDIO\\CHAT.WAV",
+ "AUDIO\\HEAD.WAV",
+ "AUDIO\\POLICE.WAV",
+ "AUDIO\\CITY.WAV",
+ "AUDIO\\WATER.WAV",
+ "AUDIO\\COMOPEN.WAV",
+ "AUDIO\\SUBOPEN.WAV",
+ "AUDIO\\JB.MP3",
+ "AUDIO\\BET.MP3",
+ "AUDIO\\L1_LG.MP3",
+ "AUDIO\\L2_DSB.MP3",
+ "AUDIO\\L3_DM.MP3",
+ "AUDIO\\L4_PAP.MP3",
+ "AUDIO\\L5_TFB.MP3",
+ "AUDIO\\J0_DM2.MP3",
+ "AUDIO\\J1_LFL.MP3",
+ "AUDIO\\J2_KCL.MP3",
+ "AUDIO\\J3_VH.MP3",
+ "AUDIO\\J4_ETH.MP3",
+ "AUDIO\\J5_DST.MP3",
+ "AUDIO\\J6_TBJ.MP3",
+ "AUDIO\\T1_TOL.MP3",
+ "AUDIO\\T2_TPU.MP3",
+ "AUDIO\\T3_MAS.MP3",
+ "AUDIO\\T4_TAT.MP3",
+ "AUDIO\\T5_BF.MP3",
+ "AUDIO\\S0_MAS.MP3",
+ "AUDIO\\S1_PF.MP3",
+ "AUDIO\\S2_CTG.MP3",
+ "AUDIO\\S3_RTC.MP3",
+ "AUDIO\\S5_LRQ.MP3",
+ "AUDIO\\S4_BDBA.MP3",
+ "AUDIO\\S4_BDBB.MP3",
+ "AUDIO\\S2_CTG2.MP3",
+ "AUDIO\\S4_BDBD.MP3",
+ "AUDIO\\S5_LRQB.MP3",
+ "AUDIO\\S5_LRQC.MP3",
+ "AUDIO\\A1_SSO.WAV",
+ "AUDIO\\A2_PP.WAV",
+ "AUDIO\\A3_SS.WAV",
+ "AUDIO\\A4_PDR.WAV",
+ "AUDIO\\A5_K2FT.WAV",
+ "AUDIO\\K1_KBO.MP3",
+ "AUDIO\\K2_GIS.MP3",
+ "AUDIO\\K3_DS.MP3",
+ "AUDIO\\K4_SHI.MP3",
+ "AUDIO\\K5_SD.MP3",
+ "AUDIO\\R0_PDR2.MP3",
+ "AUDIO\\R1_SW.MP3",
+ "AUDIO\\R2_AP.MP3",
+ "AUDIO\\R3_ED.MP3",
+ "AUDIO\\R4_GF.MP3",
+ "AUDIO\\R5_PB.MP3",
+ "AUDIO\\R6_MM.MP3",
+ "AUDIO\\D1_STOG.MP3",
+ "AUDIO\\D2_KK.MP3",
+ "AUDIO\\D3_ADO.MP3",
+ "AUDIO\\D5_ES.MP3",
+ "AUDIO\\D7_MLD.MP3",
+ "AUDIO\\D4_GTA.MP3",
+ "AUDIO\\D4_GTA2.MP3",
+ "AUDIO\\D6_STS.MP3",
+ "AUDIO\\A6_BAIT.WAV",
+ "AUDIO\\A7_ETG.WAV",
+ "AUDIO\\A8_PS.WAV",
+ "AUDIO\\A9_ASD.WAV",
+ "AUDIO\\K4_SHI2.MP3",
+ "AUDIO\\C1_TEX.MP3",
+ "AUDIO\\EL_PH1.MP3",
+ "AUDIO\\EL_PH2.MP3",
+ "AUDIO\\EL_PH3.MP3",
+ "AUDIO\\EL_PH4.MP3",
+ "AUDIO\\YD_PH1.MP3",
+ "AUDIO\\YD_PH2.MP3",
+ "AUDIO\\YD_PH3.MP3",
+ "AUDIO\\YD_PH4.MP3",
+ "AUDIO\\HD_PH1.MP3",
+ "AUDIO\\HD_PH2.MP3",
+ "AUDIO\\HD_PH3.MP3",
+ "AUDIO\\HD_PH4.MP3",
+ "AUDIO\\HD_PH5.MP3",
+ "AUDIO\\MT_PH1.MP3",
+ "AUDIO\\MT_PH2.MP3",
+ "AUDIO\\MT_PH3.MP3",
+ "AUDIO\\MT_PH4.MP3",
+ "AUDIO\\MISCOM.WAV",
+ "AUDIO\\END.MP3",
+ "AUDIO\\lib_a1.WAV",
+ "AUDIO\\lib_a2.WAV",
+ "AUDIO\\lib_a.WAV",
+ "AUDIO\\lib_b.WAV",
+ "AUDIO\\lib_c.WAV",
+ "AUDIO\\lib_d.WAV",
+ "AUDIO\\l2_a.WAV",
+ "AUDIO\\j4t_1.WAV",
+ "AUDIO\\j4t_2.WAV",
+ "AUDIO\\j4t_3.WAV",
+ "AUDIO\\j4t_4.WAV",
+ "AUDIO\\j4_a.WAV",
+ "AUDIO\\j4_b.WAV",
+ "AUDIO\\j4_c.WAV",
+ "AUDIO\\j4_d.WAV",
+ "AUDIO\\j4_e.WAV",
+ "AUDIO\\j4_f.WAV",
+ "AUDIO\\j6_1.WAV",
+ "AUDIO\\j6_a.WAV",
+ "AUDIO\\j6_b.WAV",
+ "AUDIO\\j6_c.WAV",
+ "AUDIO\\j6_d.WAV",
+ "AUDIO\\t4_a.WAV",
+ "AUDIO\\s1_a.WAV",
+ "AUDIO\\s1_a1.WAV",
+ "AUDIO\\s1_b.WAV",
+ "AUDIO\\s1_c.WAV",
+ "AUDIO\\s1_c1.WAV",
+ "AUDIO\\s1_d.WAV",
+ "AUDIO\\s1_e.WAV",
+ "AUDIO\\s1_f.WAV",
+ "AUDIO\\s1_g.WAV",
+ "AUDIO\\s1_h.WAV",
+ "AUDIO\\s1_i.WAV",
+ "AUDIO\\s1_j.WAV",
+ "AUDIO\\s1_k.WAV",
+ "AUDIO\\s1_l.WAV",
+ "AUDIO\\s3_a.WAV",
+ "AUDIO\\s3_b.WAV",
+ "AUDIO\\el3_a.WAV",
+ "AUDIO\\mf1_a.WAV",
+ "AUDIO\\mf2_a.WAV",
+ "AUDIO\\mf3_a.WAV",
+ "AUDIO\\mf3_b.WAV",
+ "AUDIO\\mf3_b1.WAV",
+ "AUDIO\\mf3_c.WAV",
+ "AUDIO\\mf4_a.WAV",
+ "AUDIO\\mf4_b.WAV",
+ "AUDIO\\mf4_c.WAV",
+ "AUDIO\\a1_a.WAV",
+ "AUDIO\\a3_a.WAV",
+ "AUDIO\\a5_a.WAV",
+ "AUDIO\\a4_a.WAV",
+ "AUDIO\\a4_b.WAV",
+ "AUDIO\\a4_c.WAV",
+ "AUDIO\\a4_d.WAV",
+ "AUDIO\\k1_a.WAV",
+ "AUDIO\\k3_a.WAV",
+ "AUDIO\\r1_a.WAV",
+ "AUDIO\\r2_a.WAV",
+ "AUDIO\\r2_b.WAV",
+ "AUDIO\\r2_c.WAV",
+ "AUDIO\\r2_d.WAV",
+ "AUDIO\\r2_e.WAV",
+ "AUDIO\\r2_f.WAV",
+ "AUDIO\\r2_g.WAV",
+ "AUDIO\\r2_h.WAV",
+ "AUDIO\\r5_a.WAV",
+ "AUDIO\\r6_a.WAV",
+ "AUDIO\\r6_a1.WAV",
+ "AUDIO\\r6_b.WAV",
+ "AUDIO\\lo2_a.WAV",
+ "AUDIO\\lo6_a.WAV",
+ "AUDIO\\yd2_a.WAV",
+ "AUDIO\\yd2_b.WAV",
+ "AUDIO\\yd2_c.WAV",
+ "AUDIO\\yd2_c1.WAV",
+ "AUDIO\\yd2_d.WAV",
+ "AUDIO\\yd2_e.WAV",
+ "AUDIO\\yd2_f.WAV",
+ "AUDIO\\yd2_g.WAV",
+ "AUDIO\\yd2_h.WAV",
+ "AUDIO\\yd2_ass.WAV",
+ "AUDIO\\yd2_ok.WAV",
+ "AUDIO\\h5_a.WAV",
+ "AUDIO\\h5_b.WAV",
+ "AUDIO\\h5_c.WAV",
+ "AUDIO\\ammu_a.WAV",
+ "AUDIO\\ammu_b.WAV",
+ "AUDIO\\ammu_c.WAV",
+ "AUDIO\\door_1.WAV",
+ "AUDIO\\door_2.WAV",
+ "AUDIO\\door_3.WAV",
+ "AUDIO\\door_4.WAV",
+ "AUDIO\\door_5.WAV",
+ "AUDIO\\door_6.WAV",
+ "AUDIO\\t3_a.WAV",
+ "AUDIO\\t3_b.WAV",
+ "AUDIO\\t3_c.WAV",
+ "AUDIO\\k1_b.WAV",
+ "AUDIO\\cat1.WAV"
+}; \ No newline at end of file
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 9e6d447e..8f3b77c2 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -35,6 +35,7 @@ public:
static bool GetIsPaused() { return m_UserPause || m_CodePause; }
static bool GetIsUserPaused() { return m_UserPause; }
+ static bool GetIsCodePaused() { return m_CodePause; }
static void SetCodePause(bool pause) { m_CodePause = pause; }
static void Initialise(void);
diff --git a/src/core/common.h b/src/core/common.h
index 9a5683c6..97a25a3f 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -180,6 +180,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(a) (((a) < 0) ? (-a) : (a))
+#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
#define STRINGIFY(x) #x
diff --git a/src/core/config.h b/src/core/config.h
index 1f684869..07c86c0d 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -93,6 +93,7 @@ enum Config {
# define RANDOMSPLASH
#elif defined GTA_PC
# define GTA3_1_1_PATCH
+//# define GTA3_STEAM_PATCH
# ifdef GTA_PS2_STUFF
//# define USE_PS2_RAND // this is unsafe until we have the game reversed
# define RANDOMSPLASH // use random splash as on PS2
@@ -114,6 +115,7 @@ enum Config {
// not in any game
# define NASTY_GAME // nasty game for all languages
# define NO_MOVIES // disable intro videos
+# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading
#endif
diff --git a/src/skel/win/gta3.ico b/src/skel/win/gta3.ico
new file mode 100644
index 00000000..2017c811
--- /dev/null
+++ b/src/skel/win/gta3.ico
Binary files differ