Check some float property values for being finite
[openal-soft.git] / al / eax / fx_slots.cpp
blobd04b70df3fa42de0d883a5b6f8e19b1ce2f42fab
1 #include "config.h"
3 #include "fx_slots.h"
5 #include <array>
7 #include "api.h"
8 #include "exception.h"
11 namespace
15 class EaxFxSlotsException :
16 public EaxException
18 public:
19 explicit EaxFxSlotsException(
20 const char* message)
22 EaxException{"EAX_FX_SLOTS", message}
25 }; // EaxFxSlotsException
28 } // namespace
31 void EaxFxSlots::initialize(ALCcontext& al_context)
33 initialize_fx_slots(al_context);
36 void EaxFxSlots::uninitialize() noexcept
38 for (auto& fx_slot : fx_slots_)
40 fx_slot = nullptr;
44 const ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index) const
46 if(!index.has_value())
47 fail("Empty index.");
48 return *fx_slots_[index.value()];
51 ALeffectslot& EaxFxSlots::get(EaxFxSlotIndex index)
53 if(!index.has_value())
54 fail("Empty index.");
55 return *fx_slots_[index.value()];
58 [[noreturn]]
59 void EaxFxSlots::fail(
60 const char* message)
62 throw EaxFxSlotsException{message};
65 void EaxFxSlots::initialize_fx_slots(ALCcontext& al_context)
67 auto fx_slot_index = EaxFxSlotIndexValue{};
69 for (auto& fx_slot : fx_slots_)
71 fx_slot = eax_create_al_effect_slot(al_context);
72 fx_slot->eax_initialize(al_context, fx_slot_index);
73 fx_slot_index += 1;