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.

30 lines
756B

  1. #pragma once
  2. #include <vector>
  3. #include "display/controls.h"
  4. #include "range.h"
  5. #include "selector.h"
  6. #include "sigmoid.h"
  7. namespace DHE {
  8. namespace Duration {
  9. static constexpr auto short_range = Range{0.001f, 1.f};
  10. static constexpr auto medium_range = Range{0.01f, 10.f};
  11. static constexpr auto long_range = Range{0.1f, 100.f};
  12. static const auto ranges =
  13. std::vector<Range const *>{&short_range, &medium_range, &long_range};
  14. } // namespace Duration
  15. inline auto duration(float rotation, const Range &range) -> float {
  16. auto tapered = Sigmoid::j_taper(rotation, 0.8f);
  17. return range.scale(tapered);
  18. } // namespace Duration
  19. inline auto duration(float rotation) -> float {
  20. return duration(rotation, Duration::medium_range);
  21. }
  22. } // namespace DHE