Collection of tools useful for audio production
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.

161 lines
4.4KB

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