summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-08-02 18:49:12 +0200
committerSergeanur <s.anureev@yandex.ua>2020-08-02 18:49:12 +0200
commit3e24ae8812ca4a0031d82ea7f7393605b8a4283a (patch)
tree5cc79378e86970d3b63cbed173d627410ea90ca6 /src/audio
parentMerge pull request #669 from erorcun/miami (diff)
parentMove sdk and eax (diff)
downloadre3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.gz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.bz2
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.lz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.xz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.zst
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/eax/eax-util.cpp706
-rw-r--r--src/audio/eax/eax-util.h765
-rw-r--r--src/audio/eax/eax.h536
-rw-r--r--src/audio/oal/stream.cpp106
-rw-r--r--src/audio/sampman.h37
-rw-r--r--src/audio/sampman_oal.cpp58
6 files changed, 2201 insertions, 7 deletions
diff --git a/src/audio/eax/eax-util.cpp b/src/audio/eax/eax-util.cpp
new file mode 100644
index 00000000..42eef738
--- /dev/null
+++ b/src/audio/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.0001f) * flInvRatio) + (log(lpFinish->flReflectionsDelay+0.0001f) * 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.0001f) * flInvRatio) + (log(lpFinish->flReverbDelay+0.0001f) * 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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 //
+//////////////////////////////////////////////////////
+
+const 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/src/audio/eax/eax-util.h b/src/audio/eax/eax-util.h
new file mode 100644
index 00000000..441f0115
--- /dev/null
+++ b/src/audio/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 const 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 const 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 const 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 const 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 //
+//////////////////////////////////////////////////////
+
+extern const 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 const 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 const 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 const 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 const 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 const 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 const 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/src/audio/eax/eax.h b/src/audio/eax/eax.h
new file mode 100644
index 00000000..b2210936
--- /dev/null
+++ b/src/audio/eax/eax.h
@@ -0,0 +1,536 @@
+/*******************************************************************\
+* *
+* 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 AUDIO_OAL
+ #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 // AUDIO_OAL
+ #include <AL/al.h>
+ #include <string.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/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index b689e929..f2a9eb22 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -4,6 +4,9 @@
#include "stream.h"
#include "sampman.h"
+#ifdef AUDIO_OPUS
+#include <opusfile.h>
+#else
#ifdef _WIN32
// TODO: This is due to version difference of 32-bit libmpg123 and 64-bit libmpg123, fix it
@@ -17,7 +20,9 @@ typedef long ssize_t;
#endif
#include <sndfile.h>
#include <mpg123.h>
+#endif
+#ifndef AUDIO_OPUS
class CSndFile : public IDecoder
{
SNDFILE *m_pfSound;
@@ -184,6 +189,98 @@ public:
return (uint32)size;
}
};
+#else
+class COpusFile : public IDecoder
+{
+ OggOpusFile *m_FileH;
+ bool m_bOpened;
+ uint32 m_nRate;
+ uint32 m_nChannels;
+public:
+ COpusFile(const char *path) : m_FileH(nil),
+ m_bOpened(false),
+ m_nRate(0),
+ m_nChannels(0)
+ {
+ int ret;
+ m_FileH = op_open_file(path, &ret);
+
+ if (m_FileH) {
+ m_nChannels = op_head(m_FileH, 0)->channel_count;
+ m_nRate = op_head(m_FileH, 0)->input_sample_rate;
+ const OpusTags *tags = op_tags(m_FileH, 0);
+ for (int i = 0; i < tags->comments; i++) {
+ if (strncmp(tags->user_comments[i], "SAMPLERATE", sizeof("SAMPLERATE")-1) == 0)
+ {
+ sscanf(tags->user_comments[i], "SAMPLERATE=%i", &m_nRate);
+ break;
+ }
+ }
+
+ m_bOpened = true;
+ }
+ }
+
+ ~COpusFile()
+ {
+ if (m_FileH)
+ {
+ op_free(m_FileH);
+ m_FileH = nil;
+ }
+ }
+
+ bool IsOpened()
+ {
+ return m_bOpened;
+ }
+
+ uint32 GetSampleSize()
+ {
+ return sizeof(uint16);
+ }
+
+ uint32 GetSampleCount()
+ {
+ if ( !IsOpened() ) return 0;
+ return op_pcm_total(m_FileH, 0);
+ }
+
+ uint32 GetSampleRate()
+ {
+ return m_nRate;
+ }
+
+ uint32 GetChannels()
+ {
+ return m_nChannels;
+ }
+
+ void Seek(uint32 milliseconds)
+ {
+ if ( !IsOpened() ) return;
+ op_pcm_seek(m_FileH, ms2samples(milliseconds) * GetSampleSize());
+ }
+
+ uint32 Tell()
+ {
+ if ( !IsOpened() ) return 0;
+ return samples2ms(op_pcm_tell(m_FileH)/GetSampleSize());
+ }
+
+ uint32 Decode(void *buffer)
+ {
+ if ( !IsOpened() ) return 0;
+
+ int size = op_read(m_FileH, (opus_int16 *)buffer, GetBufferSamples(), NULL);
+
+ if (size < 0)
+ return 0;
+
+ return size * m_nChannels * GetSampleSize();
+ }
+};
+#endif
class CADFFile : public CMP3File
{
@@ -232,12 +329,16 @@ public:
void CStream::Initialise()
{
+#ifndef AUDIO_OPUS
mpg123_init();
+#endif
}
void CStream::Terminate()
{
+#ifndef AUDIO_OPUS
mpg123_exit();
+#endif
}
CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUFFERS]) :
@@ -268,12 +369,17 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
DEV("Stream %s\n", m_aFilename);
+#ifndef AUDIO_OPUS
if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".mp3")], ".mp3"))
m_pSoundFile = new CMP3File(m_aFilename);
else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav"))
m_pSoundFile = new CSndFile(m_aFilename);
else if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".adf")], ".adf"))
m_pSoundFile = new CADFFile(m_aFilename);
+#else
+ if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".opus")], ".opus"))
+ m_pSoundFile = new COpusFile(m_aFilename);
+#endif
else
m_pSoundFile = nil;
ASSERT(m_pSoundFile != nil);
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 04f2e0c4..773fbda1 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -218,6 +218,42 @@ public:
extern cSampleManager SampleManager;
extern uint32 BankStartOffset[MAX_SAMPLEBANKS];
+#ifdef AUDIO_OPUS
+static char StreamedNameTable[][25] = {
+ "AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS",
+ "AUDIO\\MSX.OPUS", "AUDIO\\FLASH.OPUS", "AUDIO\\CHAT.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\POLICE.OPUS", "AUDIO\\CITY.OPUS",
+ "AUDIO\\WATER.OPUS", "AUDIO\\COMOPEN.OPUS", "AUDIO\\SUBOPEN.OPUS", "AUDIO\\JB.OPUS", "AUDIO\\BET.OPUS", "AUDIO\\L1_LG.OPUS",
+ "AUDIO\\L2_DSB.OPUS", "AUDIO\\L3_DM.OPUS", "AUDIO\\L4_PAP.OPUS", "AUDIO\\L5_TFB.OPUS", "AUDIO\\J0_DM2.OPUS", "AUDIO\\J1_LFL.OPUS",
+ "AUDIO\\J2_KCL.OPUS", "AUDIO\\J3_VH.OPUS", "AUDIO\\J4_ETH.OPUS", "AUDIO\\J5_DST.OPUS", "AUDIO\\J6_TBJ.OPUS", "AUDIO\\T1_TOL.OPUS",
+ "AUDIO\\T2_TPU.OPUS", "AUDIO\\T3_MAS.OPUS", "AUDIO\\T4_TAT.OPUS", "AUDIO\\T5_BF.OPUS", "AUDIO\\S0_MAS.OPUS", "AUDIO\\S1_PF.OPUS",
+ "AUDIO\\S2_CTG.OPUS", "AUDIO\\S3_RTC.OPUS", "AUDIO\\S5_LRQ.OPUS", "AUDIO\\S4_BDBA.OPUS", "AUDIO\\S4_BDBB.OPUS", "AUDIO\\S2_CTG2.OPUS",
+ "AUDIO\\S4_BDBD.OPUS", "AUDIO\\S5_LRQB.OPUS", "AUDIO\\S5_LRQC.OPUS", "AUDIO\\A1_SSO.OPUS", "AUDIO\\A2_PP.OPUS", "AUDIO\\A3_SS.OPUS",
+ "AUDIO\\A4_PDR.OPUS", "AUDIO\\A5_K2FT.OPUS", "AUDIO\\K1_KBO.OPUS", "AUDIO\\K2_GIS.OPUS", "AUDIO\\K3_DS.OPUS", "AUDIO\\K4_SHI.OPUS",
+ "AUDIO\\K5_SD.OPUS", "AUDIO\\R0_PDR2.OPUS", "AUDIO\\R1_SW.OPUS", "AUDIO\\R2_AP.OPUS", "AUDIO\\R3_ED.OPUS", "AUDIO\\R4_GF.OPUS",
+ "AUDIO\\R5_PB.OPUS", "AUDIO\\R6_MM.OPUS", "AUDIO\\D1_STOG.OPUS", "AUDIO\\D2_KK.OPUS", "AUDIO\\D3_ADO.OPUS", "AUDIO\\D5_ES.OPUS",
+ "AUDIO\\D7_MLD.OPUS", "AUDIO\\D4_GTA.OPUS", "AUDIO\\D4_GTA2.OPUS", "AUDIO\\D6_STS.OPUS", "AUDIO\\A6_BAIT.OPUS", "AUDIO\\A7_ETG.OPUS",
+ "AUDIO\\A8_PS.OPUS", "AUDIO\\A9_ASD.OPUS", "AUDIO\\K4_SHI2.OPUS", "AUDIO\\C1_TEX.OPUS", "AUDIO\\EL_PH1.OPUS", "AUDIO\\EL_PH2.OPUS",
+ "AUDIO\\EL_PH3.OPUS", "AUDIO\\EL_PH4.OPUS", "AUDIO\\YD_PH1.OPUS", "AUDIO\\YD_PH2.OPUS", "AUDIO\\YD_PH3.OPUS", "AUDIO\\YD_PH4.OPUS",
+ "AUDIO\\HD_PH1.OPUS", "AUDIO\\HD_PH2.OPUS", "AUDIO\\HD_PH3.OPUS", "AUDIO\\HD_PH4.OPUS", "AUDIO\\HD_PH5.OPUS", "AUDIO\\MT_PH1.OPUS",
+ "AUDIO\\MT_PH2.OPUS", "AUDIO\\MT_PH3.OPUS", "AUDIO\\MT_PH4.OPUS", "AUDIO\\MISCOM.OPUS", "AUDIO\\END.OPUS", "AUDIO\\lib_a1.OPUS",
+ "AUDIO\\lib_a2.OPUS", "AUDIO\\lib_a.OPUS", "AUDIO\\lib_b.OPUS", "AUDIO\\lib_c.OPUS", "AUDIO\\lib_d.OPUS", "AUDIO\\l2_a.OPUS",
+ "AUDIO\\j4t_1.OPUS", "AUDIO\\j4t_2.OPUS", "AUDIO\\j4t_3.OPUS", "AUDIO\\j4t_4.OPUS", "AUDIO\\j4_a.OPUS", "AUDIO\\j4_b.OPUS",
+ "AUDIO\\j4_c.OPUS", "AUDIO\\j4_d.OPUS", "AUDIO\\j4_e.OPUS", "AUDIO\\j4_f.OPUS", "AUDIO\\j6_1.OPUS", "AUDIO\\j6_a.OPUS",
+ "AUDIO\\j6_b.OPUS", "AUDIO\\j6_c.OPUS", "AUDIO\\j6_d.OPUS", "AUDIO\\t4_a.OPUS", "AUDIO\\s1_a.OPUS", "AUDIO\\s1_a1.OPUS",
+ "AUDIO\\s1_b.OPUS", "AUDIO\\s1_c.OPUS", "AUDIO\\s1_c1.OPUS", "AUDIO\\s1_d.OPUS", "AUDIO\\s1_e.OPUS", "AUDIO\\s1_f.OPUS",
+ "AUDIO\\s1_g.OPUS", "AUDIO\\s1_h.OPUS", "AUDIO\\s1_i.OPUS", "AUDIO\\s1_j.OPUS", "AUDIO\\s1_k.OPUS", "AUDIO\\s1_l.OPUS",
+ "AUDIO\\s3_a.OPUS", "AUDIO\\s3_b.OPUS", "AUDIO\\el3_a.OPUS", "AUDIO\\mf1_a.OPUS", "AUDIO\\mf2_a.OPUS", "AUDIO\\mf3_a.OPUS",
+ "AUDIO\\mf3_b.OPUS", "AUDIO\\mf3_b1.OPUS", "AUDIO\\mf3_c.OPUS", "AUDIO\\mf4_a.OPUS", "AUDIO\\mf4_b.OPUS", "AUDIO\\mf4_c.OPUS",
+ "AUDIO\\a1_a.OPUS", "AUDIO\\a3_a.OPUS", "AUDIO\\a5_a.OPUS", "AUDIO\\a4_a.OPUS", "AUDIO\\a4_b.OPUS", "AUDIO\\a4_c.OPUS",
+ "AUDIO\\a4_d.OPUS", "AUDIO\\k1_a.OPUS", "AUDIO\\k3_a.OPUS", "AUDIO\\r1_a.OPUS", "AUDIO\\r2_a.OPUS", "AUDIO\\r2_b.OPUS",
+ "AUDIO\\r2_c.OPUS", "AUDIO\\r2_d.OPUS", "AUDIO\\r2_e.OPUS", "AUDIO\\r2_f.OPUS", "AUDIO\\r2_g.OPUS", "AUDIO\\r2_h.OPUS",
+ "AUDIO\\r5_a.OPUS", "AUDIO\\r6_a.OPUS", "AUDIO\\r6_a1.OPUS", "AUDIO\\r6_b.OPUS", "AUDIO\\lo2_a.OPUS", "AUDIO\\lo6_a.OPUS",
+ "AUDIO\\yd2_a.OPUS", "AUDIO\\yd2_b.OPUS", "AUDIO\\yd2_c.OPUS", "AUDIO\\yd2_c1.OPUS", "AUDIO\\yd2_d.OPUS", "AUDIO\\yd2_e.OPUS",
+ "AUDIO\\yd2_f.OPUS", "AUDIO\\yd2_g.OPUS", "AUDIO\\yd2_h.OPUS", "AUDIO\\yd2_ass.OPUS", "AUDIO\\yd2_ok.OPUS", "AUDIO\\h5_a.OPUS",
+ "AUDIO\\h5_b.OPUS", "AUDIO\\h5_c.OPUS", "AUDIO\\ammu_a.OPUS", "AUDIO\\ammu_b.OPUS", "AUDIO\\ammu_c.OPUS", "AUDIO\\door_1.OPUS",
+ "AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
+ "AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
+#else
static char StreamedNameTable[][25]=
{
"AUDIO\\WILD.ADF",
@@ -1445,3 +1481,4 @@ static char StreamedNameTable[][25]=
"AUDIO\\BUST_27.WAV",
"AUDIO\\BUST_28.WAV",
};
+#endif \ No newline at end of file
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index bf2eca7d..a2943aff 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -27,6 +27,9 @@
#include "MusicManager.h"
#include "Frontend.h"
#include "Timer.h"
+#ifdef AUDIO_OPUS
+#include <opusfile.h>
+#endif
//TODO: fix eax3 reverb
//TODO: max channals
@@ -69,7 +72,11 @@ char SampleBankDescFilename[] = "audio/sfx.SDT";
char SampleBankDataFilename[] = "audio/sfx.RAW";
FILE *fpSampleDescHandle;
+#ifdef AUDIO_OPUS
+OggOpusFile *fpSampleDataHandle;
+#else
FILE *fpSampleDataHandle;
+#endif
bool bSampleBankLoaded [MAX_SAMPLEBANKS];
int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS];
int32 nSampleBankSize [MAX_SAMPLEBANKS];
@@ -444,6 +451,8 @@ int8 cSampleManager::GetCurrent3DProviderIndex(void)
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
ASSERT( nProvider < m_nNumberOfProviders );
+ if (nProvider >= m_nNumberOfProviders)
+ nProvider = 0;
int savedprovider = curprovider;
if ( nProvider < m_nNumberOfProviders )
@@ -754,12 +763,27 @@ cSampleManager::LoadSampleBank(uint8 nBank)
return false;
}
+#ifdef AUDIO_OPUS
+ int samplesRead = 0;
+ int samplesSize = nSampleBankSize[nBank] / 2;
+ op_pcm_seek(fpSampleDataHandle, 0);
+ while (samplesSize > 0) {
+ int size = op_read(fpSampleDataHandle, (opus_int16 *)(nSampleBankMemoryStartAddress[nBank] + samplesRead), samplesSize, NULL);
+ if (size <= 0) {
+ // huh?
+ //assert(0);
+ break;
+ }
+ samplesRead += size*2;
+ samplesSize -= size;
+ }
+#else
if ( fseek(fpSampleDataHandle, nSampleBankDiscStartOffset[nBank], SEEK_SET) != 0 )
return false;
if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank], fpSampleDataHandle) != nSampleBankSize[nBank] )
return false;
-
+#endif
bSampleBankLoaded[nBank] = true;
return true;
@@ -851,13 +875,28 @@ cSampleManager::LoadPedComment(uint32 nComment)
}
}
}
-
+
+#ifdef AUDIO_OPUS
+ int samplesRead = 0;
+ int samplesSize = m_aSamples[nComment].nSize / 2;
+ op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
+ while (samplesSize > 0) {
+ int size = op_read(fpSampleDataHandle, (opus_int16 *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE * nCurrentPedSlot + samplesRead),
+ samplesSize, NULL);
+ if (size <= 0) {
+ return false;
+ }
+ samplesRead += size * 2;
+ samplesSize -= size;
+ }
+#else
if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
return false;
if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
return false;
-
+
+#endif
nPedSlotSfx[nCurrentPedSlot] = nComment;
alBufferData(pedBuffers[nCurrentPedSlot],
@@ -1387,7 +1426,7 @@ cSampleManager::InitialiseSampleBanks(void)
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL )
return false;
-
+#ifndef AUDIO_OPUS
fpSampleDataHandle = fopen(SampleBankDataFilename, "rb");
if ( fpSampleDataHandle == NULL )
{
@@ -1400,9 +1439,14 @@ cSampleManager::InitialiseSampleBanks(void)
fseek(fpSampleDataHandle, 0, SEEK_END);
int32 _nSampleDataEndOffset = ftell(fpSampleDataHandle);
rewind(fpSampleDataHandle);
-
+#else
+ int e;
+ fpSampleDataHandle = op_open_file(SampleBankDataFilename, &e);
+#endif
fread(m_aSamples, sizeof(tSample), TOTAL_AUDIO_SAMPLES, fpSampleDescHandle);
-
+#ifdef AUDIO_OPUS
+ int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize;
+#endif
fclose(fpSampleDescHandle);
fpSampleDescHandle = NULL;
@@ -1420,7 +1464,7 @@ cSampleManager::InitialiseSampleBanks(void)
nSampleBankSize[SAMPLEBANK_MAIN] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SAMPLEBANK_MAIN];
nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED];
-
+
return true;
}