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.4KB

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
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. #ifndef BUILD_BRIDGE_PLUGIN
  57. virtual void setProgram(const uint32_t index) = 0;
  58. virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
  59. virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0;
  60. virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;
  61. #endif
  62. // ---------------------------------------------------------------------
  63. // osc stuff
  64. void oscInit(const char* const url);
  65. bool oscIdle();
  66. void oscClose();
  67. bool isOscControlRegistered() const;
  68. void sendOscUpdate();
  69. #ifdef BUILD_BRIDGE_PLUGIN
  70. void sendOscBridgeUpdate();
  71. void sendOscBridgeError(const char* const error);
  72. #endif
  73. #ifdef BUILD_BRIDGE_UI
  74. // ---------------------------------------------------------------------
  75. // toolkit
  76. void toolkitShow();
  77. void toolkitHide();
  78. void toolkitResize(const int width, const int height);
  79. void toolkitExec(const bool showGui);
  80. void toolkitQuit();
  81. #endif
  82. // ---------------------------------------------------------------------
  83. protected:
  84. void sendOscConfigure(const char* const key, const char* const value);
  85. void sendOscControl(const int32_t index, const float value);
  86. void sendOscProgram(const int32_t index);
  87. #ifdef BUILD_BRIDGE_PLUGIN
  88. void sendOscMidiProgram(const int32_t index);
  89. #endif
  90. void sendOscMidi(const uint8_t midiBuf[4]);
  91. void sendOscExiting();
  92. #ifdef BRIDGE_LV2
  93. void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  94. void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  95. #endif
  96. // ---------------------------------------------------------------------
  97. #ifdef BUILD_BRIDGE_UI
  98. void* getContainerId();
  99. bool uiLibOpen(const char* const filename);
  100. bool uiLibClose();
  101. void* uiLibSymbol(const char* const symbol);
  102. const char* uiLibError();
  103. #endif
  104. // ---------------------------------------------------------------------
  105. private:
  106. CarlaBridgeOsc kOsc;
  107. #ifdef BUILD_BRIDGE_UI
  108. CarlaBridgeToolkit* const kUiToolkit;
  109. const char* fUiFilename;
  110. void* fUiLib;
  111. bool fUiQuit;
  112. #else
  113. friend class CarlaPluginClient;
  114. #endif
  115. const CarlaOscData* fOscData;
  116. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgeClient)
  117. };
  118. /**@}*/
  119. CARLA_BRIDGE_END_NAMESPACE
  120. #endif // __CARLA_BRIDGE_CLIENT_HPP__