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.3KB

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