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.

180 lines
8.3KB

  1. /*
  2. * Carla Bridge definitions
  3. * Copyright (C) 2013-2023 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 doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_BRIDGE_DEFINES_HPP_INCLUDED
  18. #define CARLA_BRIDGE_DEFINES_HPP_INCLUDED
  19. #include "CarlaDefines.h"
  20. // how much backwards compatible we are
  21. #define CARLA_PLUGIN_BRIDGE_API_VERSION_MINIMUM 6
  22. // current API version, bumped when something is added
  23. #define CARLA_PLUGIN_BRIDGE_API_VERSION_CURRENT 10
  24. // -------------------------------------------------------------------------------------------------------------------
  25. #ifdef CARLA_PROPER_CPP11_SUPPORT
  26. # include <cstdint>
  27. #else
  28. # include <stdint.h>
  29. #endif
  30. // -------------------------------------------------------------------------------------------------------------------
  31. // Server sends these to client during RT
  32. enum PluginBridgeRtClientOpcode {
  33. kPluginBridgeRtClientNull = 0,
  34. kPluginBridgeRtClientSetAudioPool, // ulong/ptr
  35. kPluginBridgeRtClientSetBufferSize, // uint
  36. kPluginBridgeRtClientSetSampleRate, // double
  37. kPluginBridgeRtClientSetOnline, // bool
  38. kPluginBridgeRtClientControlEventParameter, // uint/frame, byte/chan, ushort, float
  39. kPluginBridgeRtClientControlEventMidiBank, // uint/frame, byte/chan, ushort
  40. kPluginBridgeRtClientControlEventMidiProgram, // uint/frame, byte/chan, ushort
  41. kPluginBridgeRtClientControlEventAllSoundOff, // uint/frame, byte/chan
  42. kPluginBridgeRtClientControlEventAllNotesOff, // uint/frame, byte/chan
  43. kPluginBridgeRtClientMidiEvent, // uint/frame, byte/port, byte/size, byte[]/data
  44. kPluginBridgeRtClientProcess, // uint/frames
  45. kPluginBridgeRtClientQuit
  46. };
  47. // Server sends these to client during non-RT
  48. enum PluginBridgeNonRtClientOpcode {
  49. kPluginBridgeNonRtClientNull = 0,
  50. kPluginBridgeNonRtClientVersion, // uint
  51. kPluginBridgeNonRtClientPing,
  52. kPluginBridgeNonRtClientPingOnOff, // bool
  53. kPluginBridgeNonRtClientActivate,
  54. kPluginBridgeNonRtClientDeactivate,
  55. kPluginBridgeNonRtClientInitialSetup, // uint, double
  56. kPluginBridgeNonRtClientSetParameterValue, // uint, float
  57. kPluginBridgeNonRtClientSetParameterMidiChannel, // uint, byte
  58. kPluginBridgeNonRtClientSetParameterMappedControlIndex, // uint, short
  59. kPluginBridgeNonRtClientSetProgram, // int
  60. kPluginBridgeNonRtClientSetMidiProgram, // int
  61. kPluginBridgeNonRtClientSetCustomData, // uint/size, str[], uint/size, str[], uint/size, str[]
  62. kPluginBridgeNonRtClientSetChunkDataFile, // uint/size, str[] (filename, base64 content)
  63. kPluginBridgeNonRtClientSetCtrlChannel, // short
  64. kPluginBridgeNonRtClientSetOption, // uint/option, bool
  65. kPluginBridgeNonRtClientGetParameterText, // uint
  66. kPluginBridgeNonRtClientPrepareForSave,
  67. kPluginBridgeNonRtClientRestoreLV2State,
  68. kPluginBridgeNonRtClientShowUI,
  69. kPluginBridgeNonRtClientHideUI,
  70. kPluginBridgeNonRtClientUiParameterChange, // uint, float
  71. kPluginBridgeNonRtClientUiProgramChange, // uint
  72. kPluginBridgeNonRtClientUiMidiProgramChange, // uint
  73. kPluginBridgeNonRtClientUiNoteOn, // byte, byte, byte
  74. kPluginBridgeNonRtClientUiNoteOff, // byte, byte
  75. kPluginBridgeNonRtClientQuit,
  76. // stuff added in API 7
  77. kPluginBridgeNonRtClientSetParameterMappedRange, // uint, float, float
  78. kPluginBridgeNonRtClientSetOptions, // uint
  79. // stuff added in API 8
  80. kPluginBridgeNonRtClientSetWindowTitle, // uint/size, str[]
  81. // stuff added in API 9
  82. kPluginBridgeNonRtClientEmbedUI, // ulong
  83. // stuff added in API 10
  84. kPluginBridgeNonRtClientReload,
  85. };
  86. // Client sends these to server during non-RT
  87. enum PluginBridgeNonRtServerOpcode {
  88. kPluginBridgeNonRtServerNull = 0,
  89. kPluginBridgeNonRtServerPong,
  90. kPluginBridgeNonRtServerPluginInfo1, // uint/category, uint/hints, uint/optionsAvailable, uint/optionsEnabled, long/uniqueId
  91. kPluginBridgeNonRtServerPluginInfo2, // uint/size, str[] (realName), uint/size, str[] (label), uint/size, str[] (maker), uint/size, str[] (copyright)
  92. kPluginBridgeNonRtServerAudioCount, // uint/ins, uint/outs
  93. kPluginBridgeNonRtServerMidiCount, // uint/ins, uint/outs
  94. kPluginBridgeNonRtServerCvCount, // uint/ins, uint/outs
  95. kPluginBridgeNonRtServerParameterCount, // uint/count
  96. kPluginBridgeNonRtServerProgramCount, // uint/count
  97. kPluginBridgeNonRtServerMidiProgramCount, // uint/count
  98. kPluginBridgeNonRtServerPortName, // byte/type, uint/index, uint/size, str[] (name)
  99. kPluginBridgeNonRtServerParameterData1, // uint/index, int/rindex, uint/type, uint/hints, short/cc
  100. kPluginBridgeNonRtServerParameterData2, // uint/index, uint/size, str[] (name), uint/size, str[] (symbol), uint/size, str[] (unit)
  101. kPluginBridgeNonRtServerParameterRanges, // uint/index, float/def, float/min, float/max, float/step, float/stepSmall, float/stepLarge
  102. kPluginBridgeNonRtServerParameterValue, // uint/index, float/value
  103. kPluginBridgeNonRtServerParameterValue2, // uint/index, float/value (used for init/output parameters only, don't resend values)
  104. kPluginBridgeNonRtServerParameterTouch, // uint/index, bool/touch
  105. kPluginBridgeNonRtServerDefaultValue, // uint/index, float/value
  106. kPluginBridgeNonRtServerCurrentProgram, // int/index
  107. kPluginBridgeNonRtServerCurrentMidiProgram, // int/index
  108. kPluginBridgeNonRtServerProgramName, // uint/index, uint/size, str[] (name)
  109. kPluginBridgeNonRtServerMidiProgramData, // uint/index, uint/bank, uint/program, uint/size, str[] (name)
  110. kPluginBridgeNonRtServerSetCustomData, // uint/size, str[], uint/size, str[], uint/size, str[]
  111. kPluginBridgeNonRtServerSetChunkDataFile, // uint/size, str[] (filename, base64 content)
  112. kPluginBridgeNonRtServerSetLatency, // uint/latency
  113. kPluginBridgeNonRtServerSetParameterText, // uint/index, uint/size, str[] (name)
  114. kPluginBridgeNonRtServerReady,
  115. kPluginBridgeNonRtServerSaved,
  116. kPluginBridgeNonRtServerUiClosed,
  117. kPluginBridgeNonRtServerError, // uint/size, str[]
  118. // stuff added in API 7
  119. kPluginBridgeNonRtServerVersion, // uint/version
  120. // stuff added in API 9
  121. kPluginBridgeNonRtServerRespEmbedUI, // ulong/window-id
  122. kPluginBridgeNonRtServerResizeEmbedUI, // uint/width, uint/height
  123. };
  124. // used for kPluginBridgeNonRtServerPortName
  125. enum PluginBridgePortType {
  126. kPluginBridgePortNull = 0,
  127. kPluginBridgePortAudioInput,
  128. kPluginBridgePortAudioOutput,
  129. kPluginBridgePortCvInput,
  130. kPluginBridgePortCvOutput,
  131. kPluginBridgePortMidiInput,
  132. kPluginBridgePortMidiOutput,
  133. kPluginBridgePortTypeCount
  134. };
  135. enum PluginBridgeTimeInfoFlags {
  136. kPluginBridgeTimeInfoValidBBT = 0x1
  137. };
  138. // -------------------------------------------------------------------------------------------------------------------
  139. struct BridgeSemaphore {
  140. union {
  141. void* server;
  142. char _padServer[64];
  143. };
  144. union {
  145. void* client;
  146. char _padClient[64];
  147. };
  148. };
  149. // NOTE: needs to be 64bit aligned
  150. struct BridgeTimeInfo {
  151. uint64_t playing;
  152. uint64_t frame;
  153. uint64_t usecs;
  154. uint32_t validFlags;
  155. uint32_t unused;
  156. // bbt
  157. int32_t bar, beat;
  158. float beatsPerBar, beatType;
  159. double tick, barStartTick, ticksPerBeat, beatsPerMinute;
  160. };
  161. // -------------------------------------------------------------------------------------------------------------------
  162. #endif // CARLA_BRIDGE_DEFINES_HPP_INCLUDED