DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d46109f4817b420c9f10299e3ce475a0d5aa3e0e
parent 99b5d507925f6ac9d3d4cc7796e5ece78af612e3
Author: falkTX <falktx@falktx.com>
Date:   Wed, 29 Sep 2021 12:35:56 +0100

Remove unused LV2 headers, they are GPL licensed

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Ddistrho/src/lv2/atom-helpers.h | 249-------------------------------------------------------------------------------
Ddistrho/src/lv2/lv2-midifunctions.h | 98-------------------------------------------------------------------------------
Ddistrho/src/lv2/lv2-miditype.h | 175-------------------------------------------------------------------------------
3 files changed, 0 insertions(+), 522 deletions(-)

diff --git a/distrho/src/lv2/atom-helpers.h b/distrho/src/lv2/atom-helpers.h @@ -1,249 +0,0 @@ -// lv2_atom_helpers.h -// -/**************************************************************************** - Copyright (C) 2005-2013, rncbc aka Rui Nuno Capela. All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -*****************************************************************************/ - -/* Helper functions for LV2 atom:Sequence event buffer. - * - * tentatively adapted from: - * - * - lv2_evbuf.h,c - An abstract/opaque LV2 event buffer implementation. - * - * - event-helpers.h - Helper functions for the LV2 Event extension. - * <http://lv2plug.in/ns/ext/event> - * - * Copyright 2008-2012 David Robillard <http://drobilla.net> - */ - -#ifndef LV2_ATOM_HELPERS_H -#define LV2_ATOM_HELPERS_H - -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include <stdlib.h> -#include <assert.h> - -#include "atom-util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// An abstract/opaque LV2 atom:Sequence buffer. -// -typedef -struct _LV2_Atom_Buffer -{ - uint32_t capacity; - uint32_t chunk_type; - uint32_t sequence_type; - LV2_Atom_Sequence atoms; - -} LV2_Atom_Buffer; - - -// Clear and initialize an existing LV2 atom:Sequenece buffer. -// -static inline -void lv2_atom_buffer_reset ( LV2_Atom_Buffer *buf, bool input ) -{ - if (input) { - buf->atoms.atom.size = sizeof(LV2_Atom_Sequence_Body); - buf->atoms.atom.type = buf->sequence_type; - } else { - buf->atoms.atom.size = buf->capacity; - buf->atoms.atom.type = buf->chunk_type; - } -} - - -// Allocate a new, empty LV2 atom:Sequence buffer. -// -static inline -LV2_Atom_Buffer *lv2_atom_buffer_new ( - uint32_t capacity, uint32_t chunk_type, uint32_t sequence_type, bool input ) -{ - LV2_Atom_Buffer *buf = (LV2_Atom_Buffer *) - malloc(sizeof(LV2_Atom_Buffer) + sizeof(LV2_Atom_Sequence) + capacity); - - buf->capacity = capacity; - buf->chunk_type = chunk_type; - buf->sequence_type = sequence_type; - - lv2_atom_buffer_reset(buf, input); - - return buf; -} - - -// Free an LV2 atom:Sequenece buffer allocated with lv2_atome_buffer_new. -// -static inline -void lv2_atom_buffer_free ( LV2_Atom_Buffer *buf ) -{ - free(buf); -} - - -// Return the total padded size of events stored in a LV2 atom:Sequence buffer. -// -static inline -uint32_t lv2_atom_buffer_get_size ( LV2_Atom_Buffer *buf ) -{ - if (buf->atoms.atom.type == buf->sequence_type) - return buf->atoms.atom.size - uint32_t(sizeof(LV2_Atom_Sequence_Body)); - else - return 0; -} - - -// Return the actual LV2 atom:Sequence implementation. -// -static inline -LV2_Atom_Sequence *lv2_atom_buffer_get_sequence ( LV2_Atom_Buffer *buf ) -{ - return &buf->atoms; -} - - -// An iterator over an atom:Sequence buffer. -// -typedef -struct _LV2_Atom_Buffer_Iterator -{ - LV2_Atom_Buffer *buf; - uint32_t offset; - -} LV2_Atom_Buffer_Iterator; - - -// Reset an iterator to point to the start of an LV2 atom:Sequence buffer. -// -static inline -bool lv2_atom_buffer_begin ( - LV2_Atom_Buffer_Iterator *iter, LV2_Atom_Buffer *buf ) -{ - iter->buf = buf; - iter->offset = 0; - - return (buf->atoms.atom.size > 0); -} - - -// Reset an iterator to point to the end of an LV2 atom:Sequence buffer. -// -static inline -bool lv2_atom_buffer_end ( - LV2_Atom_Buffer_Iterator *iter, LV2_Atom_Buffer *buf ) -{ - iter->buf = buf; - iter->offset = lv2_atom_pad_size(lv2_atom_buffer_get_size(buf)); - - return (iter->offset < buf->capacity - sizeof(LV2_Atom_Event)); -} - - -// Check if a LV2 atom:Sequenece buffer iterator is valid. -// -static inline -bool lv2_atom_buffer_is_valid ( LV2_Atom_Buffer_Iterator *iter ) -{ - return iter->offset < lv2_atom_buffer_get_size(iter->buf); -} - - -// Advance a LV2 atom:Sequenece buffer iterator forward one event. -// -static inline -bool lv2_atom_buffer_increment ( LV2_Atom_Buffer_Iterator *iter ) -{ - if (!lv2_atom_buffer_is_valid(iter)) - return false; - - LV2_Atom_Buffer *buf = iter->buf; - LV2_Atom_Sequence *atoms = &buf->atoms; - uint32_t size = ((LV2_Atom_Event *) ((char *) - LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + iter->offset))->body.size; - iter->offset += lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size); - - return true; -} - - -// Get the event currently pointed at a LV2 atom:Sequence buffer iterator. -// -static inline -LV2_Atom_Event *lv2_atom_buffer_get ( - LV2_Atom_Buffer_Iterator *iter, uint8_t **data ) -{ - if (!lv2_atom_buffer_is_valid(iter)) - return NULL; - - LV2_Atom_Buffer *buf = iter->buf; - LV2_Atom_Sequence *atoms = &buf->atoms; - LV2_Atom_Event *ev = (LV2_Atom_Event *) ((char *) - LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + iter->offset); - - *data = (uint8_t *) LV2_ATOM_BODY(&ev->body); - - return ev; -} - - -// Write an event at a LV2 atom:Sequence buffer iterator. - -static inline -bool lv2_atom_buffer_write ( - LV2_Atom_Buffer_Iterator *iter, - uint32_t frames, - uint32_t /*subframes*/, - uint32_t type, - uint32_t size, - const uint8_t *data ) -{ - LV2_Atom_Buffer *buf = iter->buf; - LV2_Atom_Sequence *atoms = &buf->atoms; - if (buf->capacity - sizeof(LV2_Atom) - atoms->atom.size - < sizeof(LV2_Atom_Event) + size) - return false; - - LV2_Atom_Event *ev = (LV2_Atom_Event*) ((char *) - LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + iter->offset); - - ev->time.frames = frames; - ev->body.type = type; - ev->body.size = size; - - memcpy(LV2_ATOM_BODY(&ev->body), data, size); - - size = lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size); - atoms->atom.size += size; - iter->offset += size; - - return true; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif // LV2_ATOM_HELPERS_H - -// end of lv2_atom_helpers.h diff --git a/distrho/src/lv2/lv2-midifunctions.h b/distrho/src/lv2/lv2-midifunctions.h @@ -1,98 +0,0 @@ -/**************************************************************************** - - lv2-midifunctions.h - support file for using MIDI in LV2 plugins - - Copyright (C) 2006 Lars Luthman <lars.luthman@gmail.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA - -****************************************************************************/ - -#ifndef LV2_MIDIFUNCTIONS -#define LV2_MIDIFUNCTIONS - -#include "lv2-miditype.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - LV2_MIDI* midi; - uint32_t frame_count; - uint32_t position; -} LV2_MIDIState; - - -inline double lv2midi_get_event(LV2_MIDIState* state, - double* timestamp, - uint32_t* size, - unsigned char** data) { - - if (state->position >= state->midi->size) { - state->position = state->midi->size; - *timestamp = state->frame_count; - *size = 0; - *data = NULL; - return *timestamp; - } - - *timestamp = *(double*)(state->midi->data + state->position); - *size = (uint32_t)*(size_t*)(state->midi->data + state->position + sizeof(double)); - *data = state->midi->data + state->position + - sizeof(double) + sizeof(size_t); - return *timestamp; -} - - -inline double lv2midi_step(LV2_MIDIState* state) { - - if (state->position >= state->midi->size) { - state->position = state->midi->size; - return state->frame_count; - } - - state->position += (uint32_t)sizeof(double); - size_t size = *(size_t*)(state->midi->data + state->position); - state->position += (uint32_t)sizeof(size_t); - state->position += (uint32_t)size; - return *(double*)(state->midi->data + state->position); -} - - -inline void lv2midi_put_event(LV2_MIDIState* state, - double timestamp, - uint32_t size, - const unsigned char* data) { - - if (state->midi->size + sizeof(double) + sizeof(size_t) + size < state->midi->capacity) - { - *((double*)(state->midi->data + state->midi->size)) = timestamp; - state->midi->size += (uint32_t)sizeof(double); - *((size_t*)(state->midi->data + state->midi->size)) = size; - state->midi->size += (uint32_t)sizeof(size_t); - memcpy(state->midi->data + state->midi->size, data, size); - - state->midi->size += size; - state->midi->event_count++; - } -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/distrho/src/lv2/lv2-miditype.h b/distrho/src/lv2/lv2-miditype.h @@ -1,175 +0,0 @@ -/**************************************************************************** - - lv2-miditype.h - header file for using MIDI in LV2 plugins - - Copyright (C) 2006 Lars Luthman <lars.luthman@gmail.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA - -****************************************************************************/ - -#ifndef LV2_MIDITYPE_H -#define LV2_MIDITYPE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** This data structure is used to contain the MIDI events for one run() - cycle. The port buffer for a LV2 port that has the datatype - <http://ll-plugins.nongnu.org/lv2/ext/miditype> should be a pointer - to an instance of this struct. - - To store two Note On events on MIDI channel 0 in a buffer, with timestamps - 12 and 35.5, you could use something like this code (assuming that - midi_data is a variable of type LV2_MIDI): - @code - - size_t buffer_offset = 0; - *(double*)(midi_data->data + buffer_offset) = 12; - buffer_offset += sizeof(double); - *(size_t*)(midi_data->data + buffer_offset) = 3; - buffer_offset += sizeof(size_t); - midi_data->data[buffer_offset++] = 0x90; - midi_data->data[buffer_offset++] = 0x48; - midi_data->data[buffer_offset++] = 0x64; - ++midi_data->event_count; - - *(double*)(midi_data->data + buffer_offset) = 35.5; - buffer_offset += sizeof(double); - *(size_t*)(midi_data->data + buffer_offset) = 3; - buffer_offset += sizeof(size_t); - midi_data->data[buffer_offset++] = 0x90; - midi_data->data[buffer_offset++] = 0x55; - midi_data->data[buffer_offset++] = 0x64; - ++midi_data->event_count; - - midi_data->size = buffer_offset; - - @endcode - - This would be done by the host in the case of an input port, and by the - plugin in the case of an output port. Whoever is writing events to the - buffer must also take care not to exceed the capacity of the data buffer. - - To read events from a buffer, you could do something like this: - @code - - size_t buffer_offset = 0; - uint32_t i; - for (i = 0; i < midi_data->event_count; ++i) { - double timestamp = *(double*)(midi_data->data + buffer_offset); - buffer_offset += sizeof(double); - size_t size = *(size_t*)(midi_data->data + buffer_offset); - buffer_offset += sizeof(size_t); - do_something_with_event(timestamp, size, - midi_data->data + buffer_offset); - buffer_offset += size; - } - - @endcode -*/ -typedef struct { - - /** The number of MIDI events in the data buffer. - INPUT PORTS: It's the host's responsibility to set this field to the - number of MIDI events contained in the data buffer before calling the - plugin's run() function. The plugin may not change this field. - OUTPUT PORTS: It's the plugin's responsibility to set this field to the - number of MIDI events it has stored in the data buffer before returning - from the run() function. Any initial value should be ignored by the - plugin. - */ - uint32_t event_count; - - /** The size of the data buffer in bytes. It is set by the host and may not - be changed by the plugin. The host is allowed to change this between - run() calls. - */ - uint32_t capacity; - - /** The size of the initial part of the data buffer that actually contains - data. - INPUT PORTS: It's the host's responsibility to set this field to the - number of bytes used by all MIDI events it has written to the buffer - (including timestamps and size fields) before calling the plugin's - run() function. The plugin may not change this field. - OUTPUT PORTS: It's the plugin's responsibility to set this field to - the number of bytes used by all MIDI events it has written to the - buffer (including timestamps and size fields) before returning from - the run() function. Any initial value should be ignored by the plugin. - */ - uint32_t size; - - /** The data buffer that is used to store MIDI events. The events are packed - after each other, and the format of each event is as follows: - - First there is a timestamp, which should have the type "double", - i.e. have the same bit size as a double and the same bit layout as a - double (whatever that is on the current platform). This timestamp gives - the offset from the beginning of the current cycle, in frames, that - the MIDI event occurs on. It must be strictly smaller than the 'nframes' - parameter to the current run() call. The MIDI events in the buffer must - be ordered by their timestamp, e.g. an event with a timestamp of 123.23 - must be stored after an event with a timestamp of 65.0. - - The second part of the event is a size field, which should have the type - "size_t" (as defined in the standard C header stddef.h). It should - contain the size of the MIDI data for this event, i.e. the number of - bytes used to store the actual MIDI event. The bytes used by the - timestamp and the size field should not be counted. - - The third part of the event is the actual MIDI data. There are some - requirements that must be followed: - - * Running status is not allowed. Every event must have its own status - byte. - * Note On events with velocity 0 are not allowed. These events are - equivalent to Note Off in standard MIDI streams, but in order to make - plugins and hosts easier to write, as well as more efficient, only - proper Note Off events are allowed as Note Off. - * "Realtime events" (status bytes 0xF8 to 0xFF) are allowed, but may not - occur inside other events like they are allowed to in hardware MIDI - streams. - * All events must be fully contained in a single data buffer, i.e. events - may not "wrap around" by storing the first few bytes in one buffer and - then wait for the next run() call to store the rest of the event. If - there isn't enough space in the current data buffer to store an event, - the event will either have to wait until next run() call, be ignored, - or compensated for in some more clever way. - * All events must be valid MIDI events. This means for example that - only the first byte in each event (the status byte) may have the eighth - bit set, that Note On and Note Off events are always 3 bytes long etc. - The MIDI writer (host or plugin) is responsible for writing valid MIDI - events to the buffer, and the MIDI reader (plugin or host) can assume - that all events are valid. - - On a platform where double is 8 bytes and size_t is 4 bytes, the data - buffer layout for a 3-byte event followed by a 4-byte event may look - something like this: - _______________________________________________________________ - | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... - |TIMESTAMP 1 |SIZE 1 |DATA |TIMESTAMP 2 |SIZE 2 |DATA | ... - - */ - unsigned char* data; - -} LV2_MIDI; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif