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.

48 lines
1.2KB

  1. #pragma once
  2. #include "common.hpp"
  3. #include "engine/Module.hpp"
  4. #include "engine/Wire.hpp"
  5. #include <vector>
  6. namespace rack {
  7. struct Engine {
  8. /** Plugins should not manipulate other modules or wires unless that is the entire purpose of the module.
  9. Your plugin needs to have a clear purpose for manipulating other modules and wires and must be done with a good UX.
  10. */
  11. std::vector<Module*> modules;
  12. std::vector<Wire*> wires;
  13. bool paused = false;
  14. struct Internal;
  15. Internal *internal;
  16. Engine();
  17. ~Engine();
  18. /** Starts engine thread */
  19. void start();
  20. /** Stops engine thread */
  21. void stop();
  22. /** Does not transfer pointer ownership */
  23. void addModule(Module *module);
  24. void removeModule(Module *module);
  25. void resetModule(Module *module);
  26. void randomizeModule(Module *module);
  27. /** Does not transfer pointer ownership */
  28. void addWire(Wire *wire);
  29. void removeWire(Wire *wire);
  30. void setParam(Module *module, int paramId, float value);
  31. void setParamSmooth(Module *module, int paramId, float value);
  32. int getNextModuleId();
  33. void setSampleRate(float sampleRate);
  34. float getSampleRate();
  35. /** Returns the inverse of the current sample rate */
  36. float getSampleTime();
  37. };
  38. } // namespace rack