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.

54 lines
1.4KB

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