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.

157 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. #include <QtCore/QMutex>
  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 init(const char* const, const char* const);
  40. virtual void close();
  41. #endif
  42. #ifdef BUILD_BRIDGE_UI
  43. // ---------------------------------------------------------------------
  44. // ui management
  45. virtual void* getWidget() const = 0;
  46. virtual bool isResizable() const = 0;
  47. virtual bool needsReparent() const = 0;
  48. #endif
  49. // ---------------------------------------------------------------------
  50. // processing
  51. virtual void setParameter(const int32_t rindex, const double value) = 0;
  52. virtual void setProgram(const uint32_t index) = 0;
  53. #ifdef BUILD_BRIDGE_PLUGIN
  54. virtual void setMidiProgram(const uint32_t index) = 0;
  55. #endif
  56. #ifdef BUILD_BRIDGE_UI
  57. virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
  58. #endif
  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. #ifdef BUILD_BRIDGE_PLUGIN
  62. // ---------------------------------------------------------------------
  63. // plugin
  64. virtual void saveNow() = 0;
  65. virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0;
  66. virtual void setChunkData(const char* const filePath) = 0;
  67. #endif
  68. // ---------------------------------------------------------------------
  69. // osc stuff
  70. bool oscInit(const char* const url);
  71. bool oscIdle();
  72. void oscClose();
  73. bool isOscControlRegistered() const;
  74. void sendOscUpdate();
  75. #ifdef BUILD_BRIDGE_PLUGIN
  76. void sendOscBridgeError(const char* const error);
  77. void registerOscEngine(CarlaBackend::CarlaEngine* const engine);
  78. #endif
  79. // ---------------------------------------------------------------------
  80. // toolkit
  81. void toolkitShow();
  82. void toolkitHide();
  83. void toolkitResize(int width, int height);
  84. void toolkitExec(const bool showGui);
  85. void toolkitQuit();
  86. // ---------------------------------------------------------------------
  87. protected:
  88. void sendOscConfigure(const char* const key, const char* const value);
  89. void sendOscControl(const int32_t index, const float value);
  90. void sendOscProgram(const int32_t index);
  91. void sendOscMidiProgram(const int32_t index);
  92. void sendOscMidi(const uint8_t midiBuf[4]);
  93. void sendOscExiting();
  94. #ifdef BUILD_BRIDGE_PLUGIN
  95. void sendOscBridgeUpdate();
  96. #endif
  97. #ifdef BRIDGE_LV2
  98. void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  99. void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf);
  100. #endif
  101. // ---------------------------------------------------------------------
  102. #ifdef BUILD_BRIDGE_UI
  103. void* getContainerId();
  104. bool uiLibOpen(const char* const filename);
  105. bool uiLibClose();
  106. void* uiLibSymbol(const char* const symbol);
  107. const char* uiLibError();
  108. #endif
  109. // ---------------------------------------------------------------------
  110. private:
  111. CarlaBridgeOsc m_osc;
  112. CarlaBridgeToolkit* const m_toolkit;
  113. const CarlaOscData* m_oscData;
  114. #ifdef BUILD_BRIDGE_UI
  115. char* m_uiFilename;
  116. void* m_uiLib;
  117. bool m_uiQuit;
  118. #endif
  119. };
  120. /**@}*/
  121. CARLA_BRIDGE_END_NAMESPACE
  122. #endif // CARLA_BRIDGE_CLIENT_HPP