🛠️🐜 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.

72 lines
2.0 KiB

  1. #include "config.h"
  2. #include <cmath>
  3. #include "AL/al.h"
  4. #include "AL/alext.h"
  5. #include "alc/effects/base.h"
  6. #include "effects.h"
  7. namespace {
  8. void Dedicated_setParami(EffectProps*, ALenum param, int)
  9. { throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
  10. void Dedicated_setParamiv(EffectProps*, ALenum param, const int*)
  11. {
  12. throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
  13. param};
  14. }
  15. void Dedicated_setParamf(EffectProps *props, ALenum param, float val)
  16. {
  17. switch(param)
  18. {
  19. case AL_DEDICATED_GAIN:
  20. if(!(val >= 0.0f && std::isfinite(val)))
  21. throw effect_exception{AL_INVALID_VALUE, "Dedicated gain out of range"};
  22. props->Dedicated.Gain = val;
  23. break;
  24. default:
  25. throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
  26. }
  27. }
  28. void Dedicated_setParamfv(EffectProps *props, ALenum param, const float *vals)
  29. { Dedicated_setParamf(props, param, vals[0]); }
  30. void Dedicated_getParami(const EffectProps*, ALenum param, int*)
  31. { throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
  32. void Dedicated_getParamiv(const EffectProps*, ALenum param, int*)
  33. {
  34. throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
  35. param};
  36. }
  37. void Dedicated_getParamf(const EffectProps *props, ALenum param, float *val)
  38. {
  39. switch(param)
  40. {
  41. case AL_DEDICATED_GAIN:
  42. *val = props->Dedicated.Gain;
  43. break;
  44. default:
  45. throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
  46. }
  47. }
  48. void Dedicated_getParamfv(const EffectProps *props, ALenum param, float *vals)
  49. { Dedicated_getParamf(props, param, vals); }
  50. EffectProps genDefaultProps() noexcept
  51. {
  52. EffectProps props{};
  53. props.Dedicated.Gain = 1.0f;
  54. return props;
  55. }
  56. } // namespace
  57. DEFINE_ALEFFECT_VTABLE(Dedicated);
  58. const EffectProps DedicatedEffectProps{genDefaultProps()};