🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

  1. #include "config.h"
  2. #include "eax_fx_slot_index.h"
  3. #include "eax_exception.h"
  4. namespace
  5. {
  6. class EaxFxSlotIndexException :
  7. public EaxException
  8. {
  9. public:
  10. explicit EaxFxSlotIndexException(
  11. const char* message)
  12. :
  13. EaxException{"EAX_FX_SLOT_INDEX", message}
  14. {
  15. }
  16. }; // EaxFxSlotIndexException
  17. } // namespace
  18. void EaxFxSlotIndex::set(EaxFxSlotIndexValue index)
  19. {
  20. if(index >= EaxFxSlotIndexValue{EAX_MAX_FXSLOTS})
  21. fail("Index out of range.");
  22. emplace(index);
  23. }
  24. void EaxFxSlotIndex::set(const GUID &guid)
  25. {
  26. if (false)
  27. {
  28. }
  29. else if (guid == EAX_NULL_GUID)
  30. {
  31. reset();
  32. }
  33. else if (guid == EAXPROPERTYID_EAX40_FXSlot0 || guid == EAXPROPERTYID_EAX50_FXSlot0)
  34. {
  35. emplace(0u);
  36. }
  37. else if (guid == EAXPROPERTYID_EAX40_FXSlot1 || guid == EAXPROPERTYID_EAX50_FXSlot1)
  38. {
  39. emplace(1u);
  40. }
  41. else if (guid == EAXPROPERTYID_EAX40_FXSlot2 || guid == EAXPROPERTYID_EAX50_FXSlot2)
  42. {
  43. emplace(2u);
  44. }
  45. else if (guid == EAXPROPERTYID_EAX40_FXSlot3 || guid == EAXPROPERTYID_EAX50_FXSlot3)
  46. {
  47. emplace(3u);
  48. }
  49. else
  50. {
  51. fail("Unsupported GUID.");
  52. }
  53. }
  54. [[noreturn]]
  55. void EaxFxSlotIndex::fail(const char* message)
  56. {
  57. throw EaxFxSlotIndexException{message};
  58. }