mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-29 09:00:59 +00:00
added libraries: opus flac libsndfile updated: libvorbis libogg openal - Everything works as expected for now. Bare in mind libsndfile needed the check for whether or not it could find the xiph libraries removed in order for this to work.
76 lines
1.3 KiB
C++
76 lines
1.3 KiB
C++
#include "config.h"
|
|
|
|
#include "fx_slots.h"
|
|
|
|
#include <array>
|
|
|
|
#include "api.h"
|
|
#include "exception.h"
|
|
|
|
|
|
namespace
|
|
{
|
|
|
|
|
|
class EaxFxSlotsException :
|
|
public EaxException
|
|
{
|
|
public:
|
|
explicit EaxFxSlotsException(
|
|
const char* message)
|
|
:
|
|
EaxException{"EAX_FX_SLOTS", message}
|
|
{
|
|
}
|
|
}; // EaxFxSlotsException
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
void EaxFxSlots::initialize(ALCcontext& al_context)
|
|
{
|
|
initialize_fx_slots(al_context);
|
|
}
|
|
|
|
void EaxFxSlots::uninitialize() noexcept
|
|
{
|
|
for (auto& fx_slot : fx_slots_)
|
|
{
|
|
fx_slot = nullptr;
|
|
}
|
|
}
|
|
|
|
const ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index) const
|
|
{
|
|
if(!index.has_value())
|
|
fail("Empty index.");
|
|
return *fx_slots_[index.value()];
|
|
}
|
|
|
|
ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index)
|
|
{
|
|
if(!index.has_value())
|
|
fail("Empty index.");
|
|
return *fx_slots_[index.value()];
|
|
}
|
|
|
|
[[noreturn]]
|
|
void EaxFxSlots::fail(
|
|
const char* message)
|
|
{
|
|
throw EaxFxSlotsException{message};
|
|
}
|
|
|
|
void EaxFxSlots::initialize_fx_slots(ALCcontext& al_context)
|
|
{
|
|
auto fx_slot_index = EaxFxSlotIndexValue{};
|
|
|
|
for (auto& fx_slot : fx_slots_)
|
|
{
|
|
fx_slot = eax_create_al_effect_slot(al_context);
|
|
fx_slot->eax_initialize(al_context, fx_slot_index);
|
|
fx_slot_index += 1;
|
|
}
|
|
}
|