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.

52 lines
1.1KB

  1. #include "common.hpp"
  2. using namespace rack;
  3. namespace rack_plugin_CastleRocktronics {
  4. struct Cubefader : Module {
  5. float z_1 = 0.0f;
  6. float z_2 = 0.0f;
  7. float aaFactor = 0.5f;
  8. enum Params { X_TRIMPOT, Y_TRIMPOT, Z_TRIMPOT, UNI_BI_TOGGLE, NUM_PARAMS };
  9. enum Inputs {
  10. INPUT_000,
  11. INPUT_100,
  12. INPUT_010,
  13. INPUT_110,
  14. INPUT_001,
  15. INPUT_101,
  16. INPUT_011,
  17. INPUT_111,
  18. X_CV,
  19. Y_CV,
  20. Z_CV,
  21. NUM_INPUTS
  22. };
  23. enum Outputs { OUTPUT, NUM_OUTPUTS };
  24. Cubefader() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, 0) {}
  25. void step() override;
  26. private:
  27. float linear(float x0, float x1, float xDist);
  28. float bilinear(float xy00, float xy10, float xy01, float xy11, float x,
  29. float y);
  30. float trilinear(float xyz000, float xyz100, float xyz010, float xyz110,
  31. float xyz001, float xyz101, float xyz011, float xyz111,
  32. float x, float y, float z);
  33. float antiAlias(float input);
  34. float rescaleInputUniPolar(Input input, Param trim);
  35. float rescaleInputBiPolar(Input input, Param trim);
  36. };
  37. } // namespace rack_plugin_CastleRocktronics
  38. using namespace rack_plugin_CastleRocktronics;