Use virtual functions for the decoder
[openal-soft.git] / al / eax_fx_slot_index.cpp
blob9aa695ada518c76aa0202efedcf00d2952daa6e2
1 #include "config.h"
3 #include "eax_fx_slot_index.h"
5 #include "eax_exception.h"
8 namespace
12 class EaxFxSlotIndexException :
13 public EaxException
15 public:
16 explicit EaxFxSlotIndexException(
17 const char* message)
19 EaxException{"EAX_FX_SLOT_INDEX", message}
22 }; // EaxFxSlotIndexException
25 } // namespace
28 void EaxFxSlotIndex::set(EaxFxSlotIndexValue index)
30 if(index >= EaxFxSlotIndexValue{EAX_MAX_FXSLOTS})
31 fail("Index out of range.");
33 emplace(index);
36 void EaxFxSlotIndex::set(const GUID &guid)
38 if (false)
41 else if (guid == EAX_NULL_GUID)
43 reset();
45 else if (guid == EAXPROPERTYID_EAX40_FXSlot0 || guid == EAXPROPERTYID_EAX50_FXSlot0)
47 emplace(0u);
49 else if (guid == EAXPROPERTYID_EAX40_FXSlot1 || guid == EAXPROPERTYID_EAX50_FXSlot1)
51 emplace(1u);
53 else if (guid == EAXPROPERTYID_EAX40_FXSlot2 || guid == EAXPROPERTYID_EAX50_FXSlot2)
55 emplace(2u);
57 else if (guid == EAXPROPERTYID_EAX40_FXSlot3 || guid == EAXPROPERTYID_EAX50_FXSlot3)
59 emplace(3u);
61 else
63 fail("Unsupported GUID.");
67 [[noreturn]]
68 void EaxFxSlotIndex::fail(const char* message)
70 throw EaxFxSlotIndexException{message};