+ Filter: implement drawing optimization
[calf.git] / src / calf / lv2_contexts.h
blob59ac603fba0a22e40fec306a14f04a157d7fc490
1 /* LV2 OSC Messages Extension
2 * Copyright (C) 2007-2008 Dave Robillard <dave@drobilla.net>
3 *
4 * This header is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
9 * This header is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef LV2_CONTEXTS_H
20 #define LV2_CONTEXTS_H
22 #include <stdint.h>
24 #define LV2_CONTEXTS_URI "http://lv2plug.in/ns/dev/contexts"
26 #define LV2_CONTEXT_MESSAGE "http://lv2plug.in/ns/dev/contexts#MessageContext"
28 static inline void
29 lv2_contexts_set_port_valid(void* flags, uint32_t index) {
30 ((uint8_t*)flags)[index / 8] |= 1 << (index % 8);
33 static inline void
34 lv2_contexts_unset_port_valid(void* flags, uint32_t index) {
35 ((uint8_t*)flags)[index / 8] &= ~(1 << (index % 8));
38 static inline int
39 lv2_contexts_port_is_valid(const void* flags, uint32_t index) {
40 return (((uint8_t*)flags)[index / 8] & (1 << (index % 8))) != 0;
43 #include "lv2.h"
44 #include <stdbool.h>
47 typedef struct {
48 /** The message run function. This is called once to process a set of
49 * inputs and produce a set of outputs. Before calling the host MUST
50 * set valid_inputs such that the bit corresponding to each input port
51 * is 1 iff data is present. The plugin MUST only inspect bits
52 * corresponding to ports in the message thread. Before returning the
53 * plugin MUST set valid_outputs such that the bit corresponding to
54 * each output port of the message context is 1 iff data has been written
55 * to that port in the duration of this function invocation.
56 * The plugin must return 1 if outputs have been written, 0 otherwise.
58 uint32_t (*message_run)(LV2_Handle instance,
59 const void* valid_inputs,
60 void* valid_outputs);
62 /** The message thread function alalogous to the LV2 connect_port
63 * function. This function must only be used to connect ports that
64 * belong to the message context. */
65 void (*message_connect_port)(LV2_Handle instance,
66 uint32_t port,
67 void* data);
69 } LV2MessageContext;
72 #endif // LV2_CONTEXTS_H