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.

51 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. 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. void bypassModule(Module *module, bool bypass);
  28. /** Does not transfer pointer ownership */
  29. void addCable(Cable *cable);
  30. void removeCable(Cable *cable);
  31. void setParam(Module *module, int paramId, float value);
  32. float getParam(Module *module, int paramId);
  33. void setSmoothParam(Module *module, int paramId, float value);
  34. float getSmoothParam(Module *module, int paramId);
  35. int getNextModuleId();
  36. void setSampleRate(float sampleRate);
  37. float getSampleRate();
  38. /** Returns the inverse of the current sample rate */
  39. float getSampleTime();
  40. };
  41. } // namespace rack