utils.h 712 B

1234567891011121314151617181920212223242526272829
  1. #ifndef EAX_UTILS_INCLUDED
  2. #define EAX_UTILS_INCLUDED
  3. #include <string_view>
  4. #include "fmt/core.h"
  5. #include "opthelpers.h"
  6. struct EaxAlLowPassParam {
  7. float gain;
  8. float gain_hf;
  9. };
  10. void eax_log_exception(std::string_view message) noexcept;
  11. template<typename TException, typename TValue>
  12. void eax_validate_range(std::string_view value_name, const TValue& value, const TValue& min_value,
  13. const TValue& max_value)
  14. {
  15. if(value >= min_value && value <= max_value) LIKELY
  16. return;
  17. const auto message = fmt::format("{} out of range (value: {}; min: {}; max: {}).", value_name,
  18. value, min_value, max_value);
  19. throw TException{message.c_str()};
  20. }
  21. #endif // !EAX_UTILS_INCLUDED