Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore EAX effects through OpenAL's EFX. #1000

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Plasma/Apps/plClient/plClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ void plClient::IDetectAudioVideoSettings()
} else {
stream = plEncryptedStream::OpenEncryptedFileWrite(audioIniFile);
WriteBool(stream, "Audio.Initialize", true);
WriteBool(stream, "Audio.UseEAX", false);
WriteBool(stream, "Audio.UseEAX", true);
WriteInt(stream, "Audio.SetPriorityCutoff", 6);
WriteInt(stream, "Audio.MuteAll", false);
WriteInt(stream, "Audio.SetChannelVolume SoundFX", 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ PF_CONSOLE_CMD(Audio, Enable, "bool on", "Switch Audio on or off at runtime")
plgAudioSys::Activate( on );
}

PF_CONSOLE_CMD(Audio, UseEAX, "bool on", "Enable EAX sound acceleration (requires hardware acceleration)")
PF_CONSOLE_CMD(Audio, UseEAX, "bool on", "Enable EFX environmental sound")
{
bool on = params[0];
plgAudioSys::EnableEAX( on );
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void pyAudioControl::SetTwoStageLOD(bool state)
plSound::SetLoadFromDiskOnDemand(!state);
}

// Enable EAX sound acceleration (requires hardware acceleration)
// Enable EFX environmental sound
void pyAudioControl::UseEAXAcceleration(bool state)
{
plgAudioSys::EnableEAX(state);
Expand Down
6 changes: 3 additions & 3 deletions Sources/Plasma/FeatureLib/pfPython/pyAudioControlGlue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ PYTHON_START_METHODS_TABLE(ptAudioControl)
PYTHON_METHOD(ptAudioControl, setLoadOnDemand, "Params: state\nEnables or disables the load on demand for sounds."),
PYTHON_METHOD(ptAudioControl, setTwoStageLOD, "Params: state\nEnables or disables two-stage LOD, where sounds can be loaded into RAM but not into sound buffers.\n"
"...Less of a performance hit, harder on memory."),
PYTHON_METHOD(ptAudioControl, useEAXAcceleration, "Params: state\nEnables or disables EAX sound acceleration (requires hardware acceleration)."),
PYTHON_METHOD_NOARGS(ptAudioControl, isUsingEAXAcceleration, "Is EAX sound acceleration enabled? Returns 1 if true otherwise returns 0."),
PYTHON_METHOD_NOARGS(ptAudioControl, isEAXSupported, "Is EAX acceleration supported by the current device?"),
PYTHON_METHOD(ptAudioControl, useEAXAcceleration, "Params: state\nEnables or disables EFX environmental sound."),
PYTHON_METHOD_NOARGS(ptAudioControl, isUsingEAXAcceleration, "Is EFX environmental sound enabled? Returns 1 if true otherwise returns 0."),
PYTHON_METHOD_NOARGS(ptAudioControl, isEAXSupported, "Is EFX environmental sound supported by the current device?"),
PYTHON_BASIC_METHOD(ptAudioControl, muteAll, "Mutes all sounds."),
PYTHON_BASIC_METHOD(ptAudioControl, unmuteAll, "Unmutes all sounds."),
PYTHON_METHOD_NOARGS(ptAudioControl, isMuted, "Are all sounds muted? Returns 1 if true otherwise returns 0."),
Expand Down
3 changes: 3 additions & 0 deletions Sources/Plasma/PubUtilLib/plAudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ target_link_libraries(plAudio
pnFactory
)

target_compile_definitions(plAudio
PRIVATE AL_ALEXT_PROTOTYPES)

source_group("Source Files" FILES ${plAudio_SOURCES})
source_group("Header Files" FILES ${plAudio_HEADERS})
16 changes: 7 additions & 9 deletions Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include "HeadSpin.h"
#include <al.h>
#include <efx.h>
#ifdef EAX_SDK_AVAILABLE
#include <eax.h>
#endif
#include <memory>
#include <array>

Expand Down Expand Up @@ -74,7 +71,7 @@ You can contact Cyan Worlds, Inc. by email [email protected]
ST::string kDefaultDeviceMagic = ST_LITERAL("(Default Device)");

#define FADE_TIME 3
#define MAX_NUM_SOURCES 128
#define MAX_NUM_SOURCES 256
#define UPDATE_TIME_MS 100

plProfile_CreateTimer("EAX Update", "Sound", SoundEAXUpdate);
Expand Down Expand Up @@ -304,6 +301,7 @@ bool plAudioSystem::Init()
plStatusLog::AddLineSF("audio.log", "OpenAL version: {}", alGetString(AL_VERSION));
plStatusLog::AddLineSF("audio.log", "OpenAL renderer: {}", alGetString(AL_RENDERER));
plStatusLog::AddLineSF("audio.log", "OpenAL extensions: {}", alGetString(AL_EXTENSIONS));
plStatusLog::AddLineSF("audio.log", "OpenAL context extensions: {}", alcGetString(fPlaybackDevice, ALC_EXTENSIONS));
plStatusLog::AddLineS("audio.log", plStatusLog::kGreen, "ASYS: Detecting caps...");

// Detect maximum number of voices that can be created.
Expand All @@ -323,15 +321,15 @@ bool plAudioSystem::Init()
plStatusLog::AddLineSF("audio.log", "Max Number of sources: {}", fMaxNumSources);
SetMaxNumberOfActiveSounds();

// TODO: Detect EAX support. Not adding this in now until the replacement is implemented.
// TODO: Detect EFX support.

// attempt to init the EAX listener.
// attempt to init the EFX listener.
if (plgAudioSys::fEnableEAX) {
fUsingEAX = plEAXListener::GetInstance().Init();
fUsingEAX = plEAXListener::GetInstance().Init(fPlaybackDevice);
if (fUsingEAX)
plStatusLog::AddLineS("audio.log", plStatusLog::kGreen, "ASYS: EAX support detected and enabled.");
plStatusLog::AddLineS("audio.log", plStatusLog::kGreen, "ASYS: EFX support detected and enabled.");
else
plStatusLog::AddLineS("audio.log", plStatusLog::kRed, "ASYS: EAX support NOT detected. EAX effects disabled.");
plStatusLog::AddLineS("audio.log", plStatusLog::kRed, "ASYS: EFX support NOT detected. EAX effects disabled.");
} else {
fUsingEAX = false;
}
Expand Down
3 changes: 0 additions & 3 deletions Sources/Plasma/PubUtilLib/plAudio/plAudioSystem_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include <al.h>
#include <alc.h>
#include <efx.h>
#ifdef EAX_SDK_AVAILABLE
#include <eax.h>
#endif
#include <memory>
#include <set>

Expand Down
4 changes: 2 additions & 2 deletions Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include "HeadSpin.h"
#include "hsThread.h"
#include "plDSoundBuffer.h"
#include <al.h>

#include "plgDispatch.h"
#include "plAudioSystem.h"
Expand All @@ -59,9 +58,10 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include "plEAXEffects.h"

#include "plProfile.h"

#include "plStatusLog/plStatusLog.h"

#include <al.h>

uint32_t plDSoundBuffer::fNumBuffers = 0;
plProfile_CreateCounterNoReset( "Playing", "Sound", SoundPlaying );
plProfile_CreateCounterNoReset( "Allocated", "Sound", NumAllocated );
Expand Down
8 changes: 3 additions & 5 deletions Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ You can contact Cyan Worlds, Inc. by email [email protected]
Mead, WA 99021

*==LICENSE==*/

//////////////////////////////////////////////////////////////////////////////
// //
// plDSoundBuffer - Simple wrapper class for a DirectSound buffer. //
Expand All @@ -56,15 +57,12 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#define STREAMING_BUFFERS 16
#define STREAM_BUFFER_SIZE 4608*4

//#define VOICE_BUFFERS 4
//#define VOICE_BUFFER_SIZE 4608

class plWAVHeader;
class plAudioFileReader;


// Ported to OpenAL from DirectSound May 2006. Idealy the openal sources would be seperate from this class.
// OpenAl sound buffer, and source.
// Ported to OpenAL from DirectSound May 2006. Ideally the OpenAL sources would be separate from this class.
// OpenAL sound buffer, and source.
class plDSoundBuffer
{
public:
Expand Down
Loading