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