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.

CarlaBridgeDefines.hpp 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 9
  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. };
  84. // Client sends these to server during non-RT
  85. enum PluginBridgeNonRtServerOpcode {
  86. kPluginBridgeNonRtServerNull = 0,
  87. kPluginBridgeNonRtServerPong,
  88. kPluginBridgeNonRtServerPluginInfo1, // uint/category, uint/hints, uint/optionsAvailable, uint/optionsEnabled, long/uniqueId
  89. kPluginBridgeNonRtServerPluginInfo2, // uint/size, str[] (realName), uint/size, str[] (label), uint/size, str[] (maker), uint/size, str[] (copyright)
  90. kPluginBridgeNonRtServerAudioCount, // uint/ins, uint/outs
  91. kPluginBridgeNonRtServerMidiCount, // uint/ins, uint/outs
  92. kPluginBridgeNonRtServerCvCount, // uint/ins, uint/outs
  93. kPluginBridgeNonRtServerParameterCount, // uint/count
  94. kPluginBridgeNonRtServerProgramCount, // uint/count
  95. kPluginBridgeNonRtServerMidiProgramCount, // uint/count
  96. kPluginBridgeNonRtServerPortName, // byte/type, uint/index, uint/size, str[] (name)
  97. kPluginBridgeNonRtServerParameterData1, // uint/index, int/rindex, uint/type, uint/hints, short/cc
  98. kPluginBridgeNonRtServerParameterData2, // uint/index, uint/size, str[] (name), uint/size, str[] (symbol), uint/size, str[] (unit)
  99. kPluginBridgeNonRtServerParameterRanges, // uint/index, float/def, float/min, float/max, float/step, float/stepSmall, float/stepLarge
  100. kPluginBridgeNonRtServerParameterValue, // uint/index, float/value
  101. kPluginBridgeNonRtServerParameterValue2, // uint/index, float/value (used for init/output parameters only, don't resend values)
  102. kPluginBridgeNonRtServerParameterTouch, // uint/index, bool/touch
  103. kPluginBridgeNonRtServerDefaultValue, // uint/index, float/value
  104. kPluginBridgeNonRtServerCurrentProgram, // int/index
  105. kPluginBridgeNonRtServerCurrentMidiProgram, // int/index
  106. kPluginBridgeNonRtServerProgramName, // uint/index, uint/size, str[] (name)
  107. kPluginBridgeNonRtServerMidiProgramData, // uint/index, uint/bank, uint/program, uint/size, str[] (name)
  108. kPluginBridgeNonRtServerSetCustomData, // uint/size, str[], uint/size, str[], uint/size, str[]
  109. kPluginBridgeNonRtServerSetChunkDataFile, // uint/size, str[] (filename, base64 content)
  110. kPluginBridgeNonRtServerSetLatency, // uint/latency
  111. kPluginBridgeNonRtServerSetParameterText, // uint/index, uint/size, str[] (name)
  112. kPluginBridgeNonRtServerReady,
  113. kPluginBridgeNonRtServerSaved,
  114. kPluginBridgeNonRtServerUiClosed,
  115. kPluginBridgeNonRtServerError, // uint/size, str[]
  116. // stuff added in API 7
  117. kPluginBridgeNonRtServerVersion, // uint/version
  118. // stuff added in API 9
  119. kPluginBridgeNonRtServerRespEmbedUI, // ulong/window-id
  120. kPluginBridgeNonRtServerResizeEmbedUI, // uint/width, uint/height
  121. };
  122. // used for kPluginBridgeNonRtServerPortName
  123. enum PluginBridgePortType {
  124. kPluginBridgePortNull = 0,
  125. kPluginBridgePortAudioInput,
  126. kPluginBridgePortAudioOutput,
  127. kPluginBridgePortCvInput,
  128. kPluginBridgePortCvOutput,
  129. kPluginBridgePortMidiInput,
  130. kPluginBridgePortMidiOutput,
  131. kPluginBridgePortTypeCount
  132. };
  133. enum PluginBridgeTimeInfoFlags {
  134. kPluginBridgeTimeInfoValidBBT = 0x1
  135. };
  136. // -------------------------------------------------------------------------------------------------------------------
  137. struct BridgeSemaphore {
  138. union {
  139. void* server;
  140. char _padServer[64];
  141. };
  142. union {
  143. void* client;
  144. char _padClient[64];
  145. };
  146. };
  147. // NOTE: needs to be 64bit aligned
  148. struct BridgeTimeInfo {
  149. uint64_t playing;
  150. uint64_t frame;
  151. uint64_t usecs;
  152. uint32_t validFlags;
  153. uint32_t unused;
  154. // bbt
  155. int32_t bar, beat;
  156. float beatsPerBar, beatType;
  157. double tick, barStartTick, ticksPerBeat, beatsPerMinute;
  158. };
  159. // -------------------------------------------------------------------------------------------------------------------
  160. #endif // CARLA_BRIDGE_DEFINES_HPP_INCLUDED