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.

69 lines
1.7KB

  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. struct Internal;
  10. Internal *internal;
  11. Engine();
  12. ~Engine();
  13. /** Starts engine thread. */
  14. void start();
  15. /** Stops engine thread. */
  16. void stop();
  17. void setThreadCount(int threadCount);
  18. int getThreadCount();
  19. void setPaused(bool paused);
  20. bool isPaused();
  21. void setSampleRate(float sampleRate);
  22. float getSampleRate();
  23. /** Returns the inverse of the current sample rate. */
  24. float getSampleTime();
  25. // Modules
  26. /** Adds a module to the rack engine.
  27. The module ID must not be taken by another module.
  28. If the module ID is -1, an ID is automatically assigned.
  29. Does not transfer pointer ownership.
  30. */
  31. void addModule(Module *module);
  32. void removeModule(Module *module);
  33. Module *getModule(int moduleId);
  34. void resetModule(Module *module);
  35. void randomizeModule(Module *module);
  36. void bypassModule(Module *module, bool bypass);
  37. // Cables
  38. /** Adds a cable to the rack engine.
  39. The cable ID must not be taken by another cable.
  40. If the cable ID is -1, an ID is automatically assigned.
  41. Does not transfer pointer ownership.
  42. */
  43. void addCable(Cable *cable);
  44. void removeCable(Cable *cable);
  45. // Params
  46. void setParam(Module *module, int paramId, float value);
  47. float getParam(Module *module, int paramId);
  48. void setSmoothParam(Module *module, int paramId, float value);
  49. float getSmoothParam(Module *module, int paramId);
  50. void setTouchedParam(Module *module, int paramId);
  51. void getTouchedParam(Module *&module, int &paramId);
  52. // ModuleHandles
  53. void addModuleHandle(ModuleHandle *moduleHandle);
  54. void removeModuleHandle(ModuleHandle *moduleHandle);
  55. };
  56. } // namespace engine
  57. } // namespace rack