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.

CarlaBridgeClient.hpp 4.7KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * Carla Bridge Client
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the GPL.txt file
  16. */
  17. #ifndef __CARLA_BRIDGE_CLIENT_HPP__
  18. #define __CARLA_BRIDGE_CLIENT_HPP__
  19. #include "CarlaBridgeOsc.hpp"
  20. #include "CarlaBridgeToolkit.hpp"
  21. CARLA_BRIDGE_START_NAMESPACE
  22. #if 0
  23. } // Fix editor indentation
  24. #endif
  25. /*!
  26. * @defgroup CarlaBridgeClient Carla Bridge Client
  27. *
  28. * The Carla Bridge Client.
  29. * @{
  30. */
  31. class CarlaBridgeClient
  32. {
  33. public:
  34. CarlaBridgeClient(const char* const uiTitle);
  35. virtual ~CarlaBridgeClient();
  36. #ifdef BUILD_BRIDGE_UI
  37. // ---------------------------------------------------------------------
  38. // ui initialization
  39. virtual bool uiInit(const char* const, const char* const);
  40. virtual void uiClose();
  41. // ---------------------------------------------------------------------
  42. // ui management
  43. virtual void* getWidget() const = 0;
  44. virtual bool isResizable() const = 0;
  45. virtual bool needsReparent() const = 0;
  46. #endif
  47. #ifdef BUILD_BRIDGE_PLUGIN
  48. // ---------------------------------------------------------------------
  49. // plugin management
  50. virtual void saveNow() = 0;
  51. virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0;
  52. virtual void setChunkData(const char* const filePath) = 0;
  53. #endif
  54. // ---------------------------------------------------------------------
  55. // processing
  56. virtual void setParameter(const int32_t rindex, const float value) = 0;
  57. #ifndef BUILD_BRIDGE_PLUGIN
  58. virtual void setProgram(const uint32_t index) = 0;
  59. virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
  60. virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0;
  61. virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;
  62. #endif
  63. // ---------------------------------------------------------------------
  64. // osc stuff
  65. void oscInit(const char* const url);
  66. bool oscIdle();
  67. void oscClose();
  68. bool isOscControlRegistered() const;
  69. void sendOscUpdate();
  70. #ifdef BUILD_BRIDGE_PLUGIN
  71. void sendOscBridgeUpdate();
  72. void sendOscBridgeError(const char* const error);
  73. #endif
  74. #ifdef BUILD_BRIDGE_UI
  75. // ---------------------------------------------------------------------
  76. // toolkit
  77. void toolkitShow();
  78. void toolkitHide();
  79. void toolkitResize(const int width, const int height);
  80. void toolkitExec(const bool showGui);
  81. void toolkitQuit();
  82. #endif
  83. // ---------------------------------------------------------------------
  84. protected:
  85. void sendOscConfigure(const char* const key, const char* const value);
  86. void sendOscControl(const int32_t index, const float value);
  87. void sendOscProgram(const int32_t index);
  88. void sendOscMidiProgram(const int32_t index);
  89. void sendOscMidi(const uint8_t midiBuf[4]);
  90. void sendOscExiting();
  91. #ifdef BRIDGE_LV2
  92. void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf);
  93. void sendOscLv2UridMap(const uint32_t urid, const char* const uri);
  94. #endif
  95. // ---------------------------------------------------------------------
  96. #ifdef BUILD_BRIDGE_UI
  97. void* getContainerId();
  98. bool uiLibOpen(const char* const filename);
  99. bool uiLibClose();
  100. void* uiLibSymbol(const char* const symbol);
  101. const char* uiLibError();
  102. #endif
  103. // ---------------------------------------------------------------------
  104. private:
  105. CarlaBridgeOsc kOsc;
  106. #ifdef BUILD_BRIDGE_UI
  107. struct UI {
  108. CarlaBridgeToolkit* const toolkit;
  109. CarlaString filename;
  110. void* lib;
  111. bool quit;
  112. UI(CarlaBridgeToolkit* const toolkit_)
  113. : toolkit(toolkit_),
  114. lib(nullptr),
  115. quit(false) {}
  116. ~UI()
  117. {
  118. delete toolkit;
  119. }
  120. void init()
  121. {
  122. toolkit->init();
  123. quit = false;
  124. }
  125. void close()
  126. {
  127. quit = true;
  128. toolkit->quit();
  129. }
  130. } fUI;
  131. #else
  132. friend class CarlaPluginClient;
  133. #endif
  134. const CarlaOscData* fOscData;
  135. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeClient)
  136. };
  137. /**@}*/
  138. CARLA_BRIDGE_END_NAMESPACE
  139. #endif // __CARLA_BRIDGE_CLIENT_HPP__