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.

154 lines
4.3KB

  1. /*
  2. * Carla Bridge Client
  3. * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #ifndef CARLA_BRIDGE_CLIENT_HPP
  18. #define CARLA_BRIDGE_CLIENT_HPP
  19. #include "carla_bridge_osc.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 init(const char* const, const char* const);
  39. virtual void close();
  40. #endif
  41. #ifdef BUILD_BRIDGE_UI
  42. // ---------------------------------------------------------------------
  43. // ui management
  44. virtual void* getWidget() const = 0;
  45. virtual bool isResizable() const = 0;
  46. virtual bool needsReparent() const = 0;
  47. #endif
  48. // ---------------------------------------------------------------------
  49. // processing
  50. virtual void setParameter(const int32_t rindex, const float value) = 0;
  51. virtual void setProgram(const uint32_t index) = 0;
  52. #ifdef BUILD_BRIDGE_PLUGIN
  53. virtual void setMidiProgram(const uint32_t index) = 0;
  54. #endif
  55. #ifdef BUILD_BRIDGE_UI
  56. virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
  57. #endif
  58. virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0;
  59. virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;
  60. #ifdef BUILD_BRIDGE_PLUGIN
  61. // ---------------------------------------------------------------------
  62. // plugin
  63. virtual void saveNow() = 0;
  64. virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0;
  65. virtual void setChunkData(const char* const filePath) = 0;
  66. #endif
  67. // ---------------------------------------------------------------------
  68. // osc stuff
  69. bool oscInit(const char* const url);
  70. bool oscIdle();
  71. void oscClose();
  72. bool isOscControlRegistered() const;
  73. void sendOscUpdate();
  74. #ifdef BUILD_BRIDGE_PLUGIN
  75. void sendOscBridgeUpdate();
  76. void sendOscBridgeError(const char* const error);
  77. #endif
  78. // ---------------------------------------------------------------------
  79. // toolkit
  80. void toolkitShow();
  81. void toolkitHide();
  82. void toolkitResize(const int width, const int height);
  83. void toolkitExec(const bool showGui);
  84. void toolkitQuit();
  85. // ---------------------------------------------------------------------
  86. protected:
  87. void sendOscConfigure(const char* const key, const char* const value);
  88. void sendOscControl(const int32_t index, const float value);
  89. void sendOscProgram(const int32_t index);
  90. void sendOscMidiProgram(const int32_t index);
  91. void sendOscMidi(const uint8_t midiBuf[4]);
  92. void sendOscExiting();
  93. #ifdef BRIDGE_LV2
  94. void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  95. void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  96. #endif
  97. // ---------------------------------------------------------------------
  98. void* getContainerId();
  99. #ifdef BUILD_BRIDGE_UI
  100. bool uiLibOpen(const char* const filename);
  101. bool uiLibClose();
  102. void* uiLibSymbol(const char* const symbol);
  103. const char* uiLibError();
  104. #endif
  105. // ---------------------------------------------------------------------
  106. private:
  107. CarlaBridgeOsc m_osc;
  108. CarlaBridgeToolkit* const m_toolkit;
  109. const CarlaOscData* m_oscData;
  110. #ifdef BUILD_BRIDGE_UI
  111. char* m_uiFilename;
  112. void* m_uiLib;
  113. bool m_uiQuit;
  114. #else
  115. friend class CarlaPluginClient;
  116. #endif
  117. };
  118. /**@}*/
  119. CARLA_BRIDGE_END_NAMESPACE
  120. #endif // CARLA_BRIDGE_CLIENT_HPP