File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -297,11 +297,27 @@ typedef struct clap_event_midi {
297
297
uint8_t data [3 ];
298
298
} clap_event_midi_t ;
299
299
300
+ // clap_event_midi_sysex contains a pointer to a sysex contents buffer.
301
+ // The lifetime of this buffer is (from host->plugin) only the process
302
+ // call in which the event is delivered or (from plugin->host) only the
303
+ // duration of a try_push call.
304
+ //
305
+ // Since `clap_output_events.try_push` requires hosts to make a copy of
306
+ // an event, host implementers receiving sysex messages from plugins need
307
+ // to take care to both copy the event (so header, size, etc...) but
308
+ // also memcpy the contents of the sysex pointer to host-owned memory, and
309
+ // not just copy the data pointer.
310
+ //
311
+ // Similarly plugins retaining the sysex outside the lifetime of a single
312
+ // process call must copy the sysex buffer to plugin-owned memory.
313
+ //
314
+ // As a consequence, the data structure pointed to by the sysex buffer
315
+ // must be contiguous and copyable with `memcpy` of `size` bytes.
300
316
typedef struct clap_event_midi_sysex {
301
317
clap_event_header_t header ;
302
318
303
319
uint16_t port_index ;
304
- const uint8_t * buffer ; // midi buffer
320
+ const uint8_t * buffer ; // midi buffer. See lifetime comment above.
305
321
uint32_t size ;
306
322
} clap_event_midi_sysex_t ;
307
323
You can’t perform that action at this time.
0 commit comments