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.

MiddleWare.h 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. class Fl_Osc_Interface;
  15. namespace zyncarla {
  16. struct SYNTH_T;
  17. class Master;
  18. class PresetsStore;
  19. //Link between realtime and non-realtime layers
  20. class MiddleWare
  21. {
  22. public:
  23. MiddleWare(SYNTH_T synth, class Config *config,
  24. int preferred_port = -1);
  25. ~MiddleWare(void);
  26. void updateResources(Master *m);
  27. //returns internal master pointer
  28. class Master *spawnMaster(void);
  29. //Enable AutoSave Functionality
  30. void enableAutoSave(int interval_sec=60);
  31. //Check for old automatic saves which should only exist if multiple
  32. //instances are in use OR when there was a crash
  33. //
  34. //When an old save is found return the id of the save file
  35. int checkAutoSave(void);
  36. void removeAutoSave(void);
  37. //return UI interface
  38. Fl_Osc_Interface *spawnUiApi(void);
  39. //Set callback to push UI events to
  40. void setUiCallback(void(*cb)(void*,const char *),void *ui);
  41. //Set callback to run while busy
  42. void setIdleCallback(void(*cb)(void*),void *ptr);
  43. //Handle events
  44. void tick(void);
  45. //Do A Readonly Operation (For Parameter Copy)
  46. void doReadOnlyOp(std::function<void()>);
  47. //Handle a rtosc Message uToB
  48. void transmitMsg(const char *);
  49. //Handle a rtosc Message uToB
  50. void transmitMsg(const char *, const char *args, ...);
  51. //Handle a rtosc Message uToB
  52. void transmitMsg_va(const char *, const char *args, va_list va);
  53. //Send a message to middleware from an arbitrary thread
  54. void messageAnywhere(const char *msg, const char *args, ...);
  55. //Indicate that a bank will be loaded
  56. //NOTE: Can only be called by realtime thread
  57. void pendingSetBank(int bank);
  58. //Indicate that a program will be loaded on a known part
  59. //NOTE: Can only be called by realtime thread
  60. void pendingSetProgram(int part, int program);
  61. //Get/Set the active bToU url
  62. std::string activeUrl(void);
  63. void activeUrl(std::string u);
  64. //View Synthesis Parameters
  65. const SYNTH_T &getSynth(void) const;
  66. //liblo stuff
  67. const char* getServerAddress(void) const;
  68. const PresetsStore& getPresetsStore() const;
  69. PresetsStore& getPresetsStore();
  70. private:
  71. class MiddleWareImpl *impl;
  72. };
  73. }