From e29bd2d8290ad95681f1d9991c710726bb7b0c29 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 16 Apr 2012 18:55:36 +0100 Subject: [PATCH] Update to latest LV2 headers --- src/carla-includes/lv2/atom.h | 9 +- src/carla-includes/lv2/data-access.h | 9 +- src/carla-includes/lv2/event-helpers.h | 8 +- src/carla-includes/lv2/event.h | 61 +++--- src/carla-includes/lv2/instance-access.h | 29 ++- src/carla-includes/lv2/lv2.h | 40 ++-- src/carla-includes/lv2/midi.h | 81 ++++---- src/carla-includes/lv2/state.h | 8 - src/carla-includes/lv2/ui.h | 230 +++++++++++------------ src/carla-includes/lv2/uri-map.h | 14 +- src/carla-includes/lv2/urid.h | 16 +- src/carla/lv2.cpp | 4 +- 12 files changed, 244 insertions(+), 265 deletions(-) diff --git a/src/carla-includes/lv2/atom.h b/src/carla-includes/lv2/atom.h index 3c7bee8..37a3e6c 100644 --- a/src/carla-includes/lv2/atom.h +++ b/src/carla-includes/lv2/atom.h @@ -30,8 +30,6 @@ #define LV2_ATOM__Atom LV2_ATOM_PREFIX "Atom" #define LV2_ATOM__AtomPort LV2_ATOM_PREFIX "AtomPort" -#define LV2_ATOM__AudioFrames LV2_ATOM_PREFIX "AudioFrames" -#define LV2_ATOM__Beats LV2_ATOM_PREFIX "Beats" #define LV2_ATOM__Blank LV2_ATOM_PREFIX "Blank" #define LV2_ATOM__Bool LV2_ATOM_PREFIX "Bool" #define LV2_ATOM__Chunk LV2_ATOM_PREFIX "Chunk" @@ -39,8 +37,8 @@ #define LV2_ATOM__Event LV2_ATOM_PREFIX "Event" #define LV2_ATOM__Float LV2_ATOM_PREFIX "Float" #define LV2_ATOM__Int LV2_ATOM_PREFIX "Int" -#define LV2_ATOM__Long LV2_ATOM_PREFIX "Long" #define LV2_ATOM__Literal LV2_ATOM_PREFIX "Literal" +#define LV2_ATOM__Long LV2_ATOM_PREFIX "Long" #define LV2_ATOM__Number LV2_ATOM_PREFIX "Number" #define LV2_ATOM__Object LV2_ATOM_PREFIX "Object" #define LV2_ATOM__Path LV2_ATOM_PREFIX "Path" @@ -49,11 +47,11 @@ #define LV2_ATOM__Sequence LV2_ATOM_PREFIX "Sequence" #define LV2_ATOM__Sound LV2_ATOM_PREFIX "Sound" #define LV2_ATOM__String LV2_ATOM_PREFIX "String" -#define LV2_ATOM__TimeUnit LV2_ATOM_PREFIX "TimeUnit" #define LV2_ATOM__Tuple LV2_ATOM_PREFIX "Tuple" #define LV2_ATOM__URI LV2_ATOM_PREFIX "URI" #define LV2_ATOM__URID LV2_ATOM_PREFIX "URID" #define LV2_ATOM__Vector LV2_ATOM_PREFIX "Vector" +#define LV2_ATOM__atomTransfer LV2_ATOM_PREFIX "atomTransfer" #define LV2_ATOM__beatTime LV2_ATOM_PREFIX "beatTime" #define LV2_ATOM__bufferType LV2_ATOM_PREFIX "bufferType" #define LV2_ATOM__childType LV2_ATOM_PREFIX "childType" @@ -207,8 +205,7 @@ typedef struct { The unit field is either a URID that described an appropriate time stamp type, or may be 0 where a default stamp type is known. For - LV2_Descriptor::run(), the default stamp type is atom:AudioFrames, i.e. - LV2_Atom_Audio_Time. + LV2_Descriptor::run(), the default stamp type is audio frames. The contents of a sequence is a series of LV2_Atom_Event, each aligned to 64-bits, e.g.: diff --git a/src/carla-includes/lv2/data-access.h b/src/carla-includes/lv2/data-access.h index fac6974..b19f65f 100644 --- a/src/carla-includes/lv2/data-access.h +++ b/src/carla-includes/lv2/data-access.h @@ -31,7 +31,7 @@ /** The data field of the LV2_Feature for this extension. - + To support this feature the host must pass an LV2_Feature struct to the instantiate method with URI "http://lv2plug.in/ns/ext/data-access" and data pointed to an instance of this struct. @@ -40,17 +40,16 @@ typedef struct { /** A pointer to a method the UI can call to get data (of a type specified by some other extension) from the plugin. - + This call never is never guaranteed to return anything, UIs should degrade gracefully if direct access to the plugin data is not possible (in which case this function will return NULL). - + This is for access to large data that can only possibly work if the UI and plugin are running in the same process. For all other things, use the normal LV2 UI communication system. */ const void* (*data_access)(const char* uri); - } LV2_Extension_Data_Feature; -#endif /* LV2_DATA_ACCESS_H */ +#endif /* LV2_DATA_ACCESS_H */ diff --git a/src/carla-includes/lv2/event-helpers.h b/src/carla-includes/lv2/event-helpers.h index eeed7c0..bb2c38c 100644 --- a/src/carla-includes/lv2/event-helpers.h +++ b/src/carla-includes/lv2/event-helpers.h @@ -191,10 +191,10 @@ lv2_event_write(LV2_Event_Iterator* iter, is not enough room in the buffer. */ static inline uint8_t* lv2_event_reserve(LV2_Event_Iterator* iter, - uint32_t frames, - uint32_t subframes, - uint16_t type, - uint16_t size) + uint32_t frames, + uint32_t subframes, + uint16_t type, + uint16_t size) { if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) return NULL; diff --git a/src/carla-includes/lv2/event.h b/src/carla-includes/lv2/event.h index 2d8bfaa..aeb1332 100644 --- a/src/carla-includes/lv2/event.h +++ b/src/carla-includes/lv2/event.h @@ -18,12 +18,12 @@ /** @file event.h C API for the LV2 Event extension . - + This extension is a generic transport mechanism for time stamped events of any type (e.g. MIDI, OSC, ramps, etc). Each port can transport mixed events of any type; the type of events and timestamps are defined by a URI which is mapped to an integer by the host for performance reasons. - + This extension requires the host to support the LV2 URI Map extension. Any host which supports this extension MUST guarantee that any call to the LV2 URI Map uri_to_id function with the URI of this extension as the @@ -33,7 +33,20 @@ #ifndef LV2_EVENT_H #define LV2_EVENT_H -#define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" +#define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" +#define LV2_EVENT_PREFIX LV2_EVENT_URI "#" + +#define LV2_EVENT__Event LV2_EVENT_PREFIX "Event" +#define LV2_EVENT__EventPort LV2_EVENT_PREFIX "EventPort" +#define LV2_EVENT__FrameStamp LV2_EVENT_PREFIX "FrameStamp" +#define LV2_EVENT__TimeStamp LV2_EVENT_PREFIX "TimeStamp" +#define LV2_EVENT__generatesTimeStamp LV2_EVENT_PREFIX "generatesTimeStamp" +#define LV2_EVENT__generic LV2_EVENT_PREFIX "generic" +#define LV2_EVENT__inheritsEvent LV2_EVENT_PREFIX "inheritsEvent" +#define LV2_EVENT__inheritsTimeStamp LV2_EVENT_PREFIX "inheritsTimeStamp" +#define LV2_EVENT__supportsEvent LV2_EVENT_PREFIX "supportsEvent" +#define LV2_EVENT__supportsTimeStamp LV2_EVENT_PREFIX "supportsTimeStamp" + #define LV2_EVENT_AUDIO_STAMP 0 #include @@ -47,19 +60,18 @@ static const uint32_t LV2_EVENT_PPQN = 3136573440U; /** An LV2 event (header only). - + LV2 events are generic time-stamped containers for any type of event. The type field defines the format of a given event's contents. - + This struct defines the header of an LV2 event. An LV2 event is a single chunk of POD (plain old data), usually contained in a flat buffer (see LV2_EventBuffer below). Unless a required feature says otherwise, hosts may assume a deep copy of an LV2 event can be created safely using a simple: - + memcpy(ev_copy, ev, sizeof(LV2_Event) + ev->size); (or equivalent) */ typedef struct { - /** The frames portion of timestamp. The units used here can optionally be set for a port (with the lv2ev:timeUnits property), otherwise this is @@ -100,28 +112,26 @@ typedef struct { uint16_t size; /* size bytes of data follow here */ - } LV2_Event; /** A buffer of LV2 events (header only). - + Like events (which this contains) an event buffer is a single chunk of POD: the entire buffer (including contents) can be copied with a single memcpy. The first contained event begins sizeof(LV2_EventBuffer) bytes after the start of this struct. - + After this header, the buffer contains an event header (defined by struct LV2_Event), followed by that event's contents (padded to 64 bits), followed by another header, etc: - + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |FRAMES |SUBFRMS|TYP|LEN|DATA..DATA..PAD|FRAMES | ... */ typedef struct { - /** The contents of the event buffer. This may or may not reside in the same block of memory as this header, plugins must not assume either. @@ -132,7 +142,7 @@ typedef struct { /** The size of this event header in bytes (including everything). - + This is to allow for extending this header in the future without breaking binary compatibility. Whenever this header is copied, it MUST be done using this field (and NOT the sizeof this struct). @@ -153,7 +163,7 @@ typedef struct { connect_port is called on the input port, at which time the host MUST have set the stamp_type field to the value that will be used for all subsequent run calls. - + OUTPUTS: The plugin may set this to any value that has been returned from uri_to_id with the URI of this extension for a 'map' argument. When connected to a buffer with connect_port, output ports MUST set this @@ -198,7 +208,6 @@ typedef struct { Any initial value should be ignored by the plugin. */ uint32_t size; - } LV2_Event_Buffer; @@ -210,17 +219,16 @@ typedef void* LV2_Event_Callback_Data; /** Non-POD events feature. - + To support this feature the host must pass an LV2_Feature struct to the plugin's instantiate method with URI "http://lv2plug.in/ns/ext/event" and data pointed to an instance of this struct. Note this feature is not mandatory to support the event extension. */ typedef struct { - /** Opaque pointer to host data. - + The plugin MUST pass this to any call to functions in this struct. Otherwise, it must not be interpreted in any way. */ @@ -228,7 +236,7 @@ typedef struct { /** Take a reference to a non-POD event. - + If a plugin receives an event with type 0, it means the event is a pointer to some object in memory and not a flat sequence of bytes in the buffer. When receiving a non-POD event, the plugin already @@ -236,16 +244,16 @@ typedef struct { passed to an output, lv2_event_ref MUST be called on that event. If the event is only stored OR passed through, this is not necessary (as the plugin already has 1 implicit reference). - + @param event An event received at an input that will not be copied to an output or stored in any way. - + @param context The calling context. Like event types, this is a mapped URI, see lv2_context.h. Simple plugin with just a run() method should pass 0 here (the ID of the 'standard' LV2 run context). The host guarantees that this function is realtime safe iff @a context is realtime safe. - + PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. */ uint32_t (*lv2_event_ref)(LV2_Event_Callback_Data callback_data, @@ -253,27 +261,26 @@ typedef struct { /** Drop a reference to a non-POD event. - + If a plugin receives an event with type 0, it means the event is a pointer to some object in memory and not a flat sequence of bytes in the buffer. If the plugin does not pass the event through to an output or store it internally somehow, it MUST call this function on the event (more information on using non-POD events below). - + @param event An event received at an input that will not be copied to an output or stored in any way. - + @param context The calling context. Like event types, this is a mapped URI, see lv2_context.h. Simple plugin with just a run() method should pass 0 here (the ID of the 'standard' LV2 run context). The host guarantees that this function is realtime safe iff @a context is realtime safe. - + PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. */ uint32_t (*lv2_event_unref)(LV2_Event_Callback_Data callback_data, LV2_Event* event); - } LV2_Event_Feature; diff --git a/src/carla-includes/lv2/instance-access.h b/src/carla-includes/lv2/instance-access.h index 7e18ee4..06d8dde 100644 --- a/src/carla-includes/lv2/instance-access.h +++ b/src/carla-includes/lv2/instance-access.h @@ -1,6 +1,6 @@ /* LV2 Instance Access Extension - Copyright 2008-2011 David Robillard + Copyright 2008-2012 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -20,19 +20,18 @@ #define LV2_INSTANCE_ACCESS_URI "http://lv2plug.in/ns/ext/instance-access" +/** + @file instance-access.h + C header for the LV2 Instance Access extension + . + + This extension defines a method for (e.g.) plugin UIs to get a direct + handle to an LV2 plugin instance (LV2_Handle), if possible. + + To support this feature the host must pass an LV2_Feature struct to the + UI instantiate method with URI "http://lv2plug.in/ns/ext/instance-access" + and data pointed directly to the LV2_Handle of the plugin instance. +*/ -/** @file - * C header for the LV2 Instance Access extension - * . - * - * This extension defines a method for (e.g.) plugin UIs to get a direct - * handle to an LV2 plugin instance (LV2_Handle), if possible. - * - * To support this feature the host must pass an LV2_Feature struct to the - * UI instantiate method with URI "http://lv2plug.in/ns/ext/instance-access" - * and data pointed directly to the LV2_Handle of the plugin instance. - */ - - -#endif /* LV2_INSTANCE_ACCESS_H */ +#endif /* LV2_INSTANCE_ACCESS_H */ diff --git a/src/carla-includes/lv2/lv2.h b/src/carla-includes/lv2/lv2.h index 0b04bce..9249cd3 100644 --- a/src/carla-includes/lv2/lv2.h +++ b/src/carla-includes/lv2/lv2.h @@ -4,7 +4,7 @@ Based on LADSPA, Copyright 2000-2002 Richard W.E. Furse, Paul Barton-Davis, Stefan Westerfeld. - + Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. @@ -37,6 +37,7 @@ #define LV2_CORE__AnalyserPlugin LV2_CORE_PREFIX "AnalyserPlugin" #define LV2_CORE__AudioPort LV2_CORE_PREFIX "AudioPort" #define LV2_CORE__BandpassPlugin LV2_CORE_PREFIX "BandpassPlugin" +#define LV2_CORE__CVPort LV2_CORE_PREFIX "CVPort" #define LV2_CORE__ChorusPlugin LV2_CORE_PREFIX "ChorusPlugin" #define LV2_CORE__CombPlugin LV2_CORE_PREFIX "CombPlugin" #define LV2_CORE__CompressorPlugin LV2_CORE_PREFIX "CompressorPlugin" @@ -92,7 +93,6 @@ #define LV2_CORE__extensionData LV2_CORE_PREFIX "extensionData" #define LV2_CORE__freeWheeling LV2_CORE_PREFIX "freeWheeling" #define LV2_CORE__hardRTCapable LV2_CORE_PREFIX "hardRTCapable" -#define LV2_CORE__hasParameter LV2_CORE_PREFIX "hasParameter" #define LV2_CORE__inPlaceBroken LV2_CORE_PREFIX "inPlaceBroken" #define LV2_CORE__index LV2_CORE_PREFIX "index" #define LV2_CORE__integer LV2_CORE_PREFIX "integer" @@ -119,7 +119,7 @@ extern "C" { /** Plugin Instance Handle. - + This is a handle for one particular instance of a plugin. It is valid to compare to NULL (or 0 for C++) but otherwise the host MUST NOT attempt to interpret it. @@ -128,7 +128,7 @@ typedef void * LV2_Handle; /** Feature. - + Features allow hosts to make additional functionality available to plugins without requiring modification to the LV2 API. Extensions may define new features and specify the @ref URI and @ref data to be used if necessary. @@ -153,7 +153,7 @@ typedef struct _LV2_Feature { /** Plugin Descriptor. - + This structure provides the core functions necessary to instantiate and use a plugin. */ @@ -182,7 +182,7 @@ typedef struct _LV2_Descriptor { binary. It MUST include the trailing directory separator (e.g. '/') so that simply appending a filename will yield the path to that file in the bundle. - + @param features A NULL terminated array of LV2_Feature structs which represent the features the host supports. Plugins may refuse to instantiate if required features are not found here. However, hosts MUST @@ -193,7 +193,7 @@ typedef struct _LV2_Descriptor { NULL. @return A handle for the new plugin instance, or NULL if instantiation - has failed. + has failed. */ LV2_Handle (*instantiate)(const struct _LV2_Descriptor * descriptor, double sample_rate, @@ -206,7 +206,7 @@ typedef struct _LV2_Descriptor { Plugin writers should be aware that the host may elect to use the same buffer for more than one port and even use the same buffer for both input and output (see lv2:inPlaceBroken in lv2.ttl). - + If the plugin has the feature lv2:hardRTCapable then there are various things that the plugin MUST NOT do within the connect_port() function; see lv2core.ttl for details. @@ -240,14 +240,14 @@ typedef struct _LV2_Descriptor { /** Initialise a plugin instance and activate it for use. - + This is separated from instantiate() to aid real-time support and so that hosts can reinitialise a plugin instance by calling deactivate() and then activate(). In this case the plugin instance MUST reset all state information dependent on the history of the plugin instance except for any data locations provided by connect_port(). If there is nothing for activate() to do then this field may be NULL. - + When present, hosts MUST call this function once before run() is called for the first time. This call SHOULD be made as close to the run() call as possible and indicates to real-time plugins that they are now live, @@ -267,17 +267,17 @@ typedef struct _LV2_Descriptor { Note that if an activate() function exists then it must be called before run(). If deactivate() is called for a plugin instance then run() may not be called until activate() has been called again. - + If the plugin has the feature lv2:hardRTCapable then there are various things that the plugin MUST NOT do within the run() function (see lv2core.ttl for details). - As a special case, when @c sample_count == 0, the plugin should update + As a special case, when @p sample_count == 0, the plugin should update any output ports that represent a single instant in time (e.g. control ports, but not audio ports). This is particularly useful for latent plugins, which should update their latency output port so hosts can pre-roll plugins to compute latency. Plugins MUST NOT crash when - @c sample_count == 0. + @p sample_count == 0. @param instance Instance to be run. @@ -309,11 +309,11 @@ typedef struct _LV2_Descriptor { /** Clean up a plugin instance (counterpart to instantiate()). - + Once an instance of a plugin has been finished with it must be deleted using this function. The instance handle passed ceases to be valid after this call. - + If activate() was called for a plugin instance then a corresponding call to deactivate() MUST be made before cleanup() is called. Hosts MUST NOT call cleanup() unless instantiate() was previously called. @@ -325,12 +325,12 @@ typedef struct _LV2_Descriptor { A typical use of this facility is to return a struct containing function pointers to extend the LV2_Descriptor API. - + The actual type and meaning of the returned object MUST be specified precisely by the extension. This function MUST return NULL for any unsupported URI. If a plugin does not support any extension data, this field may be NULL. - + The host is never responsible for freeing the returned value. */ const void * (*extension_data)(const char * uri); @@ -354,7 +354,7 @@ typedef struct _LV2_Descriptor { available during discovery, and it relies on non-portable shared library constructors/destructors. However, this API is still supported and plugins are not required to migrate. - + Plugins are discovered by hosts using RDF data (not by loading libraries). See http://lv2plug.in for details on the discovery process, though most hosts should use an existing library to implement this functionality. @@ -368,9 +368,9 @@ typedef struct _LV2_Descriptor { function to find the LV2_Descriptor for the desired plugin. Plugins are accessed by index using values from 0 upwards. This function MUST return NULL for out of range indices, so the host can enumerate plugins by - increasing @c index until NULL is returned. + increasing @p index until NULL is returned. - Note that @c index has no meaning, hosts MUST NOT depend on it remaining + Note that @p index has no meaning, hosts MUST NOT depend on it remaining consistent between loads of the plugin library. */ LV2_SYMBOL_EXPORT diff --git a/src/carla-includes/lv2/midi.h b/src/carla-includes/lv2/midi.h index 60b6ffa..6d61543 100644 --- a/src/carla-includes/lv2/midi.h +++ b/src/carla-includes/lv2/midi.h @@ -22,46 +22,47 @@ #ifndef LV2_MIDI_H #define LV2_MIDI_H -#define LV2_MIDI_URI "http://lv2plug.in/ns/ext/midi" +#define LV2_MIDI_URI "http://lv2plug.in/ns/ext/midi" +#define LV2_MIDI_PREFIX LV2_MIDI_URI "#" -#define LV2_MIDI__ActiveSense LV2_MIDI_URI "#ActiveSense" -#define LV2_MIDI__Aftertouch LV2_MIDI_URI "#Aftertouch" -#define LV2_MIDI__Bender LV2_MIDI_URI "#Bender" -#define LV2_MIDI__ChannelPressure LV2_MIDI_URI "#ChannelPressure" -#define LV2_MIDI__Chunk LV2_MIDI_URI "#Chunk" -#define LV2_MIDI__Clock LV2_MIDI_URI "#Clock" -#define LV2_MIDI__Continue LV2_MIDI_URI "#Continue" -#define LV2_MIDI__Controller LV2_MIDI_URI "#Controller" -#define LV2_MIDI__MidiEvent LV2_MIDI_URI "#MidiEvent" -#define LV2_MIDI__NoteOff LV2_MIDI_URI "#NoteOff" -#define LV2_MIDI__NoteOn LV2_MIDI_URI "#NoteOn" -#define LV2_MIDI__ProgramChange LV2_MIDI_URI "#ProgramChange" -#define LV2_MIDI__QuarterFrame LV2_MIDI_URI "#QuarterFrame" -#define LV2_MIDI__Reset LV2_MIDI_URI "#Reset" -#define LV2_MIDI__SongPosition LV2_MIDI_URI "#SongPosition" -#define LV2_MIDI__SongSelect LV2_MIDI_URI "#SongSelect" -#define LV2_MIDI__Start LV2_MIDI_URI "#Start" -#define LV2_MIDI__Stop LV2_MIDI_URI "#Stop" -#define LV2_MIDI__SystemCommon LV2_MIDI_URI "#SystemCommon" -#define LV2_MIDI__SystemExclusive LV2_MIDI_URI "#SystemExclusive" -#define LV2_MIDI__SystemMessage LV2_MIDI_URI "#SystemMessage" -#define LV2_MIDI__SystemRealtime LV2_MIDI_URI "#SystemRealtime" -#define LV2_MIDI__Tick LV2_MIDI_URI "#Tick" -#define LV2_MIDI__TuneRequest LV2_MIDI_URI "#TuneRequest" -#define LV2_MIDI__VoiceMessage LV2_MIDI_URI "#VoiceMessage" -#define LV2_MIDI__benderValue LV2_MIDI_URI "#benderValue" -#define LV2_MIDI__byteNumber LV2_MIDI_URI "#byteNumber" -#define LV2_MIDI__chunk LV2_MIDI_URI "#chunk" -#define LV2_MIDI__controllerNumber LV2_MIDI_URI "#controllerNumber" -#define LV2_MIDI__controllerValue LV2_MIDI_URI "#controllerValue" -#define LV2_MIDI__noteNumber LV2_MIDI_URI "#noteNumber" -#define LV2_MIDI__pressure LV2_MIDI_URI "#pressure" -#define LV2_MIDI__programNumber LV2_MIDI_URI "#programNumber" -#define LV2_MIDI__property LV2_MIDI_URI "#property" -#define LV2_MIDI__songNumber LV2_MIDI_URI "#songNumber" -#define LV2_MIDI__songPosition LV2_MIDI_URI "#songPosition" -#define LV2_MIDI__status LV2_MIDI_URI "#status" -#define LV2_MIDI__statusMask LV2_MIDI_URI "#statusMask" -#define LV2_MIDI__velocity LV2_MIDI_URI "#velocity" +#define LV2_MIDI__ActiveSense LV2_MIDI_PREFIX "ActiveSense" +#define LV2_MIDI__Aftertouch LV2_MIDI_PREFIX "Aftertouch" +#define LV2_MIDI__Bender LV2_MIDI_PREFIX "Bender" +#define LV2_MIDI__ChannelPressure LV2_MIDI_PREFIX "ChannelPressure" +#define LV2_MIDI__Chunk LV2_MIDI_PREFIX "Chunk" +#define LV2_MIDI__Clock LV2_MIDI_PREFIX "Clock" +#define LV2_MIDI__Continue LV2_MIDI_PREFIX "Continue" +#define LV2_MIDI__Controller LV2_MIDI_PREFIX "Controller" +#define LV2_MIDI__MidiEvent LV2_MIDI_PREFIX "MidiEvent" +#define LV2_MIDI__NoteOff LV2_MIDI_PREFIX "NoteOff" +#define LV2_MIDI__NoteOn LV2_MIDI_PREFIX "NoteOn" +#define LV2_MIDI__ProgramChange LV2_MIDI_PREFIX "ProgramChange" +#define LV2_MIDI__QuarterFrame LV2_MIDI_PREFIX "QuarterFrame" +#define LV2_MIDI__Reset LV2_MIDI_PREFIX "Reset" +#define LV2_MIDI__SongPosition LV2_MIDI_PREFIX "SongPosition" +#define LV2_MIDI__SongSelect LV2_MIDI_PREFIX "SongSelect" +#define LV2_MIDI__Start LV2_MIDI_PREFIX "Start" +#define LV2_MIDI__Stop LV2_MIDI_PREFIX "Stop" +#define LV2_MIDI__SystemCommon LV2_MIDI_PREFIX "SystemCommon" +#define LV2_MIDI__SystemExclusive LV2_MIDI_PREFIX "SystemExclusive" +#define LV2_MIDI__SystemMessage LV2_MIDI_PREFIX "SystemMessage" +#define LV2_MIDI__SystemRealtime LV2_MIDI_PREFIX "SystemRealtime" +#define LV2_MIDI__Tick LV2_MIDI_PREFIX "Tick" +#define LV2_MIDI__TuneRequest LV2_MIDI_PREFIX "TuneRequest" +#define LV2_MIDI__VoiceMessage LV2_MIDI_PREFIX "VoiceMessage" +#define LV2_MIDI__benderValue LV2_MIDI_PREFIX "benderValue" +#define LV2_MIDI__byteNumber LV2_MIDI_PREFIX "byteNumber" +#define LV2_MIDI__chunk LV2_MIDI_PREFIX "chunk" +#define LV2_MIDI__controllerNumber LV2_MIDI_PREFIX "controllerNumber" +#define LV2_MIDI__controllerValue LV2_MIDI_PREFIX "controllerValue" +#define LV2_MIDI__noteNumber LV2_MIDI_PREFIX "noteNumber" +#define LV2_MIDI__pressure LV2_MIDI_PREFIX "pressure" +#define LV2_MIDI__programNumber LV2_MIDI_PREFIX "programNumber" +#define LV2_MIDI__property LV2_MIDI_PREFIX "property" +#define LV2_MIDI__songNumber LV2_MIDI_PREFIX "songNumber" +#define LV2_MIDI__songPosition LV2_MIDI_PREFIX "songPosition" +#define LV2_MIDI__status LV2_MIDI_PREFIX "status" +#define LV2_MIDI__statusMask LV2_MIDI_PREFIX "statusMask" +#define LV2_MIDI__velocity LV2_MIDI_PREFIX "velocity" #endif /* LV2_MIDI_H */ diff --git a/src/carla-includes/lv2/state.h b/src/carla-includes/lv2/state.h index 4fc8eb7..5090a8e 100644 --- a/src/carla-includes/lv2/state.h +++ b/src/carla-includes/lv2/state.h @@ -54,7 +54,6 @@ typedef void* LV2_State_Make_Path_Handle; (de-)serialise the value data, or whether it is even possible to do so. */ typedef enum { - /** Plain Old Data. @@ -90,7 +89,6 @@ typedef enum { and portability. */ LV2_STATE_IS_NATIVE = 1 << 2 - } LV2_State_Flags; /** A status code for state functions. */ @@ -188,7 +186,6 @@ typedef const void* (*LV2_State_Retrieve_Function)( with meaningful types to avoid such problems in the future. */ typedef struct _LV2_State_Interface { - /** Save plugin state using a host-provided @p store callback. @@ -261,14 +258,12 @@ typedef struct _LV2_State_Interface { LV2_State_Handle handle, uint32_t flags, const LV2_Feature *const * features); - } LV2_State_Interface; /** Feature data for state:mapPath (LV2_STATE__mapPath). */ typedef struct { - /** Opaque host data. */ @@ -311,14 +306,12 @@ typedef struct { */ char* (*absolute_path)(LV2_State_Map_Path_Handle handle, const char* abstract_path); - } LV2_State_Map_Path; /** Feature data for state:makePath (@ref LV2_STATE__makePath). */ typedef struct { - /** Opaque host data. */ @@ -349,7 +342,6 @@ typedef struct { */ char* (*path)(LV2_State_Make_Path_Handle handle, const char* path); - } LV2_State_Make_Path; #ifdef __cplusplus diff --git a/src/carla-includes/lv2/ui.h b/src/carla-includes/lv2/ui.h index efe4eaf..d30e240 100644 --- a/src/carla-includes/lv2/ui.h +++ b/src/carla-includes/lv2/ui.h @@ -36,6 +36,7 @@ #define LV2_UI__Qt4UI LV2_UI_PREFIX "Qt4UI" #define LV2_UI__UI LV2_UI_PREFIX "UI" #define LV2_UI__X11UI LV2_UI_PREFIX "X11UI" +#define LV2_UI__binary LV2_UI_PREFIX "binary" #define LV2_UI__fixedSize LV2_UI_PREFIX "fixedSize" #define LV2_UI__noUserResize LV2_UI_PREFIX "noUserResize" #define LV2_UI__notifyType LV2_UI_PREFIX "notifyType" @@ -47,6 +48,7 @@ #define LV2_UI__portSubscribe LV2_UI_PREFIX "portSubscribe" #define LV2_UI__resize LV2_UI_PREFIX "resize" #define LV2_UI__touch LV2_UI_PREFIX "touch" +#define LV2_UI__ui LV2_UI_PREFIX "ui" /** The index returned by LV2_UI_Port_Port::port_index() for unknown ports. @@ -93,12 +95,12 @@ typedef void* LV2UI_Feature_Handle; The type of the host-provided function that the UI can use to send data to a plugin's input ports. - The @c buffer parameter must point to a block of data, @c buffer_size bytes + The @p buffer parameter must point to a block of data, @c buffer_size bytes large. The format of this data and how the host should use it is defined by - the @c port_protocol. This buffer is owned by the UI and is only valid for + the @p port_protocol. This buffer is owned by the UI and is only valid for the duration of this call. - The @c port_protocol parameter should either be 0 or the URID for a + The @p port_protocol parameter should either be 0 or the URID for a ui:PortProtocol. If it is 0, the protocol is implicitly ui:floatProtocol, the port must be an lv2:ControlPort input, @c buffer must point to a single float value, and @c buffer_size must be sizeof(float). @@ -120,114 +122,94 @@ typedef void (*LV2UI_Write_Function)(LV2UI_Controller controller, function. */ typedef struct _LV2UI_Descriptor { - /** - The URI for this UI (not for the plugin it controls). - */ - const char* URI; - - /** - Create a new UI object and return a handle to it. This function works - similarly to the instantiate() member in LV2_Descriptor. - - @param descriptor The descriptor for the UI that you want to instantiate. - - @param plugin_uri The URI of the plugin that this UI will control. - - @param bundle_path The path to the bundle containing the RDF data file - that references this shared object file, including the trailing '/'. - - @param write_function A function provided by the host that the UI can use - to send data to the plugin's input ports. - - @param controller A handle for the plugin instance that should be passed - as the first parameter of @c write_function. - - @param widget A pointer to an LV2UI_Widget. The UI will write a widget - pointer to this location (what type of widget depends on the RDF class of - the UI) that will be the main UI widget. - - @param features An array of LV2_Feature pointers. The host must pass all - feature URIs that it and the UI supports and any additional data, just - like in the LV2 plugin instantiate() function. Note that UI features and - plugin features are NOT necessarily the same, they just share the same - data structure - this will probably not be the same array as the one the - plugin host passes to a plugin. - - */ - LV2UI_Handle (*instantiate)(const struct _LV2UI_Descriptor* descriptor, - const char* plugin_uri, - const char* bundle_path, - LV2UI_Write_Function write_function, - LV2UI_Controller controller, - LV2UI_Widget* widget, - const LV2_Feature* const* features); - - - /** - Destroy the UI object and the associated widget. The host must not try - to access the widget after calling this function. - */ - void (*cleanup)(LV2UI_Handle ui); - - /** - Tell the UI that something interesting has happened at a plugin port. - - What is interesting and how it is written to the buffer passed to this - function is defined by the @c format parameter, which has the same meaning - as in LV2UI_Write_Function. The only exception is ports of the class - lv2:ControlPort, for which this function should be called when the port - value changes (it does not have to be called for every single change if - the host's UI thread has problems keeping up with the thread the plugin is - running in), @c buffer_size should be 4, the buffer should contain a - single IEEE-754 float, and @c format should be 0. - - By default, the host should only call this function for input ports of the - lv2:ControlPort class. However, the default setting can be modified by - using the following URIs in the UI's RDF data: -
-     uiext:portNotification
-     uiext:noPortNotification
-     uiext:plugin
-     uiext:portIndex
-     
- For example, if you want the UI with uri - for the plugin with URI - to get notified when the value of the - output control port with index 4 changes, you would use the following - in the RDF for your UI: -
-      uiext:portNotification [ uiext:plugin  ;
-     uiext:portIndex 4 ] .
-     
- and similarly with uiext:noPortNotification if you wanted - to prevent notifications for a port for which it would be on by default - otherwise. The UI is not allowed to request notifications for ports of - types for which no transfer mechanism is specified, if it does it should - be considered broken and the host should not load it. - - The @c buffer is only valid during the time of this function call, so if - the UI wants to keep it for later use it has to copy the contents to an - internal buffer. - - This member may be set to NULL if the UI is not interested in any - port events. - */ - void (*port_event)(LV2UI_Handle ui, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void* buffer); - - /** - Return a data structure associated with an extension URI, for example - a struct containing additional function pointers. - - Avoid returning function pointers directly since standard C/C++ has no - valid way of casting a void* to a function pointer. This member may be set - to NULL if the UI is not interested in supporting any extensions. This is - similar to the extension_data() member in LV2_Descriptor. - */ - const void* (*extension_data)(const char* uri); + /** + The URI for this UI (not for the plugin it controls). + */ + const char* URI; + + /** + Create a new UI object and return a handle to it. This function works + similarly to the instantiate() member in LV2_Descriptor. + + @param descriptor The descriptor for the UI that you want to instantiate. + + @param plugin_uri The URI of the plugin that this UI will control. + + @param bundle_path The path to the bundle containing the RDF data file + that references this shared object file, including the trailing '/'. + + @param write_function A function provided by the host that the UI can use + to send data to the plugin's input ports. + + @param controller A handle for the plugin instance that should be passed + as the first parameter of @p write_function. + + @param widget A pointer to an LV2UI_Widget. The UI will write a widget + pointer to this location (what type of widget depends on the RDF class of + the UI) that will be the main UI widget. + + @param features An array of LV2_Feature pointers. The host must pass all + feature URIs that it and the UI supports and any additional data, just + like in the LV2 plugin instantiate() function. Note that UI features and + plugin features are NOT necessarily the same, they just share the same + data structure - this will probably not be the same array as the one the + plugin host passes to a plugin. + + */ + LV2UI_Handle (*instantiate)(const struct _LV2UI_Descriptor* descriptor, + const char* plugin_uri, + const char* bundle_path, + LV2UI_Write_Function write_function, + LV2UI_Controller controller, + LV2UI_Widget* widget, + const LV2_Feature* const* features); + + + /** + Destroy the UI object and the associated widget. The host must not try + to access the widget after calling this function. + */ + void (*cleanup)(LV2UI_Handle ui); + + /** + Tell the UI that something interesting has happened at a plugin port. + + What is interesting and how it is written to the buffer passed to this + function is defined by the @p format parameter, which has the same + meaning as in LV2UI_Write_Function. The only exception is ports of the + class lv2:ControlPort, for which this function should be called when the + port value changes (it does not have to be called for every single change + if the host's UI thread has problems keeping up with the thread the + plugin is running in), @p buffer_size should be 4, the buffer should + contain a single IEEE-754 float, and @p format should be 0. + + By default, the host should only call this function for input ports of + the lv2:ControlPort class. However, this can be modified by using + ui:portNotification in the UI data, or the ui:portSubscribe feature. + + The @p buffer is only valid during the time of this function call, so if + the UI wants to keep it for later use it has to copy the contents to an + internal buffer. + + This member may be set to NULL if the UI is not interested in any + port events. + */ + void (*port_event)(LV2UI_Handle ui, + uint32_t port_index, + uint32_t buffer_size, + uint32_t format, + const void* buffer); + + /** + Return a data structure associated with an extension URI, for example + a struct containing additional function pointers. + + Avoid returning function pointers directly since standard C/C++ has no + valid way of casting a void* to a function pointer. This member may be set + to NULL if the UI is not interested in supporting any extensions. This is + similar to the extension_data() member in LV2_Descriptor. + */ + const void* (*extension_data)(const char* uri); } LV2UI_Descriptor; /** @@ -295,18 +277,19 @@ typedef struct _LV2UI_Port_Subscribe { This means that the host will call the UI's port_event() function when the port value changes (as defined by protocol). - Calling this function with the same @c port_index and @c port_protocol + Calling this function with the same @p port_index and @p port_protocol as an already active subscription has no effect. @param handle The handle field of this struct. @param port_index The index of the port. @param port_protocol The URID of the ui:PortProtocol. - @param data Extra data as defined by the port protocol, or NULL. + @param features Features for this subscription. + @return 0 on success. */ - void (*subscribe)(LV2UI_Feature_Handle handle, - uint32_t port_index, - uint32_t port_protocol, - const void* options); + uint32_t (*subscribe)(LV2UI_Feature_Handle handle, + uint32_t port_index, + uint32_t port_protocol, + const LV2_Feature* const* features); /** Unsubscribe from updates for a port. @@ -314,18 +297,19 @@ typedef struct _LV2UI_Port_Subscribe { This means that the host will cease calling calling port_event() when the port value changes. - Calling this function with a @c port_index and @c port_protocol that + Calling this function with a @p port_index and @p port_protocol that does not refer to an active port subscription has no effect. @param handle The handle field of this struct. @param port_index The index of the port. @param port_protocol The URID of the ui:PortProtocol. - @param data Extra data as defined by the port protocol, or NULL. + @param features Features for this subscription. + @return 0 on success. */ - void (*unsubscribe)(LV2UI_Feature_Handle handle, - uint32_t port_index, - uint32_t port_protocol, - const void* options); + uint32_t (*unsubscribe)(LV2UI_Feature_Handle handle, + uint32_t port_index, + uint32_t port_protocol, + const LV2_Feature* const* features); } LV2UI_Port_Subscribe; /** diff --git a/src/carla-includes/lv2/uri-map.h b/src/carla-includes/lv2/uri-map.h index 6767cd1..d1dc2f7 100644 --- a/src/carla-includes/lv2/uri-map.h +++ b/src/carla-includes/lv2/uri-map.h @@ -17,7 +17,7 @@ /** @file C header for the LV2 URI Map extension . - + This extension defines a simple mechanism for plugins to map URIs to integers, usually for performance reasons (e.g. processing events typed by URIs in real time). The expected use case is for plugins to map URIs to @@ -41,16 +41,15 @@ typedef void* LV2_URI_Map_Callback_Data; /** URI Map Feature. - + To support this feature the host must pass an LV2_Feature struct to the plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map" and data pointed to an instance of this struct. */ typedef struct { - /** Opaque pointer to host data. - + The plugin MUST pass this to any call to functions in this struct. Otherwise, it must not be interpreted in any way. */ @@ -58,7 +57,7 @@ typedef struct { /** Get the numeric ID of a URI from the host. - + @param callback_data Must be the callback_data member of this struct. @param map The 'context' of this URI. Certain extensions may define a URI that must be passed here with certain restrictions on the return @@ -67,14 +66,14 @@ typedef struct { unless there is a specific need to do so, e.g. to restrict the range of the returned value. @param uri The URI to be mapped to an integer ID. - + This function is referentially transparent; any number of calls with the same arguments is guaranteed to return the same value over the life of a plugin instance (though the same URI may return different values with a different map parameter). However, this function is not necessarily very fast: plugins SHOULD cache any IDs they might need in performance critical situations. - + The return value 0 is reserved and indicates that an ID for that URI could not be created for whatever reason. Extensions MAY define more precisely what this means in a certain context, but in general plugins @@ -86,7 +85,6 @@ typedef struct { uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri); - } LV2_URI_Map_Feature; #endif /* LV2_URI_MAP_H */ diff --git a/src/carla-includes/lv2/urid.h b/src/carla-includes/lv2/urid.h index edf047f..b4be712 100644 --- a/src/carla-includes/lv2/urid.h +++ b/src/carla-includes/lv2/urid.h @@ -1,6 +1,6 @@ /* + Copyright 2008-2012 David Robillard Copyright 2011 Gabriel M. Beddingfield - Copyright 2008-2011 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,7 @@ */ /** - @file + @file urid.h C header for the LV2 URID extension */ @@ -51,9 +51,9 @@ typedef void* LV2_URID_Unmap_Handle; typedef uint32_t LV2_URID; /** - URI Map (http://lv2plug.in/ns/ext/urid#map). + URID Map Feature (LV2_URID__map) */ -typedef struct { +typedef struct _LV2_URID_Map { /** Opaque pointer to host data. @@ -88,9 +88,9 @@ typedef struct { } LV2_URID_Map; /** - URI Unmap (http://lv2plug.in/ns/ext/urid#unmap). + URI Unmap Feature (LV2_URID__unmap) */ -typedef struct { +typedef struct _LV2_URID_Unmap { /** Opaque pointer to host data. @@ -102,11 +102,11 @@ typedef struct { /** Get the URI for a previously mapped numeric ID. - Returns NULL if @c urid is not yet mapped. Otherwise, the corresponding + Returns NULL if @p urid is not yet mapped. Otherwise, the corresponding URI is returned in a canonical form. This MAY not be the exact same string that was originally passed to LV2_URID_Map::map(), but it MUST be an identical URI according to the URI syntax specification (RFC3986). A - non-NULL return for a given @c urid will always be the same for the life + non-NULL return for a given @p urid will always be the same for the life of the plugin. Plugins that intend to perform string comparison on unmapped URIs SHOULD first canonicalise URI strings with a call to map_uri() followed by a call to unmap_uri(). diff --git a/src/carla/lv2.cpp b/src/carla/lv2.cpp index 74811e2..7871656 100644 --- a/src/carla/lv2.cpp +++ b/src/carla/lv2.cpp @@ -28,10 +28,12 @@ #include "lv2/event.h" #include "lv2/event-helpers.h" #include "lv2/instance-access.h" +#include "lv2/midi.h" #include "lv2/state.h" +#include "lv2/time.h" +#include "lv2/ui.h" #include "lv2/uri-map.h" #include "lv2/urid.h" -#include "lv2/ui.h" #include "lv2/lv2-miditype.h" #include "lv2/lv2-midifunctions.h"