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.

157 lines
4.4KB

  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. CARLA_BRIDGE_START_NAMESPACE
  21. #if 0
  22. } // Fix editor indentation
  23. #endif
  24. /*!
  25. * @defgroup CarlaBridgeClient Carla Bridge Client
  26. *
  27. * The Carla Bridge Client.
  28. * @{
  29. */
  30. class CarlaBridgeClient
  31. {
  32. public:
  33. CarlaBridgeClient(const char* const uiTitle);
  34. virtual ~CarlaBridgeClient();
  35. #ifdef BUILD_BRIDGE_UI
  36. // ---------------------------------------------------------------------
  37. // ui initialization
  38. virtual bool uiInit(const char* const, const char* const);
  39. virtual void uiClose();
  40. // ---------------------------------------------------------------------
  41. // ui management
  42. virtual void* getWidget() const = 0;
  43. virtual bool isResizable() const = 0;
  44. virtual bool needsReparent() const = 0;
  45. #endif
  46. #ifdef BUILD_BRIDGE_PLUGIN
  47. // ---------------------------------------------------------------------
  48. // plugin management
  49. virtual void saveNow() = 0;
  50. virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0;
  51. virtual void setChunkData(const char* const filePath) = 0;
  52. #endif
  53. // ---------------------------------------------------------------------
  54. // processing
  55. virtual void setParameter(const int32_t rindex, const float value) = 0;
  56. virtual void setProgram(const uint32_t index) = 0;
  57. #ifdef BUILD_BRIDGE_PLUGIN
  58. virtual void setMidiProgram(const uint32_t index) = 0;
  59. #else
  60. virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
  61. #endif
  62. virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0;
  63. virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;
  64. // ---------------------------------------------------------------------
  65. // osc stuff
  66. void oscInit(const char* const url);
  67. bool oscIdle();
  68. void oscClose();
  69. bool isOscControlRegistered() const;
  70. void sendOscUpdate();
  71. #ifdef BUILD_BRIDGE_PLUGIN
  72. void sendOscBridgeUpdate();
  73. void sendOscBridgeError(const char* const error);
  74. #endif
  75. #ifdef BUILD_BRIDGE_UI
  76. // ---------------------------------------------------------------------
  77. // toolkit
  78. void toolkitShow();
  79. void toolkitHide();
  80. void toolkitResize(const int width, const int height);
  81. void toolkitExec(const bool showGui);
  82. void toolkitQuit();
  83. #endif
  84. // ---------------------------------------------------------------------
  85. protected:
  86. void sendOscConfigure(const char* const key, const char* const value);
  87. void sendOscControl(const int32_t index, const float value);
  88. void sendOscProgram(const int32_t index);
  89. #ifdef BUILD_BRIDGE_PLUGIN
  90. void sendOscMidiProgram(const int32_t index);
  91. #endif
  92. void sendOscMidi(const uint8_t midiBuf[4]);
  93. void sendOscExiting();
  94. #ifdef BRIDGE_LV2
  95. void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  96. void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  97. #endif
  98. // ---------------------------------------------------------------------
  99. #ifdef BUILD_BRIDGE_UI
  100. void* getContainerId();
  101. bool uiLibOpen(const char* const filename);
  102. bool uiLibClose();
  103. void* uiLibSymbol(const char* const symbol);
  104. const char* uiLibError();
  105. #endif
  106. // ---------------------------------------------------------------------
  107. private:
  108. CarlaBridgeOsc kOsc;
  109. #ifdef BUILD_BRIDGE_UI
  110. CarlaBridgeToolkit* const kUiToolkit;
  111. const char* fUiFilename;
  112. void* fUiLib;
  113. bool fUiQuit;
  114. #else
  115. friend class CarlaPluginClient;
  116. #endif
  117. const CarlaOscData* fOscData;
  118. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeClient)
  119. };
  120. /**@}*/
  121. CARLA_BRIDGE_END_NAMESPACE
  122. #endif // __CARLA_BRIDGE_CLIENT_HPP__