aboutsummaryrefslogtreecommitdiffstats
path: root/al/state.cpp
diff options
context:
space:
mode:
authorBoris I. Bendovsky <[email protected]>2022-01-30 14:47:32 +0200
committerGitHub <[email protected]>2022-01-30 04:47:32 -0800
commit19ed994dc30ed84ea7cbbb5152577669fc25caf6 (patch)
treef68933bf8f778806618bd6c0b1bf9ced1b0ccf08 /al/state.cpp
parent619249371a40f03cf988d1f5750d643df797c485 (diff)
Add EAX extensions (EAX 2.0-5.0, X-RAM) (#632)
* Add EAX extensions (EAX 2.0-5.0, X-RAM) * Comment out C++17 leftovers * Remove everything related to patching * Update alsoftrc.sample * Rewrite integration * Fix GCC compilation under Linux * Always reset EAX effect properties when loading it into FX slot
Diffstat (limited to 'al/state.cpp')
-rw-r--r--al/state.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/al/state.cpp b/al/state.cpp
index 10c7bc74..0ec0e280 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -46,6 +46,13 @@
#include "opthelpers.h"
#include "strutils.h"
+#if ALSOFT_EAX
+#include "alc/device.h"
+
+#include "eax_globals.h"
+#include "eax_x_ram.h"
+#endif // ALSOFT_EAX
+
namespace {
@@ -427,6 +434,41 @@ START_API_FUNC
value = static_cast<int>(ResamplerDefault);
break;
+#if ALSOFT_EAX
+
+#define EAX_ERROR "[alGetInteger] EAX not enabled."
+
+ case AL_EAX_RAM_SIZE:
+ if (eax_g_is_enabled)
+ {
+ value = eax_x_ram_max_size;
+ }
+ else
+ {
+ context->setError(AL_INVALID_VALUE, EAX_ERROR);
+ }
+
+ break;
+
+ case AL_EAX_RAM_FREE:
+ if (eax_g_is_enabled)
+ {
+ auto device = context->mALDevice.get();
+ std::lock_guard<std::mutex> device_lock{device->BufferLock};
+
+ value = device->eax_x_ram_free_size;
+ }
+ else
+ {
+ context->setError(AL_INVALID_VALUE, EAX_ERROR);
+ }
+
+ break;
+
+#undef EAX_ERROR
+
+#endif // ALSOFT_EAX
+
default:
context->setError(AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname);
}