2022-04-25 12:02:45 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2022-07-14 23:17:11 +08:00
|
|
|
#include "fx_slot_index.h"
|
2022-04-25 12:02:45 +08:00
|
|
|
|
2022-07-14 23:17:11 +08:00
|
|
|
#include "exception.h"
|
2022-04-25 12:02:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
class EaxFxSlotIndexException :
|
|
|
|
public EaxException
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit EaxFxSlotIndexException(
|
|
|
|
const char* message)
|
|
|
|
:
|
|
|
|
EaxException{"EAX_FX_SLOT_INDEX", message}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}; // EaxFxSlotIndexException
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|
|
void EaxFxSlotIndex::set(EaxFxSlotIndexValue index)
|
|
|
|
{
|
|
|
|
if(index >= EaxFxSlotIndexValue{EAX_MAX_FXSLOTS})
|
|
|
|
fail("Index out of range.");
|
|
|
|
|
|
|
|
emplace(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EaxFxSlotIndex::set(const GUID &guid)
|
|
|
|
{
|
|
|
|
if (false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (guid == EAX_NULL_GUID)
|
|
|
|
{
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
else if (guid == EAXPROPERTYID_EAX40_FXSlot0 || guid == EAXPROPERTYID_EAX50_FXSlot0)
|
|
|
|
{
|
|
|
|
emplace(0u);
|
|
|
|
}
|
|
|
|
else if (guid == EAXPROPERTYID_EAX40_FXSlot1 || guid == EAXPROPERTYID_EAX50_FXSlot1)
|
|
|
|
{
|
|
|
|
emplace(1u);
|
|
|
|
}
|
|
|
|
else if (guid == EAXPROPERTYID_EAX40_FXSlot2 || guid == EAXPROPERTYID_EAX50_FXSlot2)
|
|
|
|
{
|
|
|
|
emplace(2u);
|
|
|
|
}
|
|
|
|
else if (guid == EAXPROPERTYID_EAX40_FXSlot3 || guid == EAXPROPERTYID_EAX50_FXSlot3)
|
|
|
|
{
|
|
|
|
emplace(3u);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fail("Unsupported GUID.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[[noreturn]]
|
|
|
|
void EaxFxSlotIndex::fail(const char* message)
|
|
|
|
{
|
|
|
|
throw EaxFxSlotIndexException{message};
|
|
|
|
}
|