Audio plugin host https://kx.studio/carla
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.

84 lines
2.8KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. MiddleWare.h - RT & Non-RT Glue Layer
  4. Copyright (C) 2016 Mark McCurry
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. */
  10. #pragma once
  11. #include <functional>
  12. #include <cstdarg>
  13. #include <string>
  14. struct SYNTH_T;
  15. class Master;
  16. class PresetsStore;
  17. //Link between realtime and non-realtime layers
  18. class MiddleWare
  19. {
  20. public:
  21. MiddleWare(SYNTH_T synth, class CarlaConfig *config,
  22. int preferred_port = -1);
  23. ~MiddleWare(void);
  24. void updateResources(Master *m);
  25. //returns internal master pointer
  26. class Master *spawnMaster(void);
  27. //Enable AutoSave Functionality
  28. void enableAutoSave(int interval_sec=60);
  29. //Check for old automatic saves which should only exist if multiple
  30. //instances are in use OR when there was a crash
  31. //
  32. //When an old save is found return the id of the save file
  33. int checkAutoSave(void);
  34. void removeAutoSave(void);
  35. //return UI interface
  36. class Fl_Osc_Interface *spawnUiApi(void);
  37. //Set callback to push UI events to
  38. void setUiCallback(void(*cb)(void*,const char *),void *ui);
  39. //Set callback to run while busy
  40. void setIdleCallback(void(*cb)(void*),void *ptr);
  41. //Handle events
  42. void tick(void);
  43. //Do A Readonly Operation (For Parameter Copy)
  44. void doReadOnlyOp(std::function<void()>);
  45. //Handle a rtosc Message uToB
  46. void transmitMsg(const char *);
  47. //Handle a rtosc Message uToB
  48. void transmitMsg(const char *, const char *args, ...);
  49. //Handle a rtosc Message uToB
  50. void transmitMsg_va(const char *, const char *args, va_list va);
  51. //Send a message to middleware from an arbitrary thread
  52. void messageAnywhere(const char *msg, const char *args, ...);
  53. //Indicate that a bank will be loaded
  54. //NOTE: Can only be called by realtime thread
  55. void pendingSetBank(int bank);
  56. //Indicate that a program will be loaded on a known part
  57. //NOTE: Can only be called by realtime thread
  58. void pendingSetProgram(int part, int program);
  59. //Get/Set the active bToU url
  60. std::string activeUrl(void);
  61. void activeUrl(std::string u);
  62. //View Synthesis Parameters
  63. const SYNTH_T &getSynth(void) const;
  64. //liblo stuff
  65. const char* getServerAddress(void) const;
  66. const PresetsStore& getPresetsStore() const;
  67. PresetsStore& getPresetsStore();
  68. private:
  69. class CarlaMiddleWareImpl *impl;
  70. };