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.

170 lines
8.0KB

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