mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 12:14:41 +02:00
update OpenAL-Soft to 1.24.3.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "opthelpers.h"
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
using GUID = struct _GUID { /* NOLINT(*-reserved-identifier) */
|
||||
@@ -37,14 +39,16 @@ inline bool operator!=(const GUID& lhs, const GUID& rhs) noexcept
|
||||
{ return !(lhs == rhs); }
|
||||
#endif // _WIN32
|
||||
|
||||
/* TODO: This seems to create very inefficient comparisons. C++20 should allow
|
||||
* creating default comparison operators, avoiding the need for this.
|
||||
*/
|
||||
#define DECL_EQOP(T, ...) \
|
||||
[[nodiscard]] auto get_members() const noexcept { return std::forward_as_tuple(__VA_ARGS__); } \
|
||||
[[nodiscard]] friend bool operator==(const T &lhs, const T &rhs) noexcept \
|
||||
{ return lhs.get_members() == rhs.get_members(); } \
|
||||
[[nodiscard]] friend bool operator!=(const T &lhs, const T &rhs) noexcept \
|
||||
{ return !(lhs == rhs); }
|
||||
{ return lhs.get_members() == rhs.get_members(); } \
|
||||
[[nodiscard]] friend bool operator!=(const T &lhs, const T &rhs) noexcept { return !(lhs == rhs); }
|
||||
|
||||
extern const GUID DSPROPSETID_EAX_ReverbProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAX_ReverbProperties;
|
||||
|
||||
enum DSPROPERTY_EAX_REVERBPROPERTY : unsigned int {
|
||||
DSPROPERTY_EAX_ALL,
|
||||
@@ -62,7 +66,7 @@ struct EAX_REVERBPROPERTIES {
|
||||
}; // EAX_REVERBPROPERTIES
|
||||
|
||||
|
||||
extern const GUID DSPROPSETID_EAXBUFFER_ReverbProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAXBUFFER_ReverbProperties;
|
||||
|
||||
enum DSPROPERTY_EAXBUFFER_REVERBPROPERTY : unsigned int {
|
||||
DSPROPERTY_EAXBUFFER_ALL,
|
||||
@@ -78,7 +82,7 @@ constexpr auto EAX_BUFFER_MAXREVERBMIX = 1.0F;
|
||||
constexpr auto EAX_REVERBMIX_USEDISTANCE = -1.0F;
|
||||
|
||||
|
||||
extern const GUID DSPROPSETID_EAX20_ListenerProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAX20_ListenerProperties;
|
||||
|
||||
enum DSPROPERTY_EAX20_LISTENERPROPERTY : unsigned int {
|
||||
DSPROPERTY_EAX20LISTENER_NONE,
|
||||
@@ -216,7 +220,7 @@ constexpr auto EAX2LISTENER_DEFAULTFLAGS =
|
||||
EAX2LISTENERFLAGS_DECAYHFLIMIT;
|
||||
|
||||
|
||||
extern const GUID DSPROPSETID_EAX20_BufferProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAX20_BufferProperties;
|
||||
|
||||
enum DSPROPERTY_EAX20_BUFFERPROPERTY : unsigned int {
|
||||
DSPROPERTY_EAX20BUFFER_NONE,
|
||||
@@ -252,9 +256,9 @@ struct EAX20BUFFERPROPERTIES {
|
||||
unsigned long dwFlags; // modifies the behavior of properties
|
||||
}; // EAX20BUFFERPROPERTIES
|
||||
|
||||
extern const GUID DSPROPSETID_EAX30_ListenerProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAX30_ListenerProperties;
|
||||
|
||||
extern const GUID DSPROPSETID_EAX30_BufferProperties;
|
||||
DECL_HIDDEN extern const GUID DSPROPSETID_EAX30_BufferProperties;
|
||||
|
||||
|
||||
constexpr auto EAX_MAX_FXSLOTS = 4;
|
||||
@@ -272,31 +276,29 @@ constexpr auto EAXERR_INCOMPATIBLE_SOURCE_TYPE = -5L;
|
||||
constexpr auto EAXERR_INCOMPATIBLE_EAX_VERSION = -6L;
|
||||
|
||||
|
||||
extern const GUID EAX_NULL_GUID;
|
||||
DECL_HIDDEN extern const GUID EAX_NULL_GUID;
|
||||
|
||||
extern const GUID EAX_PrimaryFXSlotID;
|
||||
DECL_HIDDEN extern const GUID EAX_PrimaryFXSlotID;
|
||||
|
||||
|
||||
struct EAXVECTOR {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
[[nodiscard]]
|
||||
auto get_members() const noexcept { return std::forward_as_tuple(x, y, z); }
|
||||
}; // EAXVECTOR
|
||||
};
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool operator==(const EAXVECTOR& lhs, const EAXVECTOR& rhs) noexcept
|
||||
{ return lhs.get_members() == rhs.get_members(); }
|
||||
{ return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z; }
|
||||
|
||||
[[nodiscard]]
|
||||
inline bool operator!=(const EAXVECTOR& lhs, const EAXVECTOR& rhs) noexcept
|
||||
{ return !(lhs == rhs); }
|
||||
|
||||
|
||||
extern const GUID EAXPROPERTYID_EAX40_Context;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_Context;
|
||||
|
||||
extern const GUID EAXPROPERTYID_EAX50_Context;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_Context;
|
||||
|
||||
// EAX50
|
||||
constexpr auto HEADPHONES = 0UL;
|
||||
@@ -372,17 +374,17 @@ constexpr auto EAXCONTEXT_DEFAULTMACROFXFACTOR = 0.0F;
|
||||
|
||||
constexpr auto EAXCONTEXT_DEFAULTLASTERROR = EAX_OK;
|
||||
|
||||
extern const GUID EAXPROPERTYID_EAX40_FXSlot0;
|
||||
extern const GUID EAXPROPERTYID_EAX50_FXSlot0;
|
||||
extern const GUID EAXPROPERTYID_EAX40_FXSlot1;
|
||||
extern const GUID EAXPROPERTYID_EAX50_FXSlot1;
|
||||
extern const GUID EAXPROPERTYID_EAX40_FXSlot2;
|
||||
extern const GUID EAXPROPERTYID_EAX50_FXSlot2;
|
||||
extern const GUID EAXPROPERTYID_EAX40_FXSlot3;
|
||||
extern const GUID EAXPROPERTYID_EAX50_FXSlot3;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_FXSlot0;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_FXSlot0;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_FXSlot1;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_FXSlot1;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_FXSlot2;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_FXSlot2;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_FXSlot3;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_FXSlot3;
|
||||
|
||||
extern const GUID EAX40CONTEXT_DEFAULTPRIMARYFXSLOTID;
|
||||
extern const GUID EAX50CONTEXT_DEFAULTPRIMARYFXSLOTID;
|
||||
DECL_HIDDEN extern const GUID EAX40CONTEXT_DEFAULTPRIMARYFXSLOTID;
|
||||
DECL_HIDDEN extern const GUID EAX50CONTEXT_DEFAULTPRIMARYFXSLOTID;
|
||||
|
||||
enum EAXFXSLOT_PROPERTY : unsigned int {
|
||||
EAXFXSLOT_PARAMETER = 0,
|
||||
@@ -445,8 +447,8 @@ struct EAX50FXSLOTPROPERTIES : public EAX40FXSLOTPROPERTIES {
|
||||
float flOcclusionLFRatio;
|
||||
}; // EAX50FXSLOTPROPERTIES
|
||||
|
||||
extern const GUID EAXPROPERTYID_EAX40_Source;
|
||||
extern const GUID EAXPROPERTYID_EAX50_Source;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX40_Source;
|
||||
DECL_HIDDEN extern const GUID EAXPROPERTYID_EAX50_Source;
|
||||
|
||||
// Source object properties
|
||||
enum EAXSOURCE_PROPERTY : unsigned int {
|
||||
@@ -713,16 +715,16 @@ struct EAXSOURCEEXCLUSIONSENDPROPERTIES {
|
||||
float flExclusionLFRatio;
|
||||
}; // EAXSOURCEEXCLUSIONSENDPROPERTIES
|
||||
|
||||
extern const EAX40ACTIVEFXSLOTS EAX40SOURCE_DEFAULTACTIVEFXSLOTID;
|
||||
DECL_HIDDEN extern const EAX40ACTIVEFXSLOTS EAX40SOURCE_DEFAULTACTIVEFXSLOTID;
|
||||
|
||||
extern const EAX50ACTIVEFXSLOTS EAX50SOURCE_3DDEFAULTACTIVEFXSLOTID;
|
||||
DECL_HIDDEN extern const EAX50ACTIVEFXSLOTS EAX50SOURCE_3DDEFAULTACTIVEFXSLOTID;
|
||||
|
||||
extern const EAX50ACTIVEFXSLOTS EAX50SOURCE_2DDEFAULTACTIVEFXSLOTID;
|
||||
DECL_HIDDEN extern const EAX50ACTIVEFXSLOTS EAX50SOURCE_2DDEFAULTACTIVEFXSLOTID;
|
||||
|
||||
|
||||
// EAX Reverb Effect
|
||||
|
||||
extern const GUID EAX_REVERB_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_REVERB_EFFECT;
|
||||
|
||||
// Reverb effect properties
|
||||
enum EAXREVERB_PROPERTY : unsigned int {
|
||||
@@ -959,18 +961,18 @@ constexpr auto EAXREVERB_DEFAULTFLAGS =
|
||||
|
||||
|
||||
using Eax1ReverbPresets = std::array<EAX_REVERBPROPERTIES, EAX1_ENVIRONMENT_COUNT>;
|
||||
extern const Eax1ReverbPresets EAX1REVERB_PRESETS;
|
||||
DECL_HIDDEN extern const Eax1ReverbPresets EAX1REVERB_PRESETS;
|
||||
|
||||
using Eax2ReverbPresets = std::array<EAX20LISTENERPROPERTIES, EAX2_ENVIRONMENT_COUNT>;
|
||||
extern const Eax2ReverbPresets EAX2REVERB_PRESETS;
|
||||
DECL_HIDDEN extern const Eax2ReverbPresets EAX2REVERB_PRESETS;
|
||||
|
||||
using EaxReverbPresets = std::array<EAXREVERBPROPERTIES, EAX1_ENVIRONMENT_COUNT>;
|
||||
extern const EaxReverbPresets EAXREVERB_PRESETS;
|
||||
DECL_HIDDEN extern const EaxReverbPresets EAXREVERB_PRESETS;
|
||||
|
||||
|
||||
// AGC Compressor Effect
|
||||
|
||||
extern const GUID EAX_AGCCOMPRESSOR_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_AGCCOMPRESSOR_EFFECT;
|
||||
|
||||
enum EAXAGCCOMPRESSOR_PROPERTY : unsigned int {
|
||||
EAXAGCCOMPRESSOR_NONE,
|
||||
@@ -991,7 +993,7 @@ constexpr auto EAXAGCCOMPRESSOR_DEFAULTONOFF = EAXAGCCOMPRESSOR_MAXONOFF;
|
||||
|
||||
// Autowah Effect
|
||||
|
||||
extern const GUID EAX_AUTOWAH_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_AUTOWAH_EFFECT;
|
||||
|
||||
enum EAXAUTOWAH_PROPERTY : unsigned int {
|
||||
EAXAUTOWAH_NONE,
|
||||
@@ -1030,7 +1032,7 @@ constexpr auto EAXAUTOWAH_DEFAULTPEAKLEVEL = 2100L;
|
||||
|
||||
// Chorus Effect
|
||||
|
||||
extern const GUID EAX_CHORUS_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_CHORUS_EFFECT;
|
||||
|
||||
enum EAXCHORUS_PROPERTY : unsigned int {
|
||||
EAXCHORUS_NONE,
|
||||
@@ -1086,7 +1088,7 @@ constexpr auto EAXCHORUS_DEFAULTDELAY = 0.016F;
|
||||
|
||||
// Distortion Effect
|
||||
|
||||
extern const GUID EAX_DISTORTION_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_DISTORTION_EFFECT;
|
||||
|
||||
enum EAXDISTORTION_PROPERTY : unsigned int {
|
||||
EAXDISTORTION_NONE,
|
||||
@@ -1131,7 +1133,7 @@ constexpr auto EAXDISTORTION_DEFAULTEQBANDWIDTH = 3600.0F;
|
||||
|
||||
// Echo Effect
|
||||
|
||||
extern const GUID EAX_ECHO_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_ECHO_EFFECT;
|
||||
|
||||
enum EAXECHO_PROPERTY : unsigned int {
|
||||
EAXECHO_NONE,
|
||||
@@ -1176,7 +1178,7 @@ constexpr auto EAXECHO_DEFAULTSPREAD = -1.0F;
|
||||
|
||||
// Equalizer Effect
|
||||
|
||||
extern const GUID EAX_EQUALIZER_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_EQUALIZER_EFFECT;
|
||||
|
||||
enum EAXEQUALIZER_PROPERTY : unsigned int {
|
||||
EAXEQUALIZER_NONE,
|
||||
@@ -1252,7 +1254,7 @@ constexpr auto EAXEQUALIZER_DEFAULTHIGHCUTOFF = 6000.0F;
|
||||
|
||||
// Flanger Effect
|
||||
|
||||
extern const GUID EAX_FLANGER_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_FLANGER_EFFECT;
|
||||
|
||||
enum EAXFLANGER_PROPERTY : unsigned int {
|
||||
EAXFLANGER_NONE,
|
||||
@@ -1308,7 +1310,7 @@ constexpr auto EAXFLANGER_DEFAULTDELAY = 0.002F;
|
||||
|
||||
// Frequency Shifter Effect
|
||||
|
||||
extern const GUID EAX_FREQUENCYSHIFTER_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_FREQUENCYSHIFTER_EFFECT;
|
||||
|
||||
enum EAXFREQUENCYSHIFTER_PROPERTY : unsigned int {
|
||||
EAXFREQUENCYSHIFTER_NONE,
|
||||
@@ -1347,7 +1349,7 @@ constexpr auto EAXFREQUENCYSHIFTER_DEFAULTRIGHTDIRECTION = EAXFREQUENCYSHIFTER_M
|
||||
|
||||
// Vocal Morpher Effect
|
||||
|
||||
extern const GUID EAX_VOCALMORPHER_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_VOCALMORPHER_EFFECT;
|
||||
|
||||
enum EAXVOCALMORPHER_PROPERTY : unsigned int {
|
||||
EAXVOCALMORPHER_NONE,
|
||||
@@ -1439,7 +1441,7 @@ constexpr auto EAXVOCALMORPHER_DEFAULTRATE = 1.41F;
|
||||
|
||||
// Pitch Shifter Effect
|
||||
|
||||
extern const GUID EAX_PITCHSHIFTER_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_PITCHSHIFTER_EFFECT;
|
||||
|
||||
enum EAXPITCHSHIFTER_PROPERTY : unsigned int {
|
||||
EAXPITCHSHIFTER_NONE,
|
||||
@@ -1466,7 +1468,7 @@ constexpr auto EAXPITCHSHIFTER_DEFAULTFINETUNE = 0L;
|
||||
|
||||
// Ring Modulator Effect
|
||||
|
||||
extern const GUID EAX_RINGMODULATOR_EFFECT;
|
||||
DECL_HIDDEN extern const GUID EAX_RINGMODULATOR_EFFECT;
|
||||
|
||||
enum EAXRINGMODULATOR_PROPERTY : unsigned int {
|
||||
EAXRINGMODULATOR_NONE,
|
||||
|
||||
@@ -15,13 +15,8 @@ public:
|
||||
|
||||
} // namespace
|
||||
|
||||
EaxCall::EaxCall(
|
||||
EaxCallType type,
|
||||
const GUID& property_set_guid,
|
||||
ALuint property_id,
|
||||
ALuint property_source_id,
|
||||
ALvoid* property_buffer,
|
||||
ALuint property_size)
|
||||
EaxCall::EaxCall(EaxCallType type, const GUID &property_set_guid, ALuint property_id,
|
||||
ALuint property_source_id, ALvoid *property_buffer, ALuint property_size)
|
||||
: mCallType{type}, mIsDeferred{(property_id & deferred_flag) != 0}
|
||||
, mPropertyId{property_id & ~deferred_flag}, mPropertySourceId{property_source_id}
|
||||
, mPropertyBuffer{property_buffer}, mPropertyBufferSize{property_size}
|
||||
@@ -145,23 +140,34 @@ EaxCall::EaxCall(
|
||||
fail("Unsupported property set id.");
|
||||
}
|
||||
|
||||
switch(mPropertyId)
|
||||
if(mPropertySetId == EaxCallPropertySetId::context)
|
||||
{
|
||||
case EAXCONTEXT_LASTERROR:
|
||||
case EAXCONTEXT_SPEAKERCONFIG:
|
||||
case EAXCONTEXT_EAXSESSION:
|
||||
case EAXFXSLOT_NONE:
|
||||
case EAXFXSLOT_ALLPARAMETERS:
|
||||
case EAXFXSLOT_LOADEFFECT:
|
||||
case EAXFXSLOT_VOLUME:
|
||||
case EAXFXSLOT_LOCK:
|
||||
case EAXFXSLOT_FLAGS:
|
||||
case EAXFXSLOT_OCCLUSION:
|
||||
case EAXFXSLOT_OCCLUSIONLFRATIO:
|
||||
// EAX allow to set "defer" flag on immediate-only properties.
|
||||
// If we don't clear our flag then "applyAllUpdates" in EAX context won't be called.
|
||||
mIsDeferred = false;
|
||||
break;
|
||||
switch(mPropertyId)
|
||||
{
|
||||
case EAXCONTEXT_LASTERROR:
|
||||
case EAXCONTEXT_SPEAKERCONFIG:
|
||||
case EAXCONTEXT_EAXSESSION:
|
||||
// EAX allow to set "defer" flag on immediate-only properties.
|
||||
// If we don't clear our flag then "applyAllUpdates" in EAX context won't be called.
|
||||
mIsDeferred = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mPropertySetId == EaxCallPropertySetId::fx_slot)
|
||||
{
|
||||
switch(mPropertyId)
|
||||
{
|
||||
case EAXFXSLOT_NONE:
|
||||
case EAXFXSLOT_ALLPARAMETERS:
|
||||
case EAXFXSLOT_LOADEFFECT:
|
||||
case EAXFXSLOT_VOLUME:
|
||||
case EAXFXSLOT_LOCK:
|
||||
case EAXFXSLOT_FLAGS:
|
||||
case EAXFXSLOT_OCCLUSION:
|
||||
case EAXFXSLOT_OCCLUSIONLFRATIO:
|
||||
mIsDeferred = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!mIsDeferred)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef EAX_EFFECT_INCLUDED
|
||||
#define EAX_EFFECT_INCLUDED
|
||||
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
#include "alnumeric.h"
|
||||
#include "AL/al.h"
|
||||
#include "AL/alext.h"
|
||||
#include "core/effects/base.h"
|
||||
#include "call.h"
|
||||
|
||||
inline bool EaxTraceCommits{false};
|
||||
|
||||
struct EaxEffectErrorMessages {
|
||||
static constexpr auto unknown_property_id() noexcept { return "Unknown property id."; }
|
||||
static constexpr auto unknown_version() noexcept { return "Unknown version."; }
|
||||
@@ -123,10 +123,6 @@ template<typename T>
|
||||
struct EaxCommitter {
|
||||
struct Exception;
|
||||
|
||||
EaxCommitter(EaxEffectProps &eaxprops, EffectProps &alprops)
|
||||
: mEaxProps{eaxprops}, mAlProps{alprops}
|
||||
{ }
|
||||
|
||||
EaxEffectProps &mEaxProps;
|
||||
EffectProps &mAlProps;
|
||||
|
||||
@@ -141,10 +137,18 @@ struct EaxCommitter {
|
||||
[[noreturn]] static void fail(const char *message);
|
||||
[[noreturn]] static void fail_unknown_property_id()
|
||||
{ fail(EaxEffectErrorMessages::unknown_property_id()); }
|
||||
|
||||
private:
|
||||
EaxCommitter(EaxEffectProps &eaxprops, EffectProps &alprops)
|
||||
: mEaxProps{eaxprops}, mAlProps{alprops}
|
||||
{ }
|
||||
|
||||
friend T;
|
||||
};
|
||||
|
||||
struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> {
|
||||
using EaxCommitter<EaxAutowahCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxAutowahCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXAUTOWAHPROPERTIES &props);
|
||||
|
||||
@@ -153,7 +157,8 @@ struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> {
|
||||
static void Set(const EaxCall &call, EAXAUTOWAHPROPERTIES &props);
|
||||
};
|
||||
struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> {
|
||||
using EaxCommitter<EaxChorusCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxChorusCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXCHORUSPROPERTIES &props);
|
||||
|
||||
@@ -162,7 +167,8 @@ struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> {
|
||||
static void Set(const EaxCall &call, EAXCHORUSPROPERTIES &props);
|
||||
};
|
||||
struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> {
|
||||
using EaxCommitter<EaxCompressorCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxCompressorCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXAGCCOMPRESSORPROPERTIES &props);
|
||||
|
||||
@@ -171,7 +177,8 @@ struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> {
|
||||
static void Set(const EaxCall &call, EAXAGCCOMPRESSORPROPERTIES &props);
|
||||
};
|
||||
struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> {
|
||||
using EaxCommitter<EaxDistortionCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxDistortionCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXDISTORTIONPROPERTIES &props);
|
||||
|
||||
@@ -180,7 +187,8 @@ struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> {
|
||||
static void Set(const EaxCall &call, EAXDISTORTIONPROPERTIES &props);
|
||||
};
|
||||
struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> {
|
||||
using EaxCommitter<EaxEchoCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxEchoCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXECHOPROPERTIES &props);
|
||||
|
||||
@@ -189,7 +197,8 @@ struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> {
|
||||
static void Set(const EaxCall &call, EAXECHOPROPERTIES &props);
|
||||
};
|
||||
struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> {
|
||||
using EaxCommitter<EaxEqualizerCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxEqualizerCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXEQUALIZERPROPERTIES &props);
|
||||
|
||||
@@ -198,7 +207,8 @@ struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> {
|
||||
static void Set(const EaxCall &call, EAXEQUALIZERPROPERTIES &props);
|
||||
};
|
||||
struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> {
|
||||
using EaxCommitter<EaxFlangerCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxFlangerCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXFLANGERPROPERTIES &props);
|
||||
|
||||
@@ -207,7 +217,8 @@ struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> {
|
||||
static void Set(const EaxCall &call, EAXFLANGERPROPERTIES &props);
|
||||
};
|
||||
struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCommitter> {
|
||||
using EaxCommitter<EaxFrequencyShifterCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxFrequencyShifterCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXFREQUENCYSHIFTERPROPERTIES &props);
|
||||
|
||||
@@ -216,7 +227,8 @@ struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCom
|
||||
static void Set(const EaxCall &call, EAXFREQUENCYSHIFTERPROPERTIES &props);
|
||||
};
|
||||
struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> {
|
||||
using EaxCommitter<EaxModulatorCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxModulatorCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXRINGMODULATORPROPERTIES &props);
|
||||
|
||||
@@ -225,7 +237,8 @@ struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> {
|
||||
static void Set(const EaxCall &call, EAXRINGMODULATORPROPERTIES &props);
|
||||
};
|
||||
struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter> {
|
||||
using EaxCommitter<EaxPitchShifterCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxPitchShifterCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXPITCHSHIFTERPROPERTIES &props);
|
||||
|
||||
@@ -234,7 +247,8 @@ struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter>
|
||||
static void Set(const EaxCall &call, EAXPITCHSHIFTERPROPERTIES &props);
|
||||
};
|
||||
struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter> {
|
||||
using EaxCommitter<EaxVocalMorpherCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxVocalMorpherCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const EAXVOCALMORPHERPROPERTIES &props);
|
||||
|
||||
@@ -243,7 +257,8 @@ struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter>
|
||||
static void Set(const EaxCall &call, EAXVOCALMORPHERPROPERTIES &props);
|
||||
};
|
||||
struct EaxNullCommitter : public EaxCommitter<EaxNullCommitter> {
|
||||
using EaxCommitter<EaxNullCommitter>::EaxCommitter;
|
||||
template<typename ...Args>
|
||||
explicit EaxNullCommitter(Args&& ...args) : EaxCommitter{std::forward<Args>(args)...} { }
|
||||
|
||||
bool commit(const std::monostate &props);
|
||||
|
||||
@@ -279,7 +294,7 @@ public:
|
||||
~EaxEffect() = default;
|
||||
|
||||
ALenum al_effect_type_{AL_EFFECT_NULL};
|
||||
EffectProps al_effect_props_{};
|
||||
EffectProps al_effect_props_;
|
||||
|
||||
using Props1 = EAX_REVERBPROPERTIES;
|
||||
using Props2 = EAX20LISTENERPROPERTIES;
|
||||
@@ -308,7 +323,7 @@ public:
|
||||
|
||||
int version_{};
|
||||
bool changed_{};
|
||||
Props4 props_{};
|
||||
Props4 props_;
|
||||
State1 state1_{};
|
||||
State2 state2_{};
|
||||
State3 state3_{};
|
||||
|
||||
@@ -10,9 +10,14 @@ class EaxException : public std::runtime_error {
|
||||
static std::string make_message(std::string_view context, std::string_view message);
|
||||
|
||||
public:
|
||||
EaxException() = delete;
|
||||
EaxException(const EaxException&) = default;
|
||||
EaxException(EaxException&&) = default;
|
||||
EaxException(std::string_view context, std::string_view message);
|
||||
~EaxException() override;
|
||||
}; // EaxException
|
||||
|
||||
auto operator=(const EaxException&) -> EaxException& = default;
|
||||
auto operator=(EaxException&&) -> EaxException& = default;
|
||||
};
|
||||
|
||||
#endif // !EAX_EXCEPTION_INCLUDED
|
||||
#endif /* EAX_EXCEPTION_INCLUDED */
|
||||
|
||||
@@ -6,13 +6,10 @@
|
||||
|
||||
#include "al/auxeffectslot.h"
|
||||
|
||||
#include "api.h"
|
||||
#include "call.h"
|
||||
#include "fx_slot_index.h"
|
||||
|
||||
|
||||
class EaxFxSlots
|
||||
{
|
||||
class EaxFxSlots {
|
||||
public:
|
||||
void initialize(ALCcontext& al_context);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
|
||||
#include "alstring.h"
|
||||
#include "core/logging.h"
|
||||
|
||||
|
||||
@@ -18,9 +17,9 @@ void eax_log_exception(std::string_view message) noexcept
|
||||
std::rethrow_exception(exception_ptr);
|
||||
}
|
||||
catch(const std::exception& ex) {
|
||||
ERR("%.*s %s\n", al::sizei(message), message.data(), ex.what());
|
||||
ERR("{} {}", message, ex.what());
|
||||
}
|
||||
catch(...) {
|
||||
ERR("%.*s %s\n", al::sizei(message), message.data(), "Generic exception.");
|
||||
ERR("{} {}", message, "Generic exception.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
#ifndef EAX_UTILS_INCLUDED
|
||||
#define EAX_UTILS_INCLUDED
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
#include "fmt/core.h"
|
||||
#include "opthelpers.h"
|
||||
|
||||
using EaxDirtyFlags = unsigned int;
|
||||
|
||||
struct EaxAlLowPassParam {
|
||||
float gain;
|
||||
@@ -25,71 +21,9 @@ void eax_validate_range(std::string_view value_name, const TValue& value, const
|
||||
if(value >= min_value && value <= max_value) LIKELY
|
||||
return;
|
||||
|
||||
const auto message =
|
||||
std::string{value_name} +
|
||||
" out of range (value: " +
|
||||
std::to_string(value) + "; min: " +
|
||||
std::to_string(min_value) + "; max: " +
|
||||
std::to_string(max_value) + ").";
|
||||
|
||||
const auto message = fmt::format("{} out of range (value: {}; min: {}; max: {}).", value_name,
|
||||
value, min_value, max_value);
|
||||
throw TException{message.c_str()};
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
struct EaxIsBitFieldStruct {
|
||||
private:
|
||||
using yes = std::true_type;
|
||||
using no = std::false_type;
|
||||
|
||||
template<typename U>
|
||||
static auto test(int) -> decltype(std::declval<typename U::EaxIsBitFieldStruct>(), yes{});
|
||||
|
||||
template<typename>
|
||||
static no test(...);
|
||||
|
||||
public:
|
||||
static constexpr auto value = std::is_same<decltype(test<T>(0)), yes>::value;
|
||||
};
|
||||
|
||||
template<typename T, typename TValue>
|
||||
inline bool eax_bit_fields_are_equal(const T& lhs, const T& rhs) noexcept
|
||||
{
|
||||
static_assert(sizeof(T) == sizeof(TValue), "Invalid type size.");
|
||||
return reinterpret_cast<const TValue&>(lhs) == reinterpret_cast<const TValue&>(rhs);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<
|
||||
typename T,
|
||||
std::enable_if_t<detail::EaxIsBitFieldStruct<T>::value, int> = 0
|
||||
>
|
||||
inline bool operator==(const T& lhs, const T& rhs) noexcept
|
||||
{
|
||||
using Value = std::conditional_t<
|
||||
sizeof(T) == 1,
|
||||
std::uint8_t,
|
||||
std::conditional_t<
|
||||
sizeof(T) == 2,
|
||||
std::uint16_t,
|
||||
std::conditional_t<
|
||||
sizeof(T) == 4,
|
||||
std::uint32_t,
|
||||
void>>>;
|
||||
|
||||
static_assert(!std::is_same<Value, void>::value, "Unsupported type.");
|
||||
return detail::eax_bit_fields_are_equal<T, Value>(lhs, rhs);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
std::enable_if_t<detail::EaxIsBitFieldStruct<T>::value, int> = 0
|
||||
>
|
||||
inline bool operator!=(const T& lhs, const T& rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
#endif // !EAX_UTILS_INCLUDED
|
||||
|
||||
@@ -24,12 +24,7 @@ constexpr auto AL_STORAGE_AUTOMATIC_NAME = "AL_STORAGE_AUTOMATIC";
|
||||
constexpr auto AL_STORAGE_HARDWARE_NAME = "AL_STORAGE_HARDWARE";
|
||||
constexpr auto AL_STORAGE_ACCESSIBLE_NAME = "AL_STORAGE_ACCESSIBLE";
|
||||
|
||||
/* NOLINTBEGIN(readability-inconsistent-declaration-parameter-name)
|
||||
* These functions are defined using macros to forward them in a generic way to
|
||||
* implementation functions, which gives the parameters generic names.
|
||||
*/
|
||||
ALboolean AL_APIENTRY EAXSetBufferMode(ALsizei n, const ALuint *buffers, ALint value) noexcept;
|
||||
ALenum AL_APIENTRY EAXGetBufferMode(ALuint buffer, ALint *pReserved) noexcept;
|
||||
/* NOLINTEND(readability-inconsistent-declaration-parameter-name) */
|
||||
|
||||
#endif // !EAX_X_RAM_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user