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.

165 lines
7.7KB

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