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.

163 lines
7.6KB

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