@@ -37,8 +37,8 @@ c++/carla-includes/vst/ | |||||
c++/jackmeter/cadence_jackmeter | c++/jackmeter/cadence_jackmeter | ||||
c++/xycontroller/cadence_xycontroller | c++/xycontroller/cadence_xycontroller | ||||
c++/*/*-build-*-Debug/ | |||||
c++/*/*-build-*-Release/ | |||||
*-build-*Debug/ | |||||
*-build-*Release/ | |||||
src/resources_rc.py | src/resources_rc.py | ||||
resources/qrc_resources.cpp | resources/qrc_resources.cpp | ||||
@@ -224,7 +224,6 @@ install: | |||||
data/cadence_logs \ | data/cadence_logs \ | ||||
data/cadence_pulse2jack \ | data/cadence_pulse2jack \ | ||||
data/cadence_render \ | data/cadence_render \ | ||||
data/cadence-aloop-daemon \ | |||||
data/catarina \ | data/catarina \ | ||||
data/catia \ | data/catia \ | ||||
data/claudia \ | data/claudia \ | ||||
@@ -235,6 +234,8 @@ install: | |||||
c++/carla-discovery/carla-discovery-* \ | c++/carla-discovery/carla-discovery-* \ | ||||
c++/jackmeter/cadence_jackmeter \ | c++/jackmeter/cadence_jackmeter \ | ||||
c++/xycontroller/cadence_xycontroller \ | c++/xycontroller/cadence_xycontroller \ | ||||
src/cadence-aloop-daemon \ | |||||
src/cadence-unity-support \ | |||||
$(DESTDIR)$(PREFIX)/bin/ | $(DESTDIR)$(PREFIX)/bin/ | ||||
# Install desktop files | # Install desktop files | ||||
@@ -309,17 +310,11 @@ install: | |||||
$(DESTDIR)$(PREFIX)/bin/carla-control | $(DESTDIR)$(PREFIX)/bin/carla-control | ||||
uninstall: | uninstall: | ||||
rm -f $(DESTDIR)$(PREFIX)/bin/cadence | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/cadence_* | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/cadence-aloop-daemon | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/cadence* | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/catarina | rm -f $(DESTDIR)$(PREFIX)/bin/catarina | ||||
rm -f $(DESTDIR)$(PREFIX)/bin/catia | rm -f $(DESTDIR)$(PREFIX)/bin/catia | ||||
rm -f $(DESTDIR)$(PREFIX)/bin/claudia | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/claudia-launcher | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/carla | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/carla-control | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/carla-bridge-* | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/carla-discovery-* | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/claudia* | |||||
rm -f $(DESTDIR)$(PREFIX)/bin/carla* | |||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/cadence.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/cadence.desktop | ||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/catarina.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/catarina.desktop | ||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/catia.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/catia.desktop | ||||
@@ -327,34 +322,13 @@ uninstall: | |||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/claudia-launcher.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/claudia-launcher.desktop | ||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/carla.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/carla.desktop | ||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/carla-control.desktop | rm -f $(DESTDIR)$(PREFIX)/share/applications/carla-control.desktop | ||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/cadence.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/catarina.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/catia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/claudia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/claudia-launcher.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/carla.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/carla-control.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/cadence.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/catarina.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/catia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/claudia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/claudia-launcher.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/carla.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/carla-control.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/cadence.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/catarina.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/catia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/claudia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/claudia-launcher.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/carla.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/carla-control.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/cadence.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/catarina.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/catia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/claudia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/claudia-launcher.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/carla.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/carla-control.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/cadence.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/catarina.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/catia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/claudia.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/claudia-launcher.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/carla.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/carla-control.png | |||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/cadence.svg | rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/cadence.svg | ||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catarina.svg | rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catarina.svg | ||||
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catia.svg | rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catia.svg | ||||
@@ -16,8 +16,6 @@ HAVE_SUIL = $(shell pkg-config --exists suil-0 && echo true) | |||||
BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -mfpmath=sse -Wall -I. -I../carla-includes | BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -mfpmath=sse -Wall -I. -I../carla-includes | ||||
CARLA_C_FLAGS = $(BASE_FLAGS) $(CFLAGS) | |||||
CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | ||||
CARLA_CXX_FLAGS += -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT # -DNDEBUG | CARLA_CXX_FLAGS += -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT # -DNDEBUG | ||||
@@ -68,7 +66,6 @@ OBJS = \ | |||||
carla_shared.o \ | carla_shared.o \ | ||||
carla_threads.o \ | carla_threads.o \ | ||||
ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ | ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ | ||||
lv2-rtmempool/rtmempool.o \ | |||||
../carla-lilv/carla_lilv.a | ../carla-lilv/carla_lilv.a | ||||
ifeq ($(WANT_RTAUDIO),true) | ifeq ($(WANT_RTAUDIO),true) | ||||
@@ -89,9 +86,6 @@ carla_backend.so: $(OBJS) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
.c.o: | |||||
$(CC) -c $< $(CARLA_C_FLAGS) -o $@ | |||||
.cpp.o: | .cpp.o: | ||||
$(CXX) -c $< $(CARLA_CXX_FLAGS) -o $@ | $(CXX) -c $< $(CARLA_CXX_FLAGS) -o $@ | ||||
@@ -16,8 +16,6 @@ HAVE_SUIL = $(shell pkg-config --exists suil-0 && echo true) | |||||
BASE_FLAGS = -O0 -g -fPIC -Wall -I. -I../carla-includes | BASE_FLAGS = -O0 -g -fPIC -Wall -I. -I../carla-includes | ||||
CARLA_C_FLAGS = $(BASE_FLAGS) $(CFLAGS) | |||||
CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | CARLA_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtGui) | ||||
CARLA_CXX_FLAGS += -DDEBUG | CARLA_CXX_FLAGS += -DDEBUG | ||||
@@ -68,7 +66,6 @@ OBJS = \ | |||||
carla_shared.o \ | carla_shared.o \ | ||||
carla_threads.o \ | carla_threads.o \ | ||||
ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ | ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ | ||||
lv2-rtmempool/rtmempool.o \ | |||||
../carla-lilv/carla_lilv.a | ../carla-lilv/carla_lilv.a | ||||
ifeq ($(WANT_RTAUDIO),true) | ifeq ($(WANT_RTAUDIO),true) | ||||
@@ -90,9 +87,6 @@ carla_backend.so: $(OBJS) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
.c.o: | |||||
$(CC) -c $< $(CARLA_C_FLAGS) -o $@ | |||||
.cpp.o: | .cpp.o: | ||||
$(CXX) -c $< $(CARLA_CXX_FLAGS) -o $@ | $(CXX) -c $< $(CARLA_CXX_FLAGS) -o $@ | ||||
@@ -1,872 +0,0 @@ | |||||
/* -*- Mode: C ; c-basic-offset: 2 -*- */ | |||||
/***************************************************************************** | |||||
* | |||||
* Linux kernel header adapted for user-mode | |||||
* The 2.6.17-rt1 version was used. | |||||
* | |||||
* Original copyright holders of this code are unknown, they were not | |||||
* mentioned in the original file. | |||||
* | |||||
* 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; version 2 of the License | |||||
* | |||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA. | |||||
* | |||||
*****************************************************************************/ | |||||
#ifndef _LINUX_LIST_H | |||||
#define _LINUX_LIST_H | |||||
#include <stddef.h> | |||||
#if !defined(offsetof) | |||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |||||
#endif | |||||
/** | |||||
* container_of - cast a member of a structure out to the containing structure | |||||
* @ptr: the pointer to the member. | |||||
* @type: the type of the container struct this is embedded in. | |||||
* @member: the name of the member within the struct. | |||||
* | |||||
*/ | |||||
#define container_of(ptr, type, member) (type *)((char *)(ptr) - offsetof(type,member)) | |||||
#define prefetch(x) (x = x) | |||||
/* | |||||
* These are non-NULL pointers that will result in page faults | |||||
* under normal circumstances, used to verify that nobody uses | |||||
* non-initialized list entries. | |||||
*/ | |||||
#define LIST_POISON1 ((void *) 0x00100100) | |||||
#define LIST_POISON2 ((void *) 0x00200200) | |||||
/* | |||||
* Simple doubly linked list implementation. | |||||
* | |||||
* Some of the internal functions ("__xxx") are useful when | |||||
* manipulating whole lists rather than single entries, as | |||||
* sometimes we already know the next/prev entries and we can | |||||
* generate better code by using them directly rather than | |||||
* using the generic single-entry routines. | |||||
*/ | |||||
struct list_head { | |||||
struct list_head *next, *prev; | |||||
}; | |||||
#define LIST_HEAD_INIT(name) { &(name), &(name) } | |||||
#define LIST_HEAD(name) \ | |||||
struct list_head name = LIST_HEAD_INIT(name) | |||||
static inline void INIT_LIST_HEAD(struct list_head *list) | |||||
{ | |||||
list->next = list; | |||||
list->prev = list; | |||||
} | |||||
/* | |||||
* Insert a new entry between two known consecutive entries. | |||||
* | |||||
* This is only for internal list manipulation where we know | |||||
* the prev/next entries already! | |||||
*/ | |||||
static inline void __list_add(struct list_head *new, | |||||
struct list_head *prev, | |||||
struct list_head *next) | |||||
{ | |||||
next->prev = new; | |||||
new->next = next; | |||||
new->prev = prev; | |||||
prev->next = new; | |||||
} | |||||
/** | |||||
* list_add - add a new entry | |||||
* @new: new entry to be added | |||||
* @head: list head to add it after | |||||
* | |||||
* Insert a new entry after the specified head. | |||||
* This is good for implementing stacks. | |||||
*/ | |||||
static inline void list_add(struct list_head *new, struct list_head *head) | |||||
{ | |||||
__list_add(new, head, head->next); | |||||
} | |||||
/** | |||||
* list_add_tail - add a new entry | |||||
* @new: new entry to be added | |||||
* @head: list head to add it before | |||||
* | |||||
* Insert a new entry before the specified head. | |||||
* This is useful for implementing queues. | |||||
*/ | |||||
static inline void list_add_tail(struct list_head *new, struct list_head *head) | |||||
{ | |||||
__list_add(new, head->prev, head); | |||||
} | |||||
/* | |||||
* Insert a new entry between two known consecutive entries. | |||||
* | |||||
* This is only for internal list manipulation where we know | |||||
* the prev/next entries already! | |||||
*/ | |||||
static inline void __list_add_rcu(struct list_head * new, | |||||
struct list_head * prev, struct list_head * next) | |||||
{ | |||||
new->next = next; | |||||
new->prev = prev; | |||||
// smp_wmb(); | |||||
next->prev = new; | |||||
prev->next = new; | |||||
} | |||||
/** | |||||
* list_add_rcu - add a new entry to rcu-protected list | |||||
* @new: new entry to be added | |||||
* @head: list head to add it after | |||||
* | |||||
* Insert a new entry after the specified head. | |||||
* This is good for implementing stacks. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as list_add_rcu() | |||||
* or list_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* list_for_each_entry_rcu(). | |||||
*/ | |||||
static inline void list_add_rcu(struct list_head *new, struct list_head *head) | |||||
{ | |||||
__list_add_rcu(new, head, head->next); | |||||
} | |||||
/** | |||||
* list_add_tail_rcu - add a new entry to rcu-protected list | |||||
* @new: new entry to be added | |||||
* @head: list head to add it before | |||||
* | |||||
* Insert a new entry before the specified head. | |||||
* This is useful for implementing queues. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as list_add_tail_rcu() | |||||
* or list_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* list_for_each_entry_rcu(). | |||||
*/ | |||||
static inline void list_add_tail_rcu(struct list_head *new, | |||||
struct list_head *head) | |||||
{ | |||||
__list_add_rcu(new, head->prev, head); | |||||
} | |||||
/* | |||||
* Delete a list entry by making the prev/next entries | |||||
* point to each other. | |||||
* | |||||
* This is only for internal list manipulation where we know | |||||
* the prev/next entries already! | |||||
*/ | |||||
static inline void __list_del(struct list_head * prev, struct list_head * next) | |||||
{ | |||||
next->prev = prev; | |||||
prev->next = next; | |||||
} | |||||
/** | |||||
* list_del - deletes entry from list. | |||||
* @entry: the element to delete from the list. | |||||
* Note: list_empty on entry does not return true after this, the entry is | |||||
* in an undefined state. | |||||
*/ | |||||
static inline void list_del(struct list_head *entry) | |||||
{ | |||||
__list_del(entry->prev, entry->next); | |||||
entry->next = LIST_POISON1; | |||||
entry->prev = LIST_POISON2; | |||||
} | |||||
/** | |||||
* list_del_rcu - deletes entry from list without re-initialization | |||||
* @entry: the element to delete from the list. | |||||
* | |||||
* Note: list_empty on entry does not return true after this, | |||||
* the entry is in an undefined state. It is useful for RCU based | |||||
* lockfree traversal. | |||||
* | |||||
* In particular, it means that we can not poison the forward | |||||
* pointers that may still be used for walking the list. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as list_del_rcu() | |||||
* or list_add_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* list_for_each_entry_rcu(). | |||||
* | |||||
* Note that the caller is not permitted to immediately free | |||||
* the newly deleted entry. Instead, either synchronize_rcu() | |||||
* or call_rcu() must be used to defer freeing until an RCU | |||||
* grace period has elapsed. | |||||
*/ | |||||
static inline void list_del_rcu(struct list_head *entry) | |||||
{ | |||||
__list_del(entry->prev, entry->next); | |||||
entry->prev = LIST_POISON2; | |||||
} | |||||
/* | |||||
* list_replace_rcu - replace old entry by new one | |||||
* @old : the element to be replaced | |||||
* @new : the new element to insert | |||||
* | |||||
* The old entry will be replaced with the new entry atomically. | |||||
*/ | |||||
static inline void list_replace_rcu(struct list_head *old, | |||||
struct list_head *new) | |||||
{ | |||||
new->next = old->next; | |||||
new->prev = old->prev; | |||||
// smp_wmb(); | |||||
new->next->prev = new; | |||||
new->prev->next = new; | |||||
old->prev = LIST_POISON2; | |||||
} | |||||
/** | |||||
* list_del_init - deletes entry from list and reinitialize it. | |||||
* @entry: the element to delete from the list. | |||||
*/ | |||||
static inline void list_del_init(struct list_head *entry) | |||||
{ | |||||
__list_del(entry->prev, entry->next); | |||||
INIT_LIST_HEAD(entry); | |||||
} | |||||
/** | |||||
* list_move - delete from one list and add as another's head | |||||
* @list: the entry to move | |||||
* @head: the head that will precede our entry | |||||
*/ | |||||
static inline void list_move(struct list_head *list, struct list_head *head) | |||||
{ | |||||
__list_del(list->prev, list->next); | |||||
list_add(list, head); | |||||
} | |||||
/** | |||||
* list_move_tail - delete from one list and add as another's tail | |||||
* @list: the entry to move | |||||
* @head: the head that will follow our entry | |||||
*/ | |||||
static inline void list_move_tail(struct list_head *list, | |||||
struct list_head *head) | |||||
{ | |||||
__list_del(list->prev, list->next); | |||||
list_add_tail(list, head); | |||||
} | |||||
/** | |||||
* list_empty - tests whether a list is empty | |||||
* @head: the list to test. | |||||
*/ | |||||
static inline int list_empty(const struct list_head *head) | |||||
{ | |||||
return head->next == head; | |||||
} | |||||
/** | |||||
* list_empty_careful - tests whether a list is | |||||
* empty _and_ checks that no other CPU might be | |||||
* in the process of still modifying either member | |||||
* | |||||
* NOTE: using list_empty_careful() without synchronization | |||||
* can only be safe if the only activity that can happen | |||||
* to the list entry is list_del_init(). Eg. it cannot be used | |||||
* if another CPU could re-list_add() it. | |||||
* | |||||
* @head: the list to test. | |||||
*/ | |||||
static inline int list_empty_careful(const struct list_head *head) | |||||
{ | |||||
struct list_head *next = head->next; | |||||
return (next == head) && (next == head->prev); | |||||
} | |||||
static inline void __list_splice(struct list_head *list, | |||||
struct list_head *head) | |||||
{ | |||||
struct list_head *first = list->next; | |||||
struct list_head *last = list->prev; | |||||
struct list_head *at = head->next; | |||||
first->prev = head; | |||||
head->next = first; | |||||
last->next = at; | |||||
at->prev = last; | |||||
} | |||||
/** | |||||
* list_splice - join two lists | |||||
* @list: the new list to add. | |||||
* @head: the place to add it in the first list. | |||||
*/ | |||||
static inline void list_splice(struct list_head *list, struct list_head *head) | |||||
{ | |||||
if (!list_empty(list)) | |||||
__list_splice(list, head); | |||||
} | |||||
/** | |||||
* list_splice_init - join two lists and reinitialise the emptied list. | |||||
* @list: the new list to add. | |||||
* @head: the place to add it in the first list. | |||||
* | |||||
* The list at @list is reinitialised | |||||
*/ | |||||
static inline void list_splice_init(struct list_head *list, | |||||
struct list_head *head) | |||||
{ | |||||
if (!list_empty(list)) { | |||||
__list_splice(list, head); | |||||
INIT_LIST_HEAD(list); | |||||
} | |||||
} | |||||
/** | |||||
* list_entry - get the struct for this entry | |||||
* @ptr: the &struct list_head pointer. | |||||
* @type: the type of the struct this is embedded in. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_entry(ptr, type, member) \ | |||||
container_of(ptr, type, member) | |||||
/** | |||||
* list_for_each - iterate over a list | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @head: the head for your list. | |||||
*/ | |||||
#define list_for_each(pos, head) \ | |||||
for (pos = (head)->next; prefetch(pos->next), pos != (head); \ | |||||
pos = pos->next) | |||||
/** | |||||
* __list_for_each - iterate over a list | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* | |||||
* This variant differs from list_for_each() in that it's the | |||||
* simplest possible list iteration code, no prefetching is done. | |||||
* Use this for code that knows the list to be very short (empty | |||||
* or 1 entry) most of the time. | |||||
*/ | |||||
#define __list_for_each(pos, head) \ | |||||
for (pos = (head)->next; pos != (head); pos = pos->next) | |||||
/** | |||||
* list_for_each_prev - iterate over a list backwards | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @head: the head for your list. | |||||
*/ | |||||
#define list_for_each_prev(pos, head) \ | |||||
for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ | |||||
pos = pos->prev) | |||||
/** | |||||
* list_for_each_safe - iterate over a list safe against removal of list entry | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @n: another &struct list_head to use as temporary storage | |||||
* @head: the head for your list. | |||||
*/ | |||||
#define list_for_each_safe(pos, n, head) \ | |||||
for (pos = (head)->next, n = pos->next; pos != (head); \ | |||||
pos = n, n = pos->next) | |||||
/** | |||||
* list_for_each_entry - iterate over list of given type | |||||
* @pos: the type * to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry(pos, head, member) \ | |||||
for (pos = list_entry((head)->next, typeof(*pos), member); \ | |||||
prefetch(pos->member.next), &pos->member != (head); \ | |||||
pos = list_entry(pos->member.next, typeof(*pos), member)) | |||||
/** | |||||
* list_for_each_entry_reverse - iterate backwards over list of given type. | |||||
* @pos: the type * to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_reverse(pos, head, member) \ | |||||
for (pos = list_entry((head)->prev, typeof(*pos), member); \ | |||||
prefetch(pos->member.prev), &pos->member != (head); \ | |||||
pos = list_entry(pos->member.prev, typeof(*pos), member)) | |||||
/** | |||||
* list_prepare_entry - prepare a pos entry for use as a start point in | |||||
* list_for_each_entry_continue | |||||
* @pos: the type * to use as a start point | |||||
* @head: the head of the list | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_prepare_entry(pos, head, member) \ | |||||
((pos) ? : list_entry(head, typeof(*pos), member)) | |||||
/** | |||||
* list_for_each_entry_continue - iterate over list of given type | |||||
* continuing after existing point | |||||
* @pos: the type * to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_continue(pos, head, member) \ | |||||
for (pos = list_entry(pos->member.next, typeof(*pos), member); \ | |||||
prefetch(pos->member.next), &pos->member != (head); \ | |||||
pos = list_entry(pos->member.next, typeof(*pos), member)) | |||||
/** | |||||
* list_for_each_entry_from - iterate over list of given type | |||||
* continuing from existing point | |||||
* @pos: the type * to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_from(pos, head, member) \ | |||||
for (; prefetch(pos->member.next), &pos->member != (head); \ | |||||
pos = list_entry(pos->member.next, typeof(*pos), member)) | |||||
/** | |||||
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | |||||
* @pos: the type * to use as a loop counter. | |||||
* @n: another type * to use as temporary storage | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_safe(pos, n, head, member) \ | |||||
for (pos = list_entry((head)->next, typeof(*pos), member), \ | |||||
n = list_entry(pos->member.next, typeof(*pos), member); \ | |||||
&pos->member != (head); \ | |||||
pos = n, n = list_entry(n->member.next, typeof(*n), member)) | |||||
/** | |||||
* list_for_each_entry_safe_continue - iterate over list of given type | |||||
* continuing after existing point safe against removal of list entry | |||||
* @pos: the type * to use as a loop counter. | |||||
* @n: another type * to use as temporary storage | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_safe_continue(pos, n, head, member) \ | |||||
for (pos = list_entry(pos->member.next, typeof(*pos), member), \ | |||||
n = list_entry(pos->member.next, typeof(*pos), member); \ | |||||
&pos->member != (head); \ | |||||
pos = n, n = list_entry(n->member.next, typeof(*n), member)) | |||||
/** | |||||
* list_for_each_entry_safe_from - iterate over list of given type | |||||
* from existing point safe against removal of list entry | |||||
* @pos: the type * to use as a loop counter. | |||||
* @n: another type * to use as temporary storage | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_safe_from(pos, n, head, member) \ | |||||
for (n = list_entry(pos->member.next, typeof(*pos), member); \ | |||||
&pos->member != (head); \ | |||||
pos = n, n = list_entry(n->member.next, typeof(*n), member)) | |||||
/** | |||||
* list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against | |||||
* removal of list entry | |||||
* @pos: the type * to use as a loop counter. | |||||
* @n: another type * to use as temporary storage | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
*/ | |||||
#define list_for_each_entry_safe_reverse(pos, n, head, member) \ | |||||
for (pos = list_entry((head)->prev, typeof(*pos), member), \ | |||||
n = list_entry(pos->member.prev, typeof(*pos), member); \ | |||||
&pos->member != (head); \ | |||||
pos = n, n = list_entry(n->member.prev, typeof(*n), member)) | |||||
/** | |||||
* list_for_each_rcu - iterate over an rcu-protected list | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* | |||||
* This list-traversal primitive may safely run concurrently with | |||||
* the _rcu list-mutation primitives such as list_add_rcu() | |||||
* as long as the traversal is guarded by rcu_read_lock(). | |||||
*/ | |||||
#define list_for_each_rcu(pos, head) \ | |||||
for (pos = (head)->next; \ | |||||
prefetch(rcu_dereference(pos)->next), pos != (head); \ | |||||
pos = pos->next) | |||||
#define __list_for_each_rcu(pos, head) \ | |||||
for (pos = (head)->next; \ | |||||
rcu_dereference(pos) != (head); \ | |||||
pos = pos->next) | |||||
/** | |||||
* list_for_each_safe_rcu - iterate over an rcu-protected list safe | |||||
* against removal of list entry | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @n: another &struct list_head to use as temporary storage | |||||
* @head: the head for your list. | |||||
* | |||||
* This list-traversal primitive may safely run concurrently with | |||||
* the _rcu list-mutation primitives such as list_add_rcu() | |||||
* as long as the traversal is guarded by rcu_read_lock(). | |||||
*/ | |||||
#define list_for_each_safe_rcu(pos, n, head) \ | |||||
for (pos = (head)->next; \ | |||||
n = rcu_dereference(pos)->next, pos != (head); \ | |||||
pos = n) | |||||
/** | |||||
* list_for_each_entry_rcu - iterate over rcu list of given type | |||||
* @pos: the type * to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the list_struct within the struct. | |||||
* | |||||
* This list-traversal primitive may safely run concurrently with | |||||
* the _rcu list-mutation primitives such as list_add_rcu() | |||||
* as long as the traversal is guarded by rcu_read_lock(). | |||||
*/ | |||||
#define list_for_each_entry_rcu(pos, head, member) \ | |||||
for (pos = list_entry((head)->next, typeof(*pos), member); \ | |||||
prefetch(rcu_dereference(pos)->member.next), \ | |||||
&pos->member != (head); \ | |||||
pos = list_entry(pos->member.next, typeof(*pos), member)) | |||||
/** | |||||
* list_for_each_continue_rcu - iterate over an rcu-protected list | |||||
* continuing after existing point. | |||||
* @pos: the &struct list_head to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* | |||||
* This list-traversal primitive may safely run concurrently with | |||||
* the _rcu list-mutation primitives such as list_add_rcu() | |||||
* as long as the traversal is guarded by rcu_read_lock(). | |||||
*/ | |||||
#define list_for_each_continue_rcu(pos, head) \ | |||||
for ((pos) = (pos)->next; \ | |||||
prefetch(rcu_dereference((pos))->next), (pos) != (head); \ | |||||
(pos) = (pos)->next) | |||||
/* | |||||
* Double linked lists with a single pointer list head. | |||||
* Mostly useful for hash tables where the two pointer list head is | |||||
* too wasteful. | |||||
* You lose the ability to access the tail in O(1). | |||||
*/ | |||||
struct hlist_head { | |||||
struct hlist_node *first; | |||||
}; | |||||
struct hlist_node { | |||||
struct hlist_node *next, **pprev; | |||||
}; | |||||
#define HLIST_HEAD_INIT { .first = NULL } | |||||
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } | |||||
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) | |||||
static inline void INIT_HLIST_NODE(struct hlist_node *h) | |||||
{ | |||||
h->next = NULL; | |||||
h->pprev = NULL; | |||||
} | |||||
static inline int hlist_unhashed(const struct hlist_node *h) | |||||
{ | |||||
return !h->pprev; | |||||
} | |||||
static inline int hlist_empty(const struct hlist_head *h) | |||||
{ | |||||
return !h->first; | |||||
} | |||||
static inline void __hlist_del(struct hlist_node *n) | |||||
{ | |||||
struct hlist_node *next = n->next; | |||||
struct hlist_node **pprev = n->pprev; | |||||
*pprev = next; | |||||
if (next) | |||||
next->pprev = pprev; | |||||
} | |||||
static inline void hlist_del(struct hlist_node *n) | |||||
{ | |||||
__hlist_del(n); | |||||
n->next = LIST_POISON1; | |||||
n->pprev = LIST_POISON2; | |||||
} | |||||
/** | |||||
* hlist_del_rcu - deletes entry from hash list without re-initialization | |||||
* @n: the element to delete from the hash list. | |||||
* | |||||
* Note: list_unhashed() on entry does not return true after this, | |||||
* the entry is in an undefined state. It is useful for RCU based | |||||
* lockfree traversal. | |||||
* | |||||
* In particular, it means that we can not poison the forward | |||||
* pointers that may still be used for walking the hash list. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as hlist_add_head_rcu() | |||||
* or hlist_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* hlist_for_each_entry(). | |||||
*/ | |||||
static inline void hlist_del_rcu(struct hlist_node *n) | |||||
{ | |||||
__hlist_del(n); | |||||
n->pprev = LIST_POISON2; | |||||
} | |||||
static inline void hlist_del_init(struct hlist_node *n) | |||||
{ | |||||
if (!hlist_unhashed(n)) { | |||||
__hlist_del(n); | |||||
INIT_HLIST_NODE(n); | |||||
} | |||||
} | |||||
/* | |||||
* hlist_replace_rcu - replace old entry by new one | |||||
* @old : the element to be replaced | |||||
* @new : the new element to insert | |||||
* | |||||
* The old entry will be replaced with the new entry atomically. | |||||
*/ | |||||
static inline void hlist_replace_rcu(struct hlist_node *old, | |||||
struct hlist_node *new) | |||||
{ | |||||
struct hlist_node *next = old->next; | |||||
new->next = next; | |||||
new->pprev = old->pprev; | |||||
// smp_wmb(); | |||||
if (next) | |||||
new->next->pprev = &new->next; | |||||
*new->pprev = new; | |||||
old->pprev = LIST_POISON2; | |||||
} | |||||
static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | |||||
{ | |||||
struct hlist_node *first = h->first; | |||||
n->next = first; | |||||
if (first) | |||||
first->pprev = &n->next; | |||||
h->first = n; | |||||
n->pprev = &h->first; | |||||
} | |||||
/** | |||||
* hlist_add_head_rcu - adds the specified element to the specified hlist, | |||||
* while permitting racing traversals. | |||||
* @n: the element to add to the hash list. | |||||
* @h: the list to add to. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as hlist_add_head_rcu() | |||||
* or hlist_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* hlist_for_each_entry_rcu(), used to prevent memory-consistency | |||||
* problems on Alpha CPUs. Regardless of the type of CPU, the | |||||
* list-traversal primitive must be guarded by rcu_read_lock(). | |||||
*/ | |||||
static inline void hlist_add_head_rcu(struct hlist_node *n, | |||||
struct hlist_head *h) | |||||
{ | |||||
struct hlist_node *first = h->first; | |||||
n->next = first; | |||||
n->pprev = &h->first; | |||||
// smp_wmb(); | |||||
if (first) | |||||
first->pprev = &n->next; | |||||
h->first = n; | |||||
} | |||||
/* next must be != NULL */ | |||||
static inline void hlist_add_before(struct hlist_node *n, | |||||
struct hlist_node *next) | |||||
{ | |||||
n->pprev = next->pprev; | |||||
n->next = next; | |||||
next->pprev = &n->next; | |||||
*(n->pprev) = n; | |||||
} | |||||
static inline void hlist_add_after(struct hlist_node *n, | |||||
struct hlist_node *next) | |||||
{ | |||||
next->next = n->next; | |||||
n->next = next; | |||||
next->pprev = &n->next; | |||||
if(next->next) | |||||
next->next->pprev = &next->next; | |||||
} | |||||
/** | |||||
* hlist_add_before_rcu - adds the specified element to the specified hlist | |||||
* before the specified node while permitting racing traversals. | |||||
* @n: the new element to add to the hash list. | |||||
* @next: the existing element to add the new element before. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as hlist_add_head_rcu() | |||||
* or hlist_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* hlist_for_each_entry_rcu(), used to prevent memory-consistency | |||||
* problems on Alpha CPUs. | |||||
*/ | |||||
static inline void hlist_add_before_rcu(struct hlist_node *n, | |||||
struct hlist_node *next) | |||||
{ | |||||
n->pprev = next->pprev; | |||||
n->next = next; | |||||
// smp_wmb(); | |||||
next->pprev = &n->next; | |||||
*(n->pprev) = n; | |||||
} | |||||
/** | |||||
* hlist_add_after_rcu - adds the specified element to the specified hlist | |||||
* after the specified node while permitting racing traversals. | |||||
* @prev: the existing element to add the new element after. | |||||
* @n: the new element to add to the hash list. | |||||
* | |||||
* The caller must take whatever precautions are necessary | |||||
* (such as holding appropriate locks) to avoid racing | |||||
* with another list-mutation primitive, such as hlist_add_head_rcu() | |||||
* or hlist_del_rcu(), running on this same list. | |||||
* However, it is perfectly legal to run concurrently with | |||||
* the _rcu list-traversal primitives, such as | |||||
* hlist_for_each_entry_rcu(), used to prevent memory-consistency | |||||
* problems on Alpha CPUs. | |||||
*/ | |||||
static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||||
struct hlist_node *n) | |||||
{ | |||||
n->next = prev->next; | |||||
n->pprev = &prev->next; | |||||
// smp_wmb(); | |||||
prev->next = n; | |||||
if (n->next) | |||||
n->next->pprev = &n->next; | |||||
} | |||||
#define hlist_entry(ptr, type, member) container_of(ptr,type,member) | |||||
#define hlist_for_each(pos, head) \ | |||||
for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ | |||||
pos = pos->next) | |||||
#define hlist_for_each_safe(pos, n, head) \ | |||||
for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ | |||||
pos = n) | |||||
/** | |||||
* hlist_for_each_entry - iterate over list of given type | |||||
* @tpos: the type * to use as a loop counter. | |||||
* @pos: the &struct hlist_node to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the hlist_node within the struct. | |||||
*/ | |||||
#define hlist_for_each_entry(tpos, pos, head, member) \ | |||||
for (pos = (head)->first; \ | |||||
pos && ({ prefetch(pos->next); 1;}) && \ | |||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | |||||
pos = pos->next) | |||||
/** | |||||
* hlist_for_each_entry_continue - iterate over a hlist continuing after existing point | |||||
* @tpos: the type * to use as a loop counter. | |||||
* @pos: the &struct hlist_node to use as a loop counter. | |||||
* @member: the name of the hlist_node within the struct. | |||||
*/ | |||||
#define hlist_for_each_entry_continue(tpos, pos, member) \ | |||||
for (pos = (pos)->next; \ | |||||
pos && ({ prefetch(pos->next); 1;}) && \ | |||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | |||||
pos = pos->next) | |||||
/** | |||||
* hlist_for_each_entry_from - iterate over a hlist continuing from existing point | |||||
* @tpos: the type * to use as a loop counter. | |||||
* @pos: the &struct hlist_node to use as a loop counter. | |||||
* @member: the name of the hlist_node within the struct. | |||||
*/ | |||||
#define hlist_for_each_entry_from(tpos, pos, member) \ | |||||
for (; pos && ({ prefetch(pos->next); 1;}) && \ | |||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | |||||
pos = pos->next) | |||||
/** | |||||
* hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry | |||||
* @tpos: the type * to use as a loop counter. | |||||
* @pos: the &struct hlist_node to use as a loop counter. | |||||
* @n: another &struct hlist_node to use as temporary storage | |||||
* @head: the head for your list. | |||||
* @member: the name of the hlist_node within the struct. | |||||
*/ | |||||
#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ | |||||
for (pos = (head)->first; \ | |||||
pos && ({ n = pos->next; 1; }) && \ | |||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | |||||
pos = n) | |||||
/** | |||||
* hlist_for_each_entry_rcu - iterate over rcu list of given type | |||||
* @tpos: the type * to use as a loop counter. | |||||
* @pos: the &struct hlist_node to use as a loop counter. | |||||
* @head: the head for your list. | |||||
* @member: the name of the hlist_node within the struct. | |||||
* | |||||
* This list-traversal primitive may safely run concurrently with | |||||
* the _rcu list-mutation primitives such as hlist_add_head_rcu() | |||||
* as long as the traversal is guarded by rcu_read_lock(). | |||||
*/ | |||||
#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ | |||||
for (pos = (head)->first; \ | |||||
rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) && \ | |||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | |||||
pos = pos->next) | |||||
#endif |
@@ -1,4 +0,0 @@ | |||||
/* simple file for rtmempool in Carla compatibility */ | |||||
#define LOG_DEBUG(format, arg...) | |||||
#define LOG_WARNING(format, arg...) |
@@ -1,397 +0,0 @@ | |||||
/* -*- Mode: C ; c-basic-offset: 2 -*- */ | |||||
/***************************************************************************** | |||||
* | |||||
* This file is part of zynjacku | |||||
* | |||||
* Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name> | |||||
* | |||||
* 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; version 2 of the License | |||||
* | |||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA. | |||||
* | |||||
*****************************************************************************/ | |||||
#include <stddef.h> | |||||
#include <stdbool.h> | |||||
#include <string.h> | |||||
#include <stdio.h> /* sprintf */ | |||||
#include <stdlib.h> | |||||
#include <assert.h> | |||||
#include <pthread.h> | |||||
#include "lv2/lv2_rtmempool.h" | |||||
#include "rtmempool.h" | |||||
#include "list.h" | |||||
//#define LOG_LEVEL LOG_LEVEL_DEBUG | |||||
#include "log.h" | |||||
struct rtsafe_memory_pool | |||||
{ | |||||
char name[LV2_RTSAFE_MEMORY_POOL_NAME_MAX]; | |||||
size_t data_size; | |||||
size_t min_preallocated; | |||||
size_t max_preallocated; | |||||
unsigned int used_count; | |||||
struct list_head unused; | |||||
struct list_head used; | |||||
unsigned int unused_count; | |||||
bool enforce_thread_safety; | |||||
/* next members are initialized/used only if enforce_thread_safety is true */ | |||||
pthread_mutex_t mutex; | |||||
unsigned int unused_count2; | |||||
struct list_head pending; | |||||
size_t used_size; | |||||
}; | |||||
static | |||||
void | |||||
rtsafe_memory_pool_sleepy( | |||||
lv2_rtsafe_memory_pool_handle pool_handle); | |||||
static | |||||
bool | |||||
rtsafe_memory_pool_create( | |||||
const char * pool_name, | |||||
size_t data_size, | |||||
size_t min_preallocated, | |||||
size_t max_preallocated, | |||||
bool enforce_thread_safety, | |||||
lv2_rtsafe_memory_pool_handle * pool_handle_ptr) | |||||
{ | |||||
int ret; | |||||
struct rtsafe_memory_pool * pool_ptr; | |||||
assert(min_preallocated <= max_preallocated); | |||||
assert(pool_name == NULL || strlen(pool_name) < LV2_RTSAFE_MEMORY_POOL_NAME_MAX); | |||||
LOG_DEBUG( | |||||
"creating pool \"%s\" (size %u, min = %u, max = %u, enforce = %s)", | |||||
pool_name, | |||||
(unsigned int)data_size, | |||||
(unsigned int)min_preallocated, | |||||
(unsigned int)max_preallocated, | |||||
enforce_thread_safety ? "true" : "false"); | |||||
pool_ptr = malloc(sizeof(struct rtsafe_memory_pool)); | |||||
if (pool_ptr == NULL) | |||||
{ | |||||
return false; | |||||
} | |||||
if (pool_name != NULL) | |||||
{ | |||||
strcpy(pool_ptr->name, pool_name); | |||||
} | |||||
else | |||||
{ | |||||
sprintf(pool_ptr->name, "%p", pool_ptr); | |||||
} | |||||
pool_ptr->data_size = data_size; | |||||
pool_ptr->min_preallocated = min_preallocated; | |||||
pool_ptr->max_preallocated = max_preallocated; | |||||
INIT_LIST_HEAD(&pool_ptr->used); | |||||
pool_ptr->used_count = 0; | |||||
INIT_LIST_HEAD(&pool_ptr->unused); | |||||
pool_ptr->unused_count = 0; | |||||
pool_ptr->enforce_thread_safety = enforce_thread_safety; | |||||
if (enforce_thread_safety) | |||||
{ | |||||
ret = pthread_mutex_init(&pool_ptr->mutex, NULL); | |||||
if (ret != 0) | |||||
{ | |||||
free(pool_ptr); | |||||
return false; | |||||
} | |||||
INIT_LIST_HEAD(&pool_ptr->pending); | |||||
pool_ptr->unused_count2 = 0; | |||||
} | |||||
pool_ptr->used_size = 0; | |||||
rtsafe_memory_pool_sleepy((lv2_rtsafe_memory_pool_handle)pool_ptr); | |||||
*pool_handle_ptr = (lv2_rtsafe_memory_pool_handle)pool_ptr; | |||||
return true; | |||||
} | |||||
#define pool_ptr ((struct rtsafe_memory_pool *)pool_handle) | |||||
static | |||||
void | |||||
rtsafe_memory_pool_destroy( | |||||
lv2_rtsafe_memory_pool_handle pool_handle) | |||||
{ | |||||
int ret; | |||||
struct list_head * node_ptr; | |||||
LOG_DEBUG("destroying pool \"%s\"", pool_ptr->name); | |||||
/* caller should deallocate all chunks prior releasing pool itself */ | |||||
if (pool_ptr->used_count != 0) | |||||
{ | |||||
LOG_WARNING("Deallocating non-empty pool \"%s\", leaking %u entries:", pool_ptr->name, pool_ptr->used_count); | |||||
list_for_each(node_ptr, &pool_ptr->used) | |||||
{ | |||||
LOG_WARNING(" %p", node_ptr + 1); | |||||
} | |||||
assert(0); | |||||
} | |||||
while (pool_ptr->unused_count != 0) | |||||
{ | |||||
assert(!list_empty(&pool_ptr->unused)); | |||||
node_ptr = pool_ptr->unused.next; | |||||
list_del(node_ptr); | |||||
pool_ptr->unused_count--; | |||||
free(node_ptr); | |||||
} | |||||
assert(list_empty(&pool_ptr->unused)); | |||||
if (pool_ptr->enforce_thread_safety) | |||||
{ | |||||
while (!list_empty(&pool_ptr->pending)) | |||||
{ | |||||
node_ptr = pool_ptr->pending.next; | |||||
list_del(node_ptr); | |||||
free(node_ptr); | |||||
} | |||||
ret = pthread_mutex_destroy(&pool_ptr->mutex); | |||||
assert(ret == 0); | |||||
} | |||||
free(pool_ptr); | |||||
// unused variable | |||||
(void)ret; | |||||
} | |||||
/* adjust unused list size */ | |||||
static | |||||
void | |||||
rtsafe_memory_pool_sleepy( | |||||
lv2_rtsafe_memory_pool_handle pool_handle) | |||||
{ | |||||
struct list_head * node_ptr; | |||||
unsigned int count; | |||||
LOG_DEBUG("pool \"%s\", sleepy", pool_ptr->name); | |||||
if (pool_ptr->enforce_thread_safety) | |||||
{ | |||||
pthread_mutex_lock(&pool_ptr->mutex); | |||||
count = pool_ptr->unused_count2; | |||||
assert(pool_ptr->min_preallocated < pool_ptr->max_preallocated); | |||||
while (count < pool_ptr->min_preallocated) | |||||
{ | |||||
node_ptr = malloc(sizeof(struct list_head) + pool_ptr->data_size); | |||||
if (node_ptr == NULL) | |||||
{ | |||||
LOG_DEBUG("malloc() failed (%u)", (unsigned int)pool_ptr->used_size); | |||||
break; | |||||
} | |||||
list_add_tail(node_ptr, &pool_ptr->pending); | |||||
count++; | |||||
pool_ptr->used_size += pool_ptr->data_size; | |||||
} | |||||
while (count > pool_ptr->max_preallocated && !list_empty(&pool_ptr->pending)) | |||||
{ | |||||
node_ptr = pool_ptr->pending.next; | |||||
list_del(node_ptr); | |||||
free(node_ptr); | |||||
count--; | |||||
pool_ptr->used_size -= pool_ptr->data_size; | |||||
} | |||||
pthread_mutex_unlock(&pool_ptr->mutex); | |||||
} | |||||
else | |||||
{ | |||||
while (pool_ptr->unused_count < pool_ptr->min_preallocated) | |||||
{ | |||||
node_ptr = malloc(sizeof(struct list_head) + pool_ptr->data_size); | |||||
if (node_ptr == NULL) | |||||
{ | |||||
LOG_DEBUG("malloc() failed (%u)", (unsigned int)pool_ptr->used_size); | |||||
return; | |||||
} | |||||
list_add_tail(node_ptr, &pool_ptr->unused); | |||||
pool_ptr->unused_count++; | |||||
pool_ptr->used_size += pool_ptr->data_size; | |||||
} | |||||
while (pool_ptr->unused_count > pool_ptr->max_preallocated) | |||||
{ | |||||
assert(!list_empty(&pool_ptr->unused)); | |||||
node_ptr = pool_ptr->unused.next; | |||||
list_del(node_ptr); | |||||
pool_ptr->unused_count--; | |||||
free(node_ptr); | |||||
pool_ptr->used_size -= pool_ptr->data_size; | |||||
} | |||||
} | |||||
} | |||||
/* find entry in unused list, fail if it is empty */ | |||||
static | |||||
void * | |||||
rtsafe_memory_pool_allocate_atomic( | |||||
lv2_rtsafe_memory_pool_handle pool_handle) | |||||
{ | |||||
struct list_head * node_ptr; | |||||
LOG_DEBUG("pool \"%s\", allocate (%u, %u)", pool_ptr->name, pool_ptr->used_count, pool_ptr->unused_count); | |||||
if (list_empty(&pool_ptr->unused)) | |||||
{ | |||||
return NULL; | |||||
} | |||||
node_ptr = pool_ptr->unused.next; | |||||
list_del(node_ptr); | |||||
pool_ptr->unused_count--; | |||||
pool_ptr->used_count++; | |||||
list_add_tail(node_ptr, &pool_ptr->used); | |||||
if (pool_ptr->enforce_thread_safety && | |||||
pthread_mutex_trylock(&pool_ptr->mutex) == 0) | |||||
{ | |||||
while (pool_ptr->unused_count < pool_ptr->min_preallocated && !list_empty(&pool_ptr->pending)) | |||||
{ | |||||
node_ptr = pool_ptr->pending.next; | |||||
list_del(node_ptr); | |||||
list_add_tail(node_ptr, &pool_ptr->unused); | |||||
pool_ptr->unused_count++; | |||||
} | |||||
pool_ptr->unused_count2 = pool_ptr->unused_count; | |||||
pthread_mutex_unlock(&pool_ptr->mutex); | |||||
} | |||||
LOG_DEBUG("pool \"%s\", allocated %p (%u)", pool_ptr->name, node_ptr + 1, pool_ptr->used_count); | |||||
return (node_ptr + 1); | |||||
} | |||||
/* move from used to unused list */ | |||||
static | |||||
void | |||||
rtsafe_memory_pool_deallocate( | |||||
lv2_rtsafe_memory_pool_handle pool_handle, | |||||
void * data) | |||||
{ | |||||
struct list_head * node_ptr; | |||||
LOG_DEBUG("pool \"%s\", deallocate %p (%u)", pool_ptr->name, (struct list_head *)data - 1, pool_ptr->used_count); | |||||
list_del((struct list_head *)data - 1); | |||||
list_add_tail((struct list_head *)data - 1, &pool_ptr->unused); | |||||
pool_ptr->used_count--; | |||||
pool_ptr->unused_count++; | |||||
if (pool_ptr->enforce_thread_safety && | |||||
pthread_mutex_trylock(&pool_ptr->mutex) == 0) | |||||
{ | |||||
while (pool_ptr->unused_count > pool_ptr->max_preallocated) | |||||
{ | |||||
assert(!list_empty(&pool_ptr->unused)); | |||||
node_ptr = pool_ptr->unused.next; | |||||
list_del(node_ptr); | |||||
list_add_tail(node_ptr, &pool_ptr->pending); | |||||
pool_ptr->unused_count--; | |||||
} | |||||
pool_ptr->unused_count2 = pool_ptr->unused_count; | |||||
pthread_mutex_unlock(&pool_ptr->mutex); | |||||
} | |||||
} | |||||
static | |||||
void * | |||||
rtsafe_memory_pool_allocate_sleepy( | |||||
lv2_rtsafe_memory_pool_handle pool_handle) | |||||
{ | |||||
void * data; | |||||
LOG_DEBUG("pool \"%s\", allocate sleepy", pool_ptr->name); | |||||
do | |||||
{ | |||||
rtsafe_memory_pool_sleepy(pool_handle); | |||||
data = rtsafe_memory_pool_allocate_atomic(pool_handle); | |||||
} | |||||
while (data == NULL); | |||||
return data; | |||||
} | |||||
#undef pool_ptr | |||||
static | |||||
unsigned char | |||||
rtsafe_memory_pool_create2( | |||||
const char * pool_name, | |||||
size_t data_size, | |||||
size_t min_preallocated, | |||||
size_t max_preallocated, | |||||
lv2_rtsafe_memory_pool_handle * pool_ptr) | |||||
{ | |||||
return rtsafe_memory_pool_create(pool_name, data_size, min_preallocated, max_preallocated, false, pool_ptr); | |||||
} | |||||
void | |||||
rtmempool_allocator_init( | |||||
lv2_rtsafe_memory_pool_provider * allocator_ptr) | |||||
{ | |||||
allocator_ptr->create = rtsafe_memory_pool_create2; | |||||
allocator_ptr->destroy = rtsafe_memory_pool_destroy; | |||||
allocator_ptr->allocate_atomic = rtsafe_memory_pool_allocate_atomic; | |||||
allocator_ptr->allocate_sleepy = rtsafe_memory_pool_allocate_sleepy; | |||||
allocator_ptr->deallocate = rtsafe_memory_pool_deallocate; | |||||
} |
@@ -1,30 +0,0 @@ | |||||
/* -*- Mode: C ; c-basic-offset: 2 -*- */ | |||||
/***************************************************************************** | |||||
* | |||||
* This file is part of zynjacku | |||||
* | |||||
* Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name> | |||||
* | |||||
* 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; version 2 of the License | |||||
* | |||||
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA. | |||||
* | |||||
*****************************************************************************/ | |||||
#ifndef RTMEMPOOL_H__1FA54215_11CF_4659_9CF3_C17A10A67A1F__INCLUDED | |||||
#define RTMEMPOOL_H__1FA54215_11CF_4659_9CF3_C17A10A67A1F__INCLUDED | |||||
void | |||||
rtmempool_allocator_init( | |||||
lv2_rtsafe_memory_pool_provider * allocator_ptr); | |||||
#endif /* #ifndef RTMEMPOOL_H__1FA54215_11CF_4659_9CF3_C17A10A67A1F__INCLUDED */ |
@@ -4,14 +4,11 @@ | |||||
# Created by falkTX | # Created by falkTX | ||||
# | # | ||||
CC ?= gcc | |||||
CXX ?= g++ | CXX ?= g++ | ||||
WINECC ?= winegcc | |||||
WINECXX ?= wineg++ | WINECXX ?= wineg++ | ||||
STRIP ?= strip | |||||
BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -Wall | |||||
BUILD_CFLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS) | |||||
BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -mfpmath=sse -Wall | |||||
BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | ||||
@@ -47,16 +44,16 @@ WINE_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl | |||||
BUILD_UI_FLAGS = $(BUILD_FLAGS) -DBUILD_BRIDGE_UI | BUILD_UI_FLAGS = $(BUILD_FLAGS) -DBUILD_BRIDGE_UI | ||||
LINK_UI_FLAGS = $(LINK_FLAGS) -ldl | LINK_UI_FLAGS = $(LINK_FLAGS) -ldl | ||||
BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0) | |||||
BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2 -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0) | |||||
LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0) | LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0) | ||||
BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui) | |||||
BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2 -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui) | |||||
LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | ||||
BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2_X11 $(shell pkg-config --cflags QtGui) | |||||
BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2 -DBRIDGE_LV2_X11 $(shell pkg-config --cflags QtGui) | |||||
LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | ||||
BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_VST_X11 $(shell pkg-config --cflags QtGui) | |||||
BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_VST -DBRIDGE_VST_X11 $(shell pkg-config --cflags QtGui) | |||||
LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
@@ -82,7 +79,7 @@ wine64: carla-bridge-win64.exe.so | |||||
OBJS_UI_LV2_GTK2 = carla_bridge_ui-lv2__lv2-gtk2.o carla_bridge_toolkit-gtk2__lv2-gtk2.o carla_bridge_osc__lv2-gtk2.o ../carla-lilv/carla_lilv.a | OBJS_UI_LV2_GTK2 = carla_bridge_ui-lv2__lv2-gtk2.o carla_bridge_toolkit-gtk2__lv2-gtk2.o carla_bridge_osc__lv2-gtk2.o ../carla-lilv/carla_lilv.a | ||||
carla-bridge-lv2-gtk2: $(OBJS_UI_LV2_GTK2) | carla-bridge-lv2-gtk2: $(OBJS_UI_LV2_GTK2) | ||||
$(CXX) $^ $(LINK_UI_LV2_GTK2_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(LINK_UI_LV2_GTK2_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_ui-lv2__lv2-gtk2.o: carla_bridge_ui-lv2.cpp | carla_bridge_ui-lv2__lv2-gtk2.o: carla_bridge_ui-lv2.cpp | ||||
$(CXX) $< $(BUILD_UI_LV2_GTK2_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_UI_LV2_GTK2_FLAGS) -c -o $@ | ||||
@@ -99,7 +96,7 @@ carla_bridge_osc__lv2-gtk2.o: carla_bridge_osc.cpp | |||||
OBJS_UI_LV2_QT4 = carla_bridge_ui-lv2__lv2-qt4.o carla_bridge_toolkit-qt4__lv2-qt4.o carla_bridge_osc__lv2-qt4.o ../carla-lilv/carla_lilv.a | OBJS_UI_LV2_QT4 = carla_bridge_ui-lv2__lv2-qt4.o carla_bridge_toolkit-qt4__lv2-qt4.o carla_bridge_osc__lv2-qt4.o ../carla-lilv/carla_lilv.a | ||||
carla-bridge-lv2-qt4: $(OBJS_UI_LV2_QT4) | carla-bridge-lv2-qt4: $(OBJS_UI_LV2_QT4) | ||||
$(CXX) $^ $(LINK_UI_LV2_QT4_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(LINK_UI_LV2_QT4_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_ui-lv2__lv2-qt4.o: carla_bridge_ui-lv2.cpp | carla_bridge_ui-lv2__lv2-qt4.o: carla_bridge_ui-lv2.cpp | ||||
$(CXX) $< $(BUILD_UI_LV2_QT4_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_UI_LV2_QT4_FLAGS) -c -o $@ | ||||
@@ -116,7 +113,7 @@ carla_bridge_osc__lv2-qt4.o: carla_bridge_osc.cpp | |||||
OBJS_UI_LV2_X11 = carla_bridge_ui-lv2__lv2-x11.o carla_bridge_toolkit-qt4__lv2-x11.o carla_bridge_osc__lv2-x11.o ../carla-lilv/carla_lilv.a | OBJS_UI_LV2_X11 = carla_bridge_ui-lv2__lv2-x11.o carla_bridge_toolkit-qt4__lv2-x11.o carla_bridge_osc__lv2-x11.o ../carla-lilv/carla_lilv.a | ||||
carla-bridge-lv2-x11: $(OBJS_UI_LV2_X11) | carla-bridge-lv2-x11: $(OBJS_UI_LV2_X11) | ||||
$(CXX) $^ $(LINK_UI_LV2_X11_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(LINK_UI_LV2_X11_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_ui-lv2__lv2-x11.o: carla_bridge_ui-lv2.cpp | carla_bridge_ui-lv2__lv2-x11.o: carla_bridge_ui-lv2.cpp | ||||
$(CXX) $< $(BUILD_UI_LV2_X11_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_UI_LV2_X11_FLAGS) -c -o $@ | ||||
@@ -133,7 +130,7 @@ carla_bridge_osc__lv2-x11.o: carla_bridge_osc.cpp | |||||
OBJS_UI_VST_X11 = carla_bridge_ui-vst__vst-x11.o carla_bridge_toolkit-qt4__vst-x11.o carla_bridge_osc__vst-x11.o | OBJS_UI_VST_X11 = carla_bridge_ui-vst__vst-x11.o carla_bridge_toolkit-qt4__vst-x11.o carla_bridge_osc__vst-x11.o | ||||
carla-bridge-vst-x11: $(OBJS_UI_VST_X11) | carla-bridge-vst-x11: $(OBJS_UI_VST_X11) | ||||
$(CXX) $^ $(LINK_UI_VST_X11_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(LINK_UI_VST_X11_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_ui-vst__vst-x11.o: carla_bridge_ui-vst.cpp | carla_bridge_ui-vst__vst-x11.o: carla_bridge_ui-vst.cpp | ||||
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | ||||
@@ -149,10 +146,10 @@ carla_bridge_osc__vst-x11.o: carla_bridge_osc.cpp | |||||
OBJS_UNIX32 = \ | OBJS_UNIX32 = \ | ||||
carla_bridge_plugin__unix32.o carla_bridge_osc__unix32.o \ | carla_bridge_plugin__unix32.o carla_bridge_osc__unix32.o \ | ||||
carla_engine_jack__unix32.o carla_shared__unix32.o ladspa__unix32.o dssi__unix32.o lv2__unix32.o vst__unix32.o rtmempool__unix32.o ../carla-lilv/carla_lilv_32bit.a | |||||
carla_engine_jack__unix32.o carla_shared__unix32.o ladspa__unix32.o dssi__unix32.o lv2__unix32.o vst__unix32.o ../carla-lilv/carla_lilv_32bit.a | |||||
carla-bridge-unix32: $(OBJS_UNIX32) | carla-bridge-unix32: $(OBJS_UNIX32) | ||||
$(CXX) $^ $(UNIX_LINK_FLAGS) $(UNIX_32BIT_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(UNIX_LINK_FLAGS) $(UNIX_32BIT_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_plugin__unix32.o: carla_bridge_plugin.cpp | carla_bridge_plugin__unix32.o: carla_bridge_plugin.cpp | ||||
$(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) -c -o $@ | $(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) -c -o $@ | ||||
@@ -178,18 +175,15 @@ lv2__unix32.o: ../carla-backend/lv2.cpp | |||||
vst__unix32.o: ../carla-backend/vst.cpp | vst__unix32.o: ../carla-backend/vst.cpp | ||||
$(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) -c -o $@ | $(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) -c -o $@ | ||||
rtmempool__unix32.o: ../carla-backend/lv2-rtmempool/rtmempool.c | |||||
$(CC) $< $(BUILD_CFLAGS) $(32BIT_FLAGS) -c -o $@ | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# unix64 | # unix64 | ||||
OBJS_UNIX64 = \ | OBJS_UNIX64 = \ | ||||
carla_bridge_plugin__unix64.o carla_bridge_osc__unix64.o \ | carla_bridge_plugin__unix64.o carla_bridge_osc__unix64.o \ | ||||
carla_engine_jack__unix64.o carla_shared__unix64.o ladspa__unix64.o dssi__unix64.o lv2__unix64.o vst__unix64.o rtmempool__unix64.o ../carla-lilv/carla_lilv_64bit.a | |||||
carla_engine_jack__unix64.o carla_shared__unix64.o ladspa__unix64.o dssi__unix64.o lv2__unix64.o vst__unix64.o ../carla-lilv/carla_lilv_64bit.a | |||||
carla-bridge-unix64: $(OBJS_UNIX64) | carla-bridge-unix64: $(OBJS_UNIX64) | ||||
$(CXX) $^ $(UNIX_LINK_FLAGS) $(UNIX_64BIT_FLAGS) -o $@ && strip $@ | |||||
$(CXX) $^ $(UNIX_LINK_FLAGS) $(UNIX_64BIT_FLAGS) -o $@ && $(STRIP) $@ | |||||
carla_bridge_plugin__unix64.o: carla_bridge_plugin.cpp | carla_bridge_plugin__unix64.o: carla_bridge_plugin.cpp | ||||
$(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) -c -o $@ | $(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) -c -o $@ | ||||
@@ -215,18 +209,15 @@ lv2__unix64.o: ../carla-backend/lv2.cpp | |||||
vst__unix64.o: ../carla-backend/vst.cpp | vst__unix64.o: ../carla-backend/vst.cpp | ||||
$(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) -c -o $@ | $(CXX) $< $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) -c -o $@ | ||||
rtmempool__unix64.o: ../carla-backend/lv2-rtmempool/rtmempool.c | |||||
$(CC) $< $(BUILD_CFLAGS) $(64BIT_FLAGS) -c -o $@ | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# wine32 | # wine32 | ||||
OBJS_WINE32 = \ | OBJS_WINE32 = \ | ||||
carla_bridge_plugin__wine32.o carla_bridge_osc__wine32.o \ | carla_bridge_plugin__wine32.o carla_bridge_osc__wine32.o \ | ||||
carla_engine_jack__wine32.o carla_shared__wine32.o ladspa__wine32.o dssi__wine32.o lv2__wine32.o vst__wine32.o rtmempool__wine32.o ../carla-lilv/carla_lilv_32bit.a | |||||
carla_engine_jack__wine32.o carla_shared__wine32.o ladspa__wine32.o dssi__wine32.o lv2__wine32.o vst__wine32.o ../carla-lilv/carla_lilv_32bit.a | |||||
carla-bridge-win32.exe.so: $(OBJS_WINE32) | carla-bridge-win32.exe.so: $(OBJS_WINE32) | ||||
$(WINECXX) $^ $(WINE_LINK_FLAGS) $(WINE_32BIT_FLAGS) -o carla-bridge-win32 && strip $@ | |||||
$(WINECXX) $^ $(WINE_LINK_FLAGS) $(WINE_32BIT_FLAGS) -o carla-bridge-win32 && $(STRIP) $@ | |||||
carla_bridge_plugin__wine32.o: carla_bridge_plugin.cpp | carla_bridge_plugin__wine32.o: carla_bridge_plugin.cpp | ||||
$(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) -c -o $@ | $(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) -c -o $@ | ||||
@@ -252,18 +243,15 @@ lv2__wine32.o: ../carla-backend/lv2.cpp | |||||
vst__wine32.o: ../carla-backend/vst.cpp | vst__wine32.o: ../carla-backend/vst.cpp | ||||
$(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) -c -o $@ | $(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) -c -o $@ | ||||
rtmempool__wine32.o: ../carla-backend/lv2-rtmempool/rtmempool.c | |||||
$(WINECC) $< $(BUILD_CFLAGS) $(32BIT_FLAGS) -c -o $@ | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# wine64 | # wine64 | ||||
OBJS_WINE64 = \ | OBJS_WINE64 = \ | ||||
carla_bridge_plugin__wine64.o carla_bridge_osc__wine64.o \ | carla_bridge_plugin__wine64.o carla_bridge_osc__wine64.o \ | ||||
carla_engine_jack__wine64.o carla_shared__wine64.o ladspa__wine64.o dssi__wine64.o lv2__wine64.o vst__wine64.o rtmempool__wine64.o ../carla-lilv/carla_lilv_64bit.a | |||||
carla_engine_jack__wine64.o carla_shared__wine64.o ladspa__wine64.o dssi__wine64.o lv2__wine64.o vst__wine64.o ../carla-lilv/carla_lilv_64bit.a | |||||
carla-bridge-win64.exe.so: $(OBJS_WINE64) | carla-bridge-win64.exe.so: $(OBJS_WINE64) | ||||
$(WINECXX) $^ $(WINE_LINK_FLAGS) $(WINE_64BIT_FLAGS) -o carla-bridge-win64 && strip $@ | |||||
$(WINECXX) $^ $(WINE_LINK_FLAGS) $(WINE_64BIT_FLAGS) -o carla-bridge-win64 && $(STRIP) $@ | |||||
carla_bridge_plugin__wine64.o: carla_bridge_plugin.cpp | carla_bridge_plugin__wine64.o: carla_bridge_plugin.cpp | ||||
$(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) -c -o $@ | $(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) -c -o $@ | ||||
@@ -289,9 +277,6 @@ lv2__wine64.o: ../carla-backend/lv2.cpp | |||||
vst__wine64.o: ../carla-backend/vst.cpp | vst__wine64.o: ../carla-backend/vst.cpp | ||||
$(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) -c -o $@ | $(WINECXX) $< $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) -c -o $@ | ||||
rtmempool__wine64.o: ../carla-backend/lv2-rtmempool/rtmempool.c | |||||
$(WINECC) $< $(BUILD_CFLAGS) $(64BIT_FLAGS) -c -o $@ | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
../carla-lilv/carla_lilv_32bit.a: | ../carla-lilv/carla_lilv_32bit.a: | ||||
@@ -20,6 +20,8 @@ | |||||
#include "carla_includes.h" | #include "carla_includes.h" | ||||
#include <stdint.h> | |||||
#define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { | #define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { | ||||
#define CARLA_BRIDGE_END_NAMESPACE } | #define CARLA_BRIDGE_END_NAMESPACE } | ||||
@@ -35,23 +37,23 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
#define MAX_BRIDGE_MESSAGES 256 //!< Maximum number of messages per client | #define MAX_BRIDGE_MESSAGES 256 //!< Maximum number of messages per client | ||||
enum MessageType { | enum MessageType { | ||||
MESSAGE_NULL = 0, | |||||
MESSAGE_PARAMETER = 1, // index, 0, value | |||||
MESSAGE_PROGRAM = 2, // index, 0, 0 | |||||
MESSAGE_MIDI_PROGRAM = 3, // bank, program, 0 | |||||
MESSAGE_NOTE_ON = 4, // note, velocity, 0 | |||||
MESSAGE_NOTE_OFF = 5, // note, 0, 0 | |||||
MESSAGE_SHOW_GUI = 6, // show, 0, 0 | |||||
MESSAGE_RESIZE_GUI = 7, // width, height, 0 | |||||
MESSAGE_SAVE_NOW = 8, | |||||
MESSAGE_QUIT = 9 | |||||
MESSAGE_NULL = 0, | |||||
MESSAGE_PARAMETER, // index, 0, value | |||||
MESSAGE_PROGRAM, // index, 0, 0 | |||||
MESSAGE_MIDI_PROGRAM, // bank, program, 0 | |||||
MESSAGE_NOTE_ON, // note, velocity, 0 | |||||
MESSAGE_NOTE_OFF, // note, 0, 0 | |||||
MESSAGE_SHOW_GUI, // show, 0, 0 | |||||
MESSAGE_RESIZE_GUI, // width, height, 0 | |||||
MESSAGE_SAVE_NOW, | |||||
MESSAGE_QUIT | |||||
}; | }; | ||||
struct Message { | struct Message { | ||||
MessageType type; | MessageType type; | ||||
int value1; | |||||
int value2; | |||||
double value3; | |||||
int32_t value1; | |||||
int32_t value2; | |||||
double value3; | |||||
Message() | Message() | ||||
: type(MESSAGE_NULL), | : type(MESSAGE_NULL), | ||||
@@ -61,9 +61,9 @@ public: | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
void oscInit(const char* const url) | |||||
bool oscInit(const char* const url) | |||||
{ | { | ||||
m_osc.init(url); | |||||
return m_osc.init(url); | |||||
} | } | ||||
void oscClose() | void oscClose() | ||||
@@ -71,19 +71,41 @@ public: | |||||
m_osc.close(); | m_osc.close(); | ||||
} | } | ||||
void oscSendUpdate() | |||||
void sendOscConfigure(const char* const key, const char* const value) | |||||
{ | { | ||||
qDebug("sendOscConfigure(\"%s\", \"%s\")", key, value); | |||||
m_osc.sendOscConfigure(key, value); | |||||
} | |||||
void sendOscControl(int32_t index, float value) | |||||
{ | |||||
qDebug("sendOscConfigure(%i, %f)", index, value); | |||||
m_osc.sendOscControl(index, value); | |||||
} | |||||
void sendOscUpdate() | |||||
{ | |||||
qDebug("sendOscUpdate()"); | |||||
m_osc.sendOscUpdate(); | m_osc.sendOscUpdate(); | ||||
} | } | ||||
const CarlaOscData* getOscServerData() | |||||
void sendOscExiting() | |||||
{ | { | ||||
return m_osc.getServerData(); | |||||
qDebug("sendOscExiting()"); | |||||
m_osc.sendOscExiting(); | |||||
} | } | ||||
#ifdef BRIDGE_LV2 | |||||
void sendOscLv2EventTransfer(const char* const type, const char* const key, const char* const value) | |||||
{ | |||||
qDebug("sendOscLv2EventTransfer(\"%s\", \"%s\", \"%s\")", type, key, value); | |||||
m_osc.sendOscLv2EventTransfer(type, key, value); | |||||
} | |||||
#endif | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
void quequeMessage(MessageType type, int value1, int value2, double value3) | |||||
void quequeMessage(MessageType type, int32_t value1, int32_t value2, double value3) | |||||
{ | { | ||||
const QMutexLocker locker(&m_messages.lock); | const QMutexLocker locker(&m_messages.lock); | ||||
@@ -22,46 +22,59 @@ | |||||
#include <QtCore/QString> | #include <QtCore/QString> | ||||
#include <QtCore/QStringList> | #include <QtCore/QStringList> | ||||
//CARLA_BRIDGE_START_NAMESPACE | |||||
namespace CarlaBridge { | |||||
CARLA_BRIDGE_START_NAMESPACE | |||||
void osc_error_handler(const int num, const char* const msg, const char* const path) | |||||
{ | |||||
qCritical("osc_error_handler(%i, \"%s\", \"%s\")", num, msg, path); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client_, const char* const name) : | CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client_, const char* const name) : | ||||
client(client_) | client(client_) | ||||
{ | { | ||||
qDebug("CarlaBridgeOsc::CarlaBridgeOsc(%p, %s)", client_, name); | |||||
assert(client_); | |||||
assert(name); | |||||
qDebug("CarlaBridgeOsc::CarlaBridgeOsc(%p, \"%s\")", client_, name); | |||||
Q_ASSERT(client_); | |||||
Q_ASSERT(name); | |||||
m_serverPath = nullptr; | m_serverPath = nullptr; | ||||
m_serverThread = nullptr; | m_serverThread = nullptr; | ||||
m_serverData.path = nullptr; | |||||
m_serverData.source = nullptr; | |||||
m_serverData.target = nullptr; | |||||
m_controlData.path = nullptr; | |||||
m_controlData.source = nullptr; // unused | |||||
m_controlData.target = nullptr; | |||||
m_name = strdup(name); | m_name = strdup(name); | ||||
m_name_len = strlen(name); | |||||
m_nameSize = strlen(name); | |||||
} | } | ||||
CarlaBridgeOsc::~CarlaBridgeOsc() | CarlaBridgeOsc::~CarlaBridgeOsc() | ||||
{ | { | ||||
qDebug("CarlaBridgeOsc::~CarlaBridgeOsc()"); | qDebug("CarlaBridgeOsc::~CarlaBridgeOsc()"); | ||||
free((void*)m_name); | |||||
free(m_name); | |||||
} | } | ||||
void CarlaBridgeOsc::init(const char* const url) | |||||
bool CarlaBridgeOsc::init(const char* const url) | |||||
{ | { | ||||
qDebug("CarlaBridgeOsc::init(%s)", url); | |||||
assert(url); | |||||
qDebug("CarlaBridgeOsc::init(\"%s\")", url); | |||||
Q_ASSERT(! m_serverThread); | |||||
Q_ASSERT(url); | |||||
char* host = lo_url_get_hostname(url); | |||||
char* port = lo_url_get_port(url); | |||||
const char* host = lo_url_get_hostname(url); | |||||
const char* port = lo_url_get_port(url); | |||||
m_controlData.path = lo_url_get_path(url); | |||||
m_controlData.target = lo_address_new(host, port); | |||||
m_serverData.path = lo_url_get_path(url); | |||||
m_serverData.target = lo_address_new(host, port); | |||||
free(host); | |||||
free(port); | |||||
free((void*)host); | |||||
free((void*)port); | |||||
if (! m_controlData.path) | |||||
{ | |||||
qWarning("CarlaBridgeOsc::init(\"%s\") - failed to init OSC", url); | |||||
return false; | |||||
} | |||||
// create new OSC thread | // create new OSC thread | ||||
m_serverThread = lo_server_thread_new(nullptr, osc_error_handler); | m_serverThread = lo_server_thread_new(nullptr, osc_error_handler); | ||||
@@ -74,14 +87,16 @@ void CarlaBridgeOsc::init(const char* const url) | |||||
// register message handler and start OSC thread | // register message handler and start OSC thread | ||||
lo_server_thread_add_method(m_serverThread, nullptr, nullptr, osc_message_handler, this); | lo_server_thread_add_method(m_serverThread, nullptr, nullptr, osc_message_handler, this); | ||||
lo_server_thread_start(m_serverThread); | lo_server_thread_start(m_serverThread); | ||||
return true; | |||||
} | } | ||||
void CarlaBridgeOsc::close() | void CarlaBridgeOsc::close() | ||||
{ | { | ||||
qDebug("CarlaBridgeOsc::close()"); | qDebug("CarlaBridgeOsc::close()"); | ||||
assert(client); | |||||
Q_ASSERT(m_serverThread); | |||||
osc_clear_data(&m_serverData); | |||||
osc_clear_data(&m_controlData); | |||||
lo_server_thread_stop(m_serverThread); | lo_server_thread_stop(m_serverThread); | ||||
lo_server_thread_del_method(m_serverThread, nullptr, nullptr); | lo_server_thread_del_method(m_serverThread, nullptr, nullptr); | ||||
@@ -93,19 +108,19 @@ void CarlaBridgeOsc::close() | |||||
int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | ||||
{ | { | ||||
qDebug("CarlaBridgeOsc::handleMessage(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); | |||||
assert(m_serverThread); | |||||
assert(path); | |||||
qDebug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||||
Q_ASSERT(m_serverThread); | |||||
Q_ASSERT(path); | |||||
// Check if message is for this client | // Check if message is for this client | ||||
if (strlen(path) <= m_name_len || strncmp(path+1, m_name, m_name_len) != 0) | |||||
if (strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) | |||||
{ | { | ||||
qWarning("CarlaBridgeOsc::handleMessage() - message not for this client -> '%s' != '/%s/'", path, m_name); | qWarning("CarlaBridgeOsc::handleMessage() - message not for this client -> '%s' != '/%s/'", path, m_name); | ||||
return 1; | return 1; | ||||
} | } | ||||
char method[32] = { 0 }; | char method[32] = { 0 }; | ||||
memcpy(method, path + (m_name_len + 1), 32); | |||||
memcpy(method, path + (m_nameSize + 1), 32); | |||||
// Common OSC methods | // Common OSC methods | ||||
if (strcmp(method, "/configure") == 0) | if (strcmp(method, "/configure") == 0) | ||||
@@ -125,8 +140,7 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
if (strcmp(method, "/quit") == 0) | if (strcmp(method, "/quit") == 0) | ||||
return handle_quit(); | return handle_quit(); | ||||
// client specific methods | |||||
#if LV2_UI_GTK2 || LV2_UI_QT4 || LV2_UI_X11 | |||||
#ifdef BRIDGE_LV2 | |||||
if (strcmp(method, "/lv2_atom_transfer") == 0) | if (strcmp(method, "/lv2_atom_transfer") == 0) | ||||
return handle_lv2_atom_transfer(argc, argv, types); | return handle_lv2_atom_transfer(argc, argv, types); | ||||
if (strcmp(method, "/lv2_event_transfer") == 0) | if (strcmp(method, "/lv2_event_transfer") == 0) | ||||
@@ -139,9 +153,8 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
else if (strcmp(method, "set_parameter_midi_cc") == 0) | else if (strcmp(method, "set_parameter_midi_cc") == 0) | ||||
return osc_set_parameter_midi_channel_handler(argv); | return osc_set_parameter_midi_channel_handler(argv); | ||||
#endif | #endif | ||||
else | |||||
qWarning("Got unsupported OSC method '%s' on '%s'", method, path); | |||||
qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - Got unsupported OSC method '%s'", path, method); | |||||
return 1; | return 1; | ||||
} | } | ||||
@@ -187,15 +200,15 @@ int CarlaBridgeOsc::handle_configure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
int CarlaBridgeOsc::handle_control(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handle_control(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
{ | { | ||||
//qDebug("CarlaOsc::handle_control()"); | |||||
qDebug("CarlaOsc::handle_control()"); | |||||
CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); | ||||
if (! client) | if (! client) | ||||
return 1; | return 1; | ||||
const int rindex = argv[0]->i; | |||||
const float value = argv[1]->f; | |||||
client->quequeMessage(MESSAGE_PARAMETER, rindex, 0, value); | |||||
const int32_t index = argv[0]->i; | |||||
const float value = argv[1]->f; | |||||
client->quequeMessage(MESSAGE_PARAMETER, index, 0, value); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -208,7 +221,7 @@ int CarlaBridgeOsc::handle_program(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
if (! client) | if (! client) | ||||
return 1; | return 1; | ||||
const int index = argv[0]->i; | |||||
const int32_t index = argv[0]->i; | |||||
client->quequeMessage(MESSAGE_PROGRAM, index, 0, 0.0); | client->quequeMessage(MESSAGE_PROGRAM, index, 0, 0.0); | ||||
return 0; | return 0; | ||||
@@ -216,14 +229,14 @@ int CarlaBridgeOsc::handle_program(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
int CarlaBridgeOsc::handle_midi_program(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handle_midi_program(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
{ | { | ||||
qDebug("CarlaOsc::handle_program()"); | |||||
qDebug("CarlaOsc::handle_midi_program()"); | |||||
CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | ||||
if (! client) | if (! client) | ||||
return 1; | return 1; | ||||
const int bank = argv[0]->i; | |||||
const int program = argv[1]->i; | |||||
const int32_t bank = argv[0]->i; | |||||
const int32_t program = argv[1]->i; | |||||
client->quequeMessage(MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | client->quequeMessage(MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | ||||
return 0; | return 0; | ||||
@@ -237,7 +250,9 @@ int CarlaBridgeOsc::handle_midi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
if (! client) | if (! client) | ||||
return 1; | return 1; | ||||
const uint8_t* const data = argv[0]->m; | |||||
const uint8_t* const mdata = argv[0]->m; | |||||
const uint8_t data[4] = { mdata[0], mdata[1], mdata[2], mdata[3] }; | |||||
uint8_t status = data[1]; | uint8_t status = data[1]; | ||||
// Fix bad note-off | // Fix bad note-off | ||||
@@ -18,36 +18,35 @@ | |||||
#ifndef CARLA_BRIDGE_OSC_H | #ifndef CARLA_BRIDGE_OSC_H | ||||
#define CARLA_BRIDGE_OSC_H | #define CARLA_BRIDGE_OSC_H | ||||
#include "carla_osc_includes.h" | |||||
#include "carla_bridge.h" | #include "carla_bridge.h" | ||||
#include "carla_osc_includes.h" | |||||
#define CARLA_BRIDGE_OSC_HANDLE_ARGS const int argc, const lo_arg* const* const argv, const char* const types | #define CARLA_BRIDGE_OSC_HANDLE_ARGS const int argc, const lo_arg* const* const argv, const char* const types | ||||
#define CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ | |||||
/* check argument count */ \ | |||||
if (argc != argcToCompare) \ | |||||
{ \ | |||||
#define CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ | |||||
/* check argument count */ \ | |||||
if (argc != argcToCompare) \ | |||||
{ \ | |||||
qCritical("CarlaBridgeOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | qCritical("CarlaBridgeOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ | ||||
return 1; \ | |||||
} \ | |||||
if (argc > 0) \ | |||||
{ \ | |||||
/* check for nullness */ \ | |||||
if (! (types && typesToCompare)) \ | |||||
{ \ | |||||
return 1; \ | |||||
} \ | |||||
if (argc > 0) \ | |||||
{ \ | |||||
/* check for nullness */ \ | |||||
if (! (types && typesToCompare)) \ | |||||
{ \ | |||||
qCritical("CarlaBridgeOsc::%s() - argument types are null", __FUNCTION__); \ | qCritical("CarlaBridgeOsc::%s() - argument types are null", __FUNCTION__); \ | ||||
return 1; \ | |||||
} \ | |||||
/* check argument types */ \ | |||||
if (strcmp(types, typesToCompare) != 0) \ | |||||
{ \ | |||||
return 1; \ | |||||
} \ | |||||
/* check argument types */ \ | |||||
if (strcmp(types, typesToCompare) != 0) \ | |||||
{ \ | |||||
qCritical("CarlaBridgeOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | qCritical("CarlaBridgeOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ | ||||
return 1; \ | |||||
} \ | |||||
return 1; \ | |||||
} \ | |||||
} | } | ||||
//CARLA_BRIDGE_START_NAMESPACE | |||||
namespace CarlaBridge { | |||||
CARLA_BRIDGE_START_NAMESPACE | |||||
class CarlaBridgeOsc | class CarlaBridgeOsc | ||||
{ | { | ||||
@@ -55,17 +54,37 @@ public: | |||||
CarlaBridgeOsc(CarlaBridgeClient* const client, const char* const name); | CarlaBridgeOsc(CarlaBridgeClient* const client, const char* const name); | ||||
~CarlaBridgeOsc(); | ~CarlaBridgeOsc(); | ||||
void init(const char* const url); | |||||
bool init(const char* const url); | |||||
void close(); | void close(); | ||||
const CarlaOscData* getServerData() const | |||||
const CarlaOscData* getControllerData() const | |||||
{ | |||||
return &m_controlData; | |||||
} | |||||
void sendOscConfigure(const char* const key, const char* const value) | |||||
{ | { | ||||
return &m_serverData; | |||||
osc_send_configure(&m_controlData, key, value); | |||||
} | |||||
void sendOscControl(int32_t index, float value) | |||||
{ | |||||
osc_send_control(&m_controlData, index, value); | |||||
} | } | ||||
void sendOscUpdate() | void sendOscUpdate() | ||||
{ | { | ||||
osc_send_update(&m_serverData, m_serverPath); | |||||
osc_send_update(&m_controlData, m_serverPath); | |||||
} | |||||
void sendOscExiting() | |||||
{ | |||||
osc_send_exiting(&m_controlData); | |||||
} | |||||
void sendOscLv2EventTransfer(const char* const type, const char* const key, const char* const value) | |||||
{ | |||||
osc_send_lv2_event_transfer(&m_controlData, type, key, value); | |||||
} | } | ||||
private: | private: | ||||
@@ -73,18 +92,13 @@ private: | |||||
const char* m_serverPath; | const char* m_serverPath; | ||||
lo_server_thread m_serverThread; | lo_server_thread m_serverThread; | ||||
CarlaOscData m_serverData; | |||||
CarlaOscData m_controlData; | |||||
const char* m_name; | |||||
size_t m_name_len; | |||||
char* m_name; | |||||
size_t m_nameSize; | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
static void osc_error_handler(const int num, const char* const msg, const char* const path) | |||||
{ | |||||
qCritical("osc_error_handler(%i, %s, %s)", num, msg, path); | |||||
} | |||||
static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const user_data) | static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const user_data) | ||||
{ | { | ||||
CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data; | CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data; | ||||
@@ -106,8 +120,10 @@ private: | |||||
int handle_hide(); | int handle_hide(); | ||||
int handle_quit(); | int handle_quit(); | ||||
#ifdef BRIDGE_LV2 | |||||
int handle_lv2_atom_transfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | int handle_lv2_atom_transfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | ||||
int handle_lv2_event_transfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | int handle_lv2_event_transfer(CARLA_BRIDGE_OSC_HANDLE_ARGS); | ||||
#endif | |||||
}; | }; | ||||
#ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
@@ -18,7 +18,7 @@ | |||||
#include "carla_bridge_client.h" | #include "carla_bridge_client.h" | ||||
#ifdef BRIDGE_LV2_X11 | #ifdef BRIDGE_LV2_X11 | ||||
#error X11 UI uses Qt4 | |||||
# error X11 UI uses Qt4 | |||||
#endif | #endif | ||||
#include <gtk/gtk.h> | #include <gtk/gtk.h> | ||||
@@ -31,16 +31,16 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
class CarlaBridgeToolkitGtk2: public CarlaBridgeToolkit | class CarlaBridgeToolkitGtk2: public CarlaBridgeToolkit | ||||
{ | { | ||||
public: | public: | ||||
CarlaBridgeToolkitGtk2(const char* const title) : | |||||
CarlaBridgeToolkit(title), | |||||
settings("Cadence", "Carla-Gtk2UIs") | |||||
CarlaBridgeToolkitGtk2(const char* const title) | |||||
: CarlaBridgeToolkit(title), | |||||
settings("Cadence", "Carla-Gtk2UIs") | |||||
{ | { | ||||
qDebug("CarlaBridgeToolkitGtk2::CarlaBridgeToolkitGtk2(%s)", title); | qDebug("CarlaBridgeToolkitGtk2::CarlaBridgeToolkitGtk2(%s)", title); | ||||
window = nullptr; | window = nullptr; | ||||
last_x = last_y = 0; | |||||
last_width = last_height = 0; | |||||
lastX = lastY = 0; | |||||
lastWidth = lastHeight = 0; | |||||
} | } | ||||
~CarlaBridgeToolkitGtk2() | ~CarlaBridgeToolkitGtk2() | ||||
@@ -60,7 +60,7 @@ public: | |||||
void exec(CarlaBridgeClient* const client) | void exec(CarlaBridgeClient* const client) | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitGtk2::exec(%p)", client); | qDebug("CarlaBridgeToolkitGtk2::exec(%p)", client); | ||||
assert(client); | |||||
Q_ASSERT(client); | |||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||||
gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | ||||
@@ -68,20 +68,20 @@ public: | |||||
gtk_window_set_resizable(GTK_WINDOW(window), client->isResizable()); | gtk_window_set_resizable(GTK_WINDOW(window), client->isResizable()); | ||||
gtk_window_set_title(GTK_WINDOW(window), m_title); | gtk_window_set_title(GTK_WINDOW(window), m_title); | ||||
gtk_window_get_position(GTK_WINDOW(window), &last_x, &last_y); | |||||
gtk_window_get_size(GTK_WINDOW(window), &last_width, &last_height); | |||||
gtk_window_get_position(GTK_WINDOW(window), &lastX, &lastY); | |||||
gtk_window_get_size(GTK_WINDOW(window), &lastWidth, &lastHeight); | |||||
if (settings.contains(QString("%1/pos_x").arg(m_title))) | if (settings.contains(QString("%1/pos_x").arg(m_title))) | ||||
{ | { | ||||
last_x = settings.value(QString("%1/pos_x").arg(m_title), last_x).toInt(); | |||||
last_y = settings.value(QString("%1/pos_y").arg(m_title), last_y).toInt(); | |||||
gtk_window_move(GTK_WINDOW(window), last_x, last_y); | |||||
lastX = settings.value(QString("%1/pos_x").arg(m_title), lastX).toInt(); | |||||
lastY = settings.value(QString("%1/pos_y").arg(m_title), lastY).toInt(); | |||||
gtk_window_move(GTK_WINDOW(window), lastX, lastY); | |||||
if (client->isResizable()) | if (client->isResizable()) | ||||
{ | { | ||||
last_width = settings.value(QString("%1/width").arg(m_title), last_width).toInt(); | |||||
last_height = settings.value(QString("%1/height").arg(m_title), last_height).toInt(); | |||||
gtk_window_resize(GTK_WINDOW(window), last_width, last_height); | |||||
lastWidth = settings.value(QString("%1/width").arg(m_title), lastWidth).toInt(); | |||||
lastHeight = settings.value(QString("%1/height").arg(m_title), lastHeight).toInt(); | |||||
gtk_window_resize(GTK_WINDOW(window), lastWidth, lastHeight); | |||||
} | } | ||||
} | } | ||||
@@ -89,7 +89,11 @@ public: | |||||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | ||||
m_client = client; | m_client = client; | ||||
client->oscSendUpdate(); | |||||
m_client->sendOscUpdate(); | |||||
#ifdef QTCREATOR_TEST | |||||
show(); | |||||
#endif | |||||
// Main loop | // Main loop | ||||
gtk_main(); | gtk_main(); | ||||
@@ -113,7 +117,7 @@ public: | |||||
void show() | void show() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitGtk2::show()"); | qDebug("CarlaBridgeToolkitGtk2::show()"); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
gtk_widget_show_all(window); | gtk_widget_show_all(window); | ||||
@@ -122,7 +126,7 @@ public: | |||||
void hide() | void hide() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitGtk2::hide()"); | qDebug("CarlaBridgeToolkitGtk2::hide()"); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
gtk_widget_hide_all(window); | gtk_widget_hide_all(window); | ||||
@@ -131,7 +135,7 @@ public: | |||||
void resize(int width, int height) | void resize(int width, int height) | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitGtk2::resize(%i, %i)", width, height); | qDebug("CarlaBridgeToolkitGtk2::resize(%i, %i)", width, height); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
gtk_window_resize(GTK_WINDOW(window), width, height); | gtk_window_resize(GTK_WINDOW(window), width, height); | ||||
@@ -141,7 +145,7 @@ private: | |||||
GtkWidget* window; | GtkWidget* window; | ||||
QSettings settings; | QSettings settings; | ||||
gint last_x, last_y, last_width, last_height; | |||||
gint lastX, lastY, lastWidth, lastHeight; | |||||
static void gtk_ui_destroy(GtkWidget*, gpointer data) | static void gtk_ui_destroy(GtkWidget*, gpointer data) | ||||
{ | { | ||||
@@ -164,10 +168,10 @@ private: | |||||
window = nullptr; | window = nullptr; | ||||
m_client = nullptr; | m_client = nullptr; | ||||
settings.setValue(QString("%1/pos_x").arg(m_title), last_x); | |||||
settings.setValue(QString("%1/pos_y").arg(m_title), last_y); | |||||
settings.setValue(QString("%1/width").arg(m_title), last_width); | |||||
settings.setValue(QString("%1/height").arg(m_title), last_height); | |||||
settings.setValue(QString("%1/pos_x").arg(m_title), lastX); | |||||
settings.setValue(QString("%1/pos_y").arg(m_title), lastY); | |||||
settings.setValue(QString("%1/width").arg(m_title), lastWidth); | |||||
settings.setValue(QString("%1/height").arg(m_title), lastHeight); | |||||
settings.sync(); | settings.sync(); | ||||
} | } | ||||
@@ -175,8 +179,8 @@ private: | |||||
{ | { | ||||
if (window) | if (window) | ||||
{ | { | ||||
gtk_window_get_position(GTK_WINDOW(window), &last_x, &last_y); | |||||
gtk_window_get_size(GTK_WINDOW(window), &last_width, &last_height); | |||||
gtk_window_get_position(GTK_WINDOW(window), &lastX, &lastY); | |||||
gtk_window_get_size(GTK_WINDOW(window), &lastWidth, &lastHeight); | |||||
} | } | ||||
return m_client ? m_client->runMessages() : false; | return m_client ? m_client->runMessages() : false; | ||||
@@ -32,10 +32,10 @@ namespace CarlaBridge { | |||||
class MessageChecker : public QTimer | class MessageChecker : public QTimer | ||||
{ | { | ||||
public: | public: | ||||
MessageChecker(CarlaBridgeClient* const client_) : | |||||
client(client_) | |||||
MessageChecker(CarlaBridgeClient* const client_) | |||||
: client(client_) | |||||
{ | { | ||||
assert(client); | |||||
Q_ASSERT(client); | |||||
} | } | ||||
void timerEvent(QTimerEvent*) | void timerEvent(QTimerEvent*) | ||||
@@ -73,7 +73,7 @@ public: | |||||
void init() | void init() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::init()"); | qDebug("CarlaBridgeToolkitQt4::init()"); | ||||
assert(! app); | |||||
Q_ASSERT(! app); | |||||
static int argc = 0; | static int argc = 0; | ||||
static char* argv[] = { nullptr }; | static char* argv[] = { nullptr }; | ||||
@@ -83,8 +83,8 @@ public: | |||||
void exec(CarlaBridgeClient* const client) | void exec(CarlaBridgeClient* const client) | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::exec(%p)", client); | qDebug("CarlaBridgeToolkitQt4::exec(%p)", client); | ||||
assert(app); | |||||
assert(client); | |||||
Q_ASSERT(app); | |||||
Q_ASSERT(client); | |||||
if (client->needsReparent()) | if (client->needsReparent()) | ||||
{ | { | ||||
@@ -131,7 +131,11 @@ public: | |||||
QObject::connect(window, SIGNAL(finished(int)), app, SLOT(quit())); | QObject::connect(window, SIGNAL(finished(int)), app, SLOT(quit())); | ||||
m_client = client; | m_client = client; | ||||
client->oscSendUpdate(); | |||||
m_client->sendOscUpdate(); | |||||
#ifdef QTCREATOR_TEST | |||||
show(); | |||||
#endif | |||||
// Main loop | // Main loop | ||||
app->exec(); | app->exec(); | ||||
@@ -140,7 +144,7 @@ public: | |||||
void quit() | void quit() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::quit()"); | qDebug("CarlaBridgeToolkitQt4::quit()"); | ||||
assert(app); | |||||
Q_ASSERT(app); | |||||
if (window) | if (window) | ||||
{ | { | ||||
@@ -173,7 +177,7 @@ public: | |||||
void show() | void show() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::show()"); | qDebug("CarlaBridgeToolkitQt4::show()"); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
window->show(); | window->show(); | ||||
@@ -182,7 +186,7 @@ public: | |||||
void hide() | void hide() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::hide()"); | qDebug("CarlaBridgeToolkitQt4::hide()"); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
window->hide(); | window->hide(); | ||||
@@ -191,7 +195,7 @@ public: | |||||
void resize(int width, int height) | void resize(int width, int height) | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt4::resize(%i, %i)", width, height); | qDebug("CarlaBridgeToolkitQt4::resize(%i, %i)", width, height); | ||||
assert(window); | |||||
Q_ASSERT(window); | |||||
if (window) | if (window) | ||||
window->setFixedSize(width, height); | window->setFixedSize(width, height); | ||||
@@ -20,18 +20,17 @@ | |||||
#include "carla_bridge.h" | #include "carla_bridge.h" | ||||
#include <cassert> | |||||
#include <cstdlib> | |||||
#include <cstring> | #include <cstring> | ||||
//CARLA_BRIDGE_START_NAMESPACE | |||||
namespace CarlaBridge { | |||||
CARLA_BRIDGE_START_NAMESPACE | |||||
class CarlaBridgeToolkit | class CarlaBridgeToolkit | ||||
{ | { | ||||
public: | public: | ||||
CarlaBridgeToolkit(const char* const title) | CarlaBridgeToolkit(const char* const title) | ||||
{ | { | ||||
assert(title); | |||||
Q_ASSERT(title); | |||||
m_title = strdup(title); | m_title = strdup(title); | ||||
m_client = nullptr; | m_client = nullptr; | ||||
@@ -39,7 +38,7 @@ public: | |||||
virtual ~CarlaBridgeToolkit() | virtual ~CarlaBridgeToolkit() | ||||
{ | { | ||||
free((void*)m_title); | |||||
free(m_title); | |||||
} | } | ||||
virtual void init() = 0; | virtual void init() = 0; | ||||
@@ -53,7 +52,7 @@ public: | |||||
static CarlaBridgeToolkit* createNew(const char* const title); | static CarlaBridgeToolkit* createNew(const char* const title); | ||||
protected: | protected: | ||||
const char* m_title; | |||||
char* m_title; | |||||
CarlaBridgeClient* m_client; | CarlaBridgeClient* m_client; | ||||
}; | }; | ||||
@@ -315,8 +315,6 @@ public: | |||||
void close() | void close() | ||||
{ | { | ||||
assert(handle && descriptor); | |||||
if (handle && descriptor && descriptor->cleanup) | if (handle && descriptor && descriptor->cleanup) | ||||
descriptor->cleanup(handle); | descriptor->cleanup(handle); | ||||
@@ -482,7 +480,7 @@ public: | |||||
void handleProgramChanged(int32_t /*index*/) | void handleProgramChanged(int32_t /*index*/) | ||||
{ | { | ||||
osc_send_configure(getOscServerData(), "reloadprograms", ""); | |||||
sendOscConfigure("reloadprograms", ""); | |||||
} | } | ||||
uint32_t handleUiPortMap(const char* const symbol) | uint32_t handleUiPortMap(const char* const symbol) | ||||
@@ -519,7 +517,7 @@ public: | |||||
if (bufferSize == sizeof(float)) | if (bufferSize == sizeof(float)) | ||||
{ | { | ||||
float value = *(float*)buffer; | float value = *(float*)buffer; | ||||
osc_send_control(getOscServerData(), portIndex, value); | |||||
sendOscControl(portIndex, value); | |||||
} | } | ||||
} | } | ||||
else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | else if (format == CARLA_URI_MAP_ID_ATOM_TRANSFER_ATOM) | ||||
@@ -537,7 +535,7 @@ public: | |||||
descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); | descriptor->port_event(handle, 0, atom->size, CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); | ||||
QByteArray chunk((const char*)buffer, bufferSize); | QByteArray chunk((const char*)buffer, bufferSize); | ||||
osc_send_lv2_event_transfer(getOscServerData(), getCustomURIString(atom->type), LV2_ATOM__eventTransfer, chunk.toBase64().constData()); | |||||
sendOscLv2EventTransfer(getCustomURIString(atom->type), LV2_ATOM__eventTransfer, chunk.toBase64().constData()); | |||||
} | } | ||||
} | } | ||||
@@ -866,7 +864,12 @@ int main(int argc, char* argv[]) | |||||
CarlaBridgeLv2Client client(toolkit); | CarlaBridgeLv2Client client(toolkit); | ||||
// Init OSC | // Init OSC | ||||
client.oscInit(osc_url); | |||||
if (! client.oscInit(osc_url)) | |||||
{ | |||||
toolkit->quit(); | |||||
delete toolkit; | |||||
return -1; | |||||
} | |||||
// Load UI | // Load UI | ||||
int ret; | int ret; | ||||
@@ -883,7 +886,7 @@ int main(int argc, char* argv[]) | |||||
} | } | ||||
// Close OSC | // Close OSC | ||||
osc_send_exiting(client.getOscServerData()); | |||||
client.sendOscExiting(); | |||||
client.oscClose(); | client.oscClose(); | ||||
// Close LV2-UI | // Close LV2-UI | ||||
@@ -229,7 +229,7 @@ public: | |||||
return FAKE_BUFFER_SIZE; | return FAKE_BUFFER_SIZE; | ||||
case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
strcpy((char*)ptr, "falkTX"); | |||||
strcpy((char*)ptr, "Cadence"); | |||||
break; | break; | ||||
case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
@@ -332,7 +332,12 @@ int main(int argc, char* argv[]) | |||||
CarlaBridgeVstClient client(toolkit); | CarlaBridgeVstClient client(toolkit); | ||||
// Init OSC | // Init OSC | ||||
client.oscInit(osc_url); | |||||
if (! client.oscInit(osc_url)) | |||||
{ | |||||
toolkit->quit(); | |||||
delete toolkit; | |||||
return -1; | |||||
} | |||||
// Load UI | // Load UI | ||||
int ret; | int ret; | ||||
@@ -349,7 +354,7 @@ int main(int argc, char* argv[]) | |||||
} | } | ||||
// Close OSC | // Close OSC | ||||
osc_send_exiting(client.getOscServerData()); | |||||
client.sendOscExiting(); | |||||
client.oscClose(); | client.oscClose(); | ||||
// Close VST-UI | // Close VST-UI | ||||
@@ -32,6 +32,8 @@ INCLUDEPATH = .. \ | |||||
LIBS = \ | LIBS = \ | ||||
../../carla-lilv/carla_lilv.a | ../../carla-lilv/carla_lilv.a | ||||
DEFINES = DEBUG BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2_GTK2 | |||||
DEFINES = DEBUG | |||||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK2 | |||||
DEFINES += QTCREATOR_TEST | |||||
QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x |
@@ -32,6 +32,8 @@ INCLUDEPATH = .. \ | |||||
LIBS = \ | LIBS = \ | ||||
../../carla-lilv/carla_lilv.a | ../../carla-lilv/carla_lilv.a | ||||
DEFINES = BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2_QT4 | |||||
DEFINES = DEBUG | |||||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_QT4 | |||||
DEFINES += QTCREATOR_TEST | |||||
QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x |
@@ -32,6 +32,8 @@ INCLUDEPATH = .. \ | |||||
LIBS = \ | LIBS = \ | ||||
../../carla-lilv/carla_lilv.a | ../../carla-lilv/carla_lilv.a | ||||
DEFINES = BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2_X11 | |||||
DEFINES = DEBUG | |||||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_X11 | |||||
DEFINES += QTCREATOR_TEST | |||||
QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x |
@@ -28,6 +28,8 @@ HEADERS = \ | |||||
INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
../../carla-includes | ../../carla-includes | ||||
DEFINES = BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST_X11 | |||||
DEFINES = DEBUG | |||||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST BRIDGE_VST_X11 | |||||
DEFINES += QTCREATOR_TEST | |||||
QMAKE_CXXFLAGS *= -std=c++0x | QMAKE_CXXFLAGS *= -std=c++0x |
@@ -109,7 +109,7 @@ intptr_t VstHostCallback(AEffect* const effect, const int32_t opcode, const int3 | |||||
return bufferSize; | return bufferSize; | ||||
case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
strcpy((char*)ptr, "falkTX"); | |||||
strcpy((char*)ptr, "Cadence"); | |||||
break; | break; | ||||
case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
@@ -216,7 +216,7 @@ void do_ladspa_check(void* const lib_handle, const bool init) | |||||
{ | { | ||||
if (LADSPA_IS_PORT_INPUT(PortDescriptor)) | if (LADSPA_IS_PORT_INPUT(PortDescriptor)) | ||||
parametersIns += 1; | parametersIns += 1; | ||||
else if (LADSPA_IS_PORT_OUTPUT(PortDescriptor) && strcmp(descriptor->PortNames[j], "latency") != 0 && strcmp(descriptor->PortNames[j], "_latency") != 0) | |||||
else if (LADSPA_IS_PORT_OUTPUT(PortDescriptor) && strcmp(descriptor->PortNames[j], "latency") && strcmp(descriptor->PortNames[j], "_latency") && strcmp(descriptor->PortNames[j], "_sample-rate")) | |||||
parametersOuts += 1; | parametersOuts += 1; | ||||
parametersTotal += 1; | parametersTotal += 1; | ||||
} | } | ||||
@@ -235,13 +235,13 @@ void do_ladspa_check(void* const lib_handle, const bool init) | |||||
continue; | continue; | ||||
} | } | ||||
float bufferAudio[bufferSize][audioTotal]; | |||||
LADSPA_Data bufferAudio[bufferSize][audioTotal]; | |||||
memset(bufferAudio, 0, sizeof(float)*bufferSize*audioTotal); | memset(bufferAudio, 0, sizeof(float)*bufferSize*audioTotal); | ||||
float bufferParams[parametersTotal]; | |||||
LADSPA_Data bufferParams[parametersTotal]; | |||||
memset(bufferParams, 0, sizeof(float)*parametersTotal); | memset(bufferParams, 0, sizeof(float)*parametersTotal); | ||||
float min, max, def; | |||||
LADSPA_Data min, max, def; | |||||
for (unsigned long j=0, iA=0, iP=0; j < descriptor->PortCount; j++) | for (unsigned long j=0, iA=0, iP=0; j < descriptor->PortCount; j++) | ||||
{ | { | ||||
@@ -258,23 +258,23 @@ void do_ladspa_check(void* const lib_handle, const bool init) | |||||
if (LADSPA_IS_HINT_BOUNDED_BELOW(PortHint.HintDescriptor)) | if (LADSPA_IS_HINT_BOUNDED_BELOW(PortHint.HintDescriptor)) | ||||
min = PortHint.LowerBound; | min = PortHint.LowerBound; | ||||
else | else | ||||
min = 0.0; | |||||
min = 0.0f; | |||||
// max value | // max value | ||||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortHint.HintDescriptor)) | if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortHint.HintDescriptor)) | ||||
max = PortHint.UpperBound; | max = PortHint.UpperBound; | ||||
else | else | ||||
max = 1.0; | |||||
max = 1.0f; | |||||
if (min > max) | if (min > max) | ||||
max = min; | max = min; | ||||
else if (max < min) | else if (max < min) | ||||
min = max; | min = max; | ||||
if (max - min == 0.0) | |||||
if (max - min == 0.0f) | |||||
{ | { | ||||
DISCOVERY_OUT("error", "Broken parameter: max - min == 0"); | DISCOVERY_OUT("error", "Broken parameter: max - min == 0"); | ||||
max = min + 0.1; | |||||
max = min + 0.1f; | |||||
} | } | ||||
// default value | // default value | ||||
@@ -295,9 +295,9 @@ void do_ladspa_check(void* const lib_handle, const bool init) | |||||
if (LADSPA_IS_PORT_OUTPUT(PortType) && (strcmp(descriptor->PortNames[j], "latency") == 0 || strcmp(descriptor->PortNames[j], "_latency") == 0)) | if (LADSPA_IS_PORT_OUTPUT(PortType) && (strcmp(descriptor->PortNames[j], "latency") == 0 || strcmp(descriptor->PortNames[j], "_latency") == 0)) | ||||
{ | { | ||||
// latency parameter | // latency parameter | ||||
min = 0.0; | |||||
min = 0.0f; | |||||
max = sampleRate; | max = sampleRate; | ||||
def = 0.0; | |||||
def = 0.0f; | |||||
} | } | ||||
bufferParams[iP] = def; | bufferParams[iP] = def; | ||||
@@ -354,7 +354,7 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
while ((descriptor = descfn(i++))) | while ((descriptor = descfn(i++))) | ||||
{ | { | ||||
const LADSPA_Descriptor* ldescriptor = descriptor->LADSPA_Plugin; | |||||
const LADSPA_Descriptor* const ldescriptor = descriptor->LADSPA_Plugin; | |||||
int hints = 0; | int hints = 0; | ||||
int audioIns = 0; | int audioIns = 0; | ||||
@@ -383,7 +383,7 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
{ | { | ||||
if (LADSPA_IS_PORT_INPUT(PortDescriptor)) | if (LADSPA_IS_PORT_INPUT(PortDescriptor)) | ||||
parametersIns += 1; | parametersIns += 1; | ||||
else if (LADSPA_IS_PORT_OUTPUT(PortDescriptor) && strcmp(ldescriptor->PortNames[j], "latency") != 0 && strcmp(ldescriptor->PortNames[j], "_latency") != 0) | |||||
else if (LADSPA_IS_PORT_OUTPUT(PortDescriptor) && strcmp(ldescriptor->PortNames[j], "latency") && strcmp(ldescriptor->PortNames[j], "_latency") && strcmp(ldescriptor->PortNames[j], "_sample-rate")) | |||||
parametersOuts += 1; | parametersOuts += 1; | ||||
parametersTotal += 1; | parametersTotal += 1; | ||||
} | } | ||||
@@ -415,13 +415,13 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
continue; | continue; | ||||
} | } | ||||
float bufferAudio[bufferSize][audioTotal]; | |||||
LADSPA_Data bufferAudio[bufferSize][audioTotal]; | |||||
memset(bufferAudio, 0, sizeof(float)*bufferSize*audioTotal); | memset(bufferAudio, 0, sizeof(float)*bufferSize*audioTotal); | ||||
float bufferParams[parametersTotal]; | |||||
LADSPA_Data bufferParams[parametersTotal]; | |||||
memset(bufferParams, 0, sizeof(float)*parametersTotal); | memset(bufferParams, 0, sizeof(float)*parametersTotal); | ||||
float min, max, def; | |||||
LADSPA_Data min, max, def; | |||||
for (unsigned long j=0, iA=0, iP=0; j < ldescriptor->PortCount; j++) | for (unsigned long j=0, iA=0, iP=0; j < ldescriptor->PortCount; j++) | ||||
{ | { | ||||
@@ -438,23 +438,23 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
if (LADSPA_IS_HINT_BOUNDED_BELOW(PortHint.HintDescriptor)) | if (LADSPA_IS_HINT_BOUNDED_BELOW(PortHint.HintDescriptor)) | ||||
min = PortHint.LowerBound; | min = PortHint.LowerBound; | ||||
else | else | ||||
min = 0.0; | |||||
min = 0.0f; | |||||
// max value | // max value | ||||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortHint.HintDescriptor)) | if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortHint.HintDescriptor)) | ||||
max = PortHint.UpperBound; | max = PortHint.UpperBound; | ||||
else | else | ||||
max = 1.0; | |||||
max = 1.0f; | |||||
if (min > max) | if (min > max) | ||||
max = min; | max = min; | ||||
else if (max < min) | else if (max < min) | ||||
min = max; | min = max; | ||||
if (max - min == 0.0) | |||||
if (max - min == 0.0f) | |||||
{ | { | ||||
DISCOVERY_OUT("error", "Broken parameter: max - min == 0"); | DISCOVERY_OUT("error", "Broken parameter: max - min == 0"); | ||||
max = min + 0.1; | |||||
max = min + 0.1f; | |||||
} | } | ||||
// default value | // default value | ||||
@@ -475,9 +475,9 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
if (LADSPA_IS_PORT_OUTPUT(PortType) && (strcmp(ldescriptor->PortNames[j], "latency") == 0 || strcmp(ldescriptor->PortNames[j], "_latency") == 0)) | if (LADSPA_IS_PORT_OUTPUT(PortType) && (strcmp(ldescriptor->PortNames[j], "latency") == 0 || strcmp(ldescriptor->PortNames[j], "_latency") == 0)) | ||||
{ | { | ||||
// latency parameter | // latency parameter | ||||
min = 0.0; | |||||
min = 0.0f; | |||||
max = sampleRate; | max = sampleRate; | ||||
def = 0.0; | |||||
def = 0.0f; | |||||
} | } | ||||
bufferParams[iP] = def; | bufferParams[iP] = def; | ||||
@@ -505,7 +505,7 @@ void do_dssi_check(void* const lib_handle, const bool init) | |||||
midiEvents[1].data.note.velocity = 0; | midiEvents[1].data.note.velocity = 0; | ||||
midiEvents[1].time.tick = bufferSize/2; | midiEvents[1].time.tick = bufferSize/2; | ||||
if (descriptor->run_multiple_synths) | |||||
if (descriptor->run_multiple_synths && ! descriptor->run_synth) | |||||
{ | { | ||||
LADSPA_Handle handlePtr[1] = { handle }; | LADSPA_Handle handlePtr[1] = { handle }; | ||||
snd_seq_event_t* midiEventsPtr[1] = { midiEvents }; | snd_seq_event_t* midiEventsPtr[1] = { midiEvents }; | ||||
@@ -596,7 +596,7 @@ void do_lv2_check(const char* const bundle, const bool init) | |||||
for (uint32_t j=0; j < rdf_descriptor->PortCount; j++) | for (uint32_t j=0; j < rdf_descriptor->PortCount; j++) | ||||
{ | { | ||||
const LV2_RDF_Port* const Port = &rdf_descriptor->Ports[j]; | const LV2_RDF_Port* const Port = &rdf_descriptor->Ports[j]; | ||||
bool validPort = (LV2_IS_PORT_CONTROL(Port->Type) || LV2_IS_PORT_AUDIO(Port->Type) || LV2_IS_PORT_ATOM_SEQUENCE(Port->Type) || LV2_IS_PORT_CV(Port->Type) || LV2_IS_PORT_EVENT(Port->Type) || LV2_IS_PORT_MIDI_LL(Port->Type)); | |||||
bool validPort = (LV2_IS_PORT_CONTROL(Port->Type) || LV2_IS_PORT_AUDIO(Port->Type) || LV2_IS_PORT_ATOM_SEQUENCE(Port->Type) /*|| LV2_IS_PORT_CV(Port->Type)*/ || LV2_IS_PORT_EVENT(Port->Type) || LV2_IS_PORT_MIDI_LL(Port->Type)); | |||||
if (! (validPort || LV2_IS_PORT_OPTIONAL(Port->Properties))) | if (! (validPort || LV2_IS_PORT_OPTIONAL(Port->Properties))) | ||||
{ | { | ||||
@@ -707,180 +707,181 @@ void do_vst_check(void* const lib_handle, const bool init) | |||||
AEffect* const effect = vstfn(VstHostCallback); | AEffect* const effect = vstfn(VstHostCallback); | ||||
if (effect && effect->magic == kEffectMagic) | |||||
if (! (effect && effect->magic == kEffectMagic)) | |||||
{ | { | ||||
const char* cName; | |||||
const char* cProduct; | |||||
const char* cVendor; | |||||
char strBuf[255] = { 0 }; | |||||
DISCOVERY_OUT("error", "Failed to init VST plugin"); | |||||
return; | |||||
} | |||||
effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f); | |||||
cName = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
const char* cName; | |||||
const char* cProduct; | |||||
const char* cVendor; | |||||
char strBuf[255] = { 0 }; | |||||
strBuf[0] = 0; | |||||
effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f); | |||||
cProduct = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f); | |||||
cName = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
strBuf[0] = 0; | |||||
effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f); | |||||
cVendor = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
strBuf[0] = 0; | |||||
effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f); | |||||
cProduct = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
VstCurrentUniqueId = effect->uniqueID; | |||||
intptr_t VstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f); | |||||
strBuf[0] = 0; | |||||
effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f); | |||||
cVendor = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
// only init if required | |||||
if (init || VstCategory == kPlugCategShell) | |||||
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | |||||
VstCurrentUniqueId = effect->uniqueID; | |||||
intptr_t VstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f); | |||||
while (true) | |||||
{ | |||||
int hints = 0; | |||||
int audioIns = effect->numInputs; | |||||
int audioOuts = effect->numOutputs; | |||||
int audioTotal = audioIns + audioOuts; | |||||
int midiIns = 0; | |||||
int midiOuts = 0; | |||||
int midiTotal = 0; | |||||
int parametersIns = effect->numParams; | |||||
int parametersTotal = parametersIns; | |||||
int programsTotal = effect->numPrograms; | |||||
// only init if required | |||||
if (init || VstCategory == kPlugCategShell) | |||||
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | |||||
while (true) | |||||
{ | |||||
int hints = 0; | |||||
int audioIns = effect->numInputs; | |||||
int audioOuts = effect->numOutputs; | |||||
int audioTotal = audioIns + audioOuts; | |||||
int midiIns = 0; | |||||
int midiOuts = 0; | |||||
int midiTotal = 0; | |||||
int parametersIns = effect->numParams; | |||||
int parametersTotal = parametersIns; | |||||
int programsTotal = effect->numPrograms; | |||||
if (effect->flags & effFlagsHasEditor) | |||||
hints |= PLUGIN_HAS_GUI; | |||||
if (effect->flags & effFlagsHasEditor) | |||||
hints |= PLUGIN_HAS_GUI; | |||||
if (effect->flags & effFlagsIsSynth) | |||||
hints |= PLUGIN_IS_SYNTH; | |||||
if (effect->flags & effFlagsIsSynth) | |||||
hints |= PLUGIN_IS_SYNTH; | |||||
if (VstPluginCanDo(effect, "receiveVstEvents") || VstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) > 0) | |||||
midiIns = 1; | |||||
if (VstPluginCanDo(effect, "receiveVstEvents") || VstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) > 0) | |||||
midiIns = 1; | |||||
if (VstPluginCanDo(effect, "sendVstEvents") || VstPluginCanDo(effect, "sendVstMidiEvent")) | |||||
midiOuts = 1; | |||||
if (VstPluginCanDo(effect, "sendVstEvents") || VstPluginCanDo(effect, "sendVstMidiEvent")) | |||||
midiOuts = 1; | |||||
midiTotal = midiIns + midiOuts; | |||||
midiTotal = midiIns + midiOuts; | |||||
// ----------------------------------------------------------------------- | |||||
// start crash-free plugin test | |||||
// ----------------------------------------------------------------------- | |||||
// start crash-free plugin test | |||||
if (init) | |||||
if (init) | |||||
{ | |||||
float** bufferAudioIn = new float* [audioIns]; | |||||
for (int j=0; j < audioIns; j++) | |||||
{ | { | ||||
float** bufferAudioIn = new float* [audioIns]; | |||||
for (int j=0; j < audioIns; j++) | |||||
{ | |||||
bufferAudioIn[j] = new float [bufferSize]; | |||||
memset(bufferAudioIn[j], 0, sizeof(float)*bufferSize); | |||||
} | |||||
bufferAudioIn[j] = new float [bufferSize]; | |||||
memset(bufferAudioIn[j], 0, sizeof(float)*bufferSize); | |||||
} | |||||
float** bufferAudioOut = new float* [audioOuts]; | |||||
for (int j=0; j < audioOuts; j++) | |||||
{ | |||||
bufferAudioOut[j] = new float [bufferSize]; | |||||
memset(bufferAudioOut[j], 0, sizeof(float)*bufferSize); | |||||
} | |||||
float** bufferAudioOut = new float* [audioOuts]; | |||||
for (int j=0; j < audioOuts; j++) | |||||
{ | |||||
bufferAudioOut[j] = new float [bufferSize]; | |||||
memset(bufferAudioOut[j], 0, sizeof(float)*bufferSize); | |||||
} | |||||
struct { | |||||
int32_t numEvents; | |||||
intptr_t reserved; | |||||
VstEvent* data[2]; | |||||
} events; | |||||
VstMidiEvent midiEvents[2]; | |||||
memset(midiEvents, 0, sizeof(VstMidiEvent)*2); | |||||
midiEvents[0].type = kVstMidiType; | |||||
midiEvents[0].byteSize = sizeof(VstMidiEvent); | |||||
midiEvents[0].midiData[0] = 0x90; | |||||
midiEvents[0].midiData[1] = 64; | |||||
midiEvents[0].midiData[2] = 100; | |||||
midiEvents[1].type = kVstMidiType; | |||||
midiEvents[1].byteSize = sizeof(VstMidiEvent); | |||||
midiEvents[1].midiData[0] = 0x80; | |||||
midiEvents[1].midiData[1] = 64; | |||||
midiEvents[1].deltaFrames = bufferSize/2; | |||||
events.numEvents = 2; | |||||
events.reserved = 0; | |||||
events.data[0] = (VstEvent*)&midiEvents[0]; | |||||
events.data[1] = (VstEvent*)&midiEvents[1]; | |||||
struct { | |||||
int32_t numEvents; | |||||
intptr_t reserved; | |||||
VstEvent* data[2]; | |||||
} events; | |||||
VstMidiEvent midiEvents[2]; | |||||
memset(midiEvents, 0, sizeof(VstMidiEvent)*2); | |||||
midiEvents[0].type = kVstMidiType; | |||||
midiEvents[0].byteSize = sizeof(VstMidiEvent); | |||||
midiEvents[0].midiData[0] = 0x90; | |||||
midiEvents[0].midiData[1] = 64; | |||||
midiEvents[0].midiData[2] = 100; | |||||
midiEvents[1].type = kVstMidiType; | |||||
midiEvents[1].byteSize = sizeof(VstMidiEvent); | |||||
midiEvents[1].midiData[0] = 0x80; | |||||
midiEvents[1].midiData[1] = 64; | |||||
midiEvents[1].deltaFrames = bufferSize/2; | |||||
events.numEvents = 2; | |||||
events.reserved = 0; | |||||
events.data[0] = (VstEvent*)&midiEvents[0]; | |||||
events.data[1] = (VstEvent*)&midiEvents[1]; | |||||
#if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, bufferSize, nullptr, sampleRate); | |||||
effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, bufferSize, nullptr, sampleRate); | |||||
#endif | #endif | ||||
effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate); | |||||
effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate); | |||||
effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); | |||||
if (midiIns > 0) | |||||
effect->dispatcher(effect, effProcessEvents, 0, 0, &events, 0.0f); | |||||
if (midiIns > 0) | |||||
effect->dispatcher(effect, effProcessEvents, 0, 0, &events, 0.0f); | |||||
if (effect->flags & effFlagsCanReplacing) | |||||
effect->processReplacing(effect, bufferAudioIn, bufferAudioOut, bufferSize); | |||||
if (effect->processReplacing != effect->process && (effect->flags & effFlagsCanReplacing) > 0) | |||||
effect->processReplacing(effect, bufferAudioIn, bufferAudioOut, bufferSize); | |||||
#if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
else | |||||
effect->process(effect, bufferAudioIn, bufferAudioOut, bufferSize); | |||||
else | |||||
effect->process(effect, bufferAudioIn, bufferAudioOut, bufferSize); | |||||
#endif | #endif | ||||
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f); | |||||
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); | |||||
for (int j=0; j < audioIns; j++) | |||||
delete[] bufferAudioIn[j]; | |||||
for (int j=0; j < audioOuts; j++) | |||||
delete[] bufferAudioOut[j]; | |||||
delete[] bufferAudioIn; | |||||
delete[] bufferAudioOut; | |||||
} | |||||
for (int j=0; j < audioIns; j++) | |||||
delete[] bufferAudioIn[j]; | |||||
for (int j=0; j < audioOuts; j++) | |||||
delete[] bufferAudioOut[j]; | |||||
delete[] bufferAudioIn; | |||||
delete[] bufferAudioOut; | |||||
} | |||||
// end crash-free plugin test | |||||
// ----------------------------------------------------------------------- | |||||
// end crash-free plugin test | |||||
// ----------------------------------------------------------------------- | |||||
DISCOVERY_OUT("init", "-----------"); | |||||
DISCOVERY_OUT("name", cName); | |||||
DISCOVERY_OUT("label", cProduct); | |||||
DISCOVERY_OUT("maker", cVendor); | |||||
DISCOVERY_OUT("copyright", cVendor); | |||||
DISCOVERY_OUT("unique_id", VstCurrentUniqueId); | |||||
DISCOVERY_OUT("hints", hints); | |||||
DISCOVERY_OUT("audio.ins", audioIns); | |||||
DISCOVERY_OUT("audio.outs", audioOuts); | |||||
DISCOVERY_OUT("audio.total", audioTotal); | |||||
DISCOVERY_OUT("midi.ins", midiIns); | |||||
DISCOVERY_OUT("midi.outs", midiOuts); | |||||
DISCOVERY_OUT("midi.total", midiTotal); | |||||
DISCOVERY_OUT("parameters.ins", parametersIns); | |||||
DISCOVERY_OUT("parameters.total", parametersTotal); | |||||
DISCOVERY_OUT("programs.total", programsTotal); | |||||
DISCOVERY_OUT("build", BINARY_NATIVE); | |||||
DISCOVERY_OUT("end", "------------"); | |||||
DISCOVERY_OUT("init", "-----------"); | |||||
DISCOVERY_OUT("name", cName); | |||||
DISCOVERY_OUT("label", cProduct); | |||||
DISCOVERY_OUT("maker", cVendor); | |||||
DISCOVERY_OUT("copyright", cVendor); | |||||
DISCOVERY_OUT("unique_id", VstCurrentUniqueId); | |||||
DISCOVERY_OUT("hints", hints); | |||||
DISCOVERY_OUT("audio.ins", audioIns); | |||||
DISCOVERY_OUT("audio.outs", audioOuts); | |||||
DISCOVERY_OUT("audio.total", audioTotal); | |||||
DISCOVERY_OUT("midi.ins", midiIns); | |||||
DISCOVERY_OUT("midi.outs", midiOuts); | |||||
DISCOVERY_OUT("midi.total", midiTotal); | |||||
DISCOVERY_OUT("parameters.ins", parametersIns); | |||||
DISCOVERY_OUT("parameters.total", parametersTotal); | |||||
DISCOVERY_OUT("programs.total", programsTotal); | |||||
DISCOVERY_OUT("build", BINARY_NATIVE); | |||||
DISCOVERY_OUT("end", "------------"); | |||||
if (VstCategory != kPlugCategShell) | |||||
break; | |||||
if (VstCategory != kPlugCategShell) | |||||
break; | |||||
strBuf[0] = 0; | |||||
VstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f); | |||||
strBuf[0] = 0; | |||||
VstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f); | |||||
if (VstCurrentUniqueId != 0) | |||||
{ | |||||
free((void*)cName); | |||||
cName = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
} | |||||
else | |||||
break; | |||||
if (VstCurrentUniqueId != 0) | |||||
{ | |||||
free((void*)cName); | |||||
cName = strdup((strBuf[0] != 0) ? strBuf : ""); | |||||
} | } | ||||
else | |||||
break; | |||||
} | |||||
// only close if required | |||||
if (init || VstCategory == kPlugCategShell) | |||||
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||||
// only close if required | |||||
if (init || VstCategory == kPlugCategShell) | |||||
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||||
free((void*)cName); | |||||
free((void*)cProduct); | |||||
free((void*)cVendor); | |||||
} | |||||
else | |||||
DISCOVERY_OUT("error", "Failed to init VST plugin"); | |||||
free((void*)cName); | |||||
free((void*)cProduct); | |||||
free((void*)cVendor); | |||||
} | } | ||||
void do_fluidsynth_check(const char* const filename, const bool init) | void do_fluidsynth_check(const char* const filename, const bool init) | ||||
@@ -936,8 +937,9 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
DISCOVERY_OUT("build", BINARY_NATIVE); | DISCOVERY_OUT("build", BINARY_NATIVE); | ||||
DISCOVERY_OUT("end", "------------"); | DISCOVERY_OUT("end", "------------"); | ||||
#else | #else | ||||
(void)filename; | |||||
DISCOVERY_OUT("error", "SF2 support not available"); | DISCOVERY_OUT("error", "SF2 support not available"); | ||||
Q_UNUSED(filename); | |||||
Q_UNUSED(init); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -979,12 +981,11 @@ void do_linuxsampler_check(const char* const filename, const char* const stype, | |||||
return; | return; | ||||
} | } | ||||
try { | |||||
ins = engine->GetInstrumentManager(); | |||||
} | |||||
catch (const Exception& e) | |||||
ins = engine->GetInstrumentManager(); | |||||
if (! ins) | |||||
{ | { | ||||
DISCOVERY_OUT("error", e.what()); | |||||
DISCOVERY_OUT("error", "Failed to get LinuxSampeler instrument manager"); | |||||
return; | return; | ||||
} | } | ||||
@@ -1048,8 +1049,9 @@ void do_linuxsampler_check(const char* const filename, const char* const stype, | |||||
LinuxSamplerScopedEngine::outputInfo(nullptr, 0); | LinuxSamplerScopedEngine::outputInfo(nullptr, 0); | ||||
#else | #else | ||||
(void)filename; | |||||
DISCOVERY_OUT("error", stype << " support not available"); | DISCOVERY_OUT("error", stype << " support not available"); | ||||
Q_UNUSED(filename); | |||||
Q_UNUSED(init); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -106,6 +106,6 @@ const char* bool2str(bool yesno) | |||||
} | } | ||||
static inline | static inline | ||||
void pass(void) {} | |||||
void pass() {} | |||||
#endif // CARLA_INCLUDES_H | #endif // CARLA_INCLUDES_H |
@@ -44,12 +44,10 @@ | |||||
#include "lv2/urid.h" | #include "lv2/urid.h" | ||||
#include "lv2/worker.h" | #include "lv2/worker.h" | ||||
#include "lv2/lv2dynparam.h" | |||||
#include "lv2/lv2-miditype.h" | #include "lv2/lv2-miditype.h" | ||||
#include "lv2/lv2-midifunctions.h" | #include "lv2/lv2-midifunctions.h" | ||||
#include "lv2/lv2_external_ui.h" | #include "lv2/lv2_external_ui.h" | ||||
#include "lv2/lv2_programs.h" | #include "lv2/lv2_programs.h" | ||||
#include "lv2/lv2_rtmempool.h" | |||||
#include "lv2_rdf.h" | #include "lv2_rdf.h" | ||||
@@ -1450,8 +1448,6 @@ bool is_lv2_feature_supported(const LV2_URI uri) | |||||
return true; | return true; | ||||
if (strcmp(uri, LV2_PROGRAMS__Host) == 0) | if (strcmp(uri, LV2_PROGRAMS__Host) == 0) | ||||
return true; | return true; | ||||
if (strcmp(uri, LV2_RTSAFE_MEMORY_POOL_URI) == 0) | |||||
return true; | |||||
if (strcmp(uri, LV2_STATE__makePath) == 0) | if (strcmp(uri, LV2_STATE__makePath) == 0) | ||||
return true; | return true; | ||||
if (strcmp(uri, LV2_STATE__mapPath) == 0) | if (strcmp(uri, LV2_STATE__mapPath) == 0) | ||||
@@ -1,124 +0,0 @@ | |||||
/* -*- Mode: C ; c-basic-offset: 2 -*- */ | |||||
/***************************************************************************** | |||||
* | |||||
* This work is in public domain. | |||||
* | |||||
* This file 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. | |||||
* | |||||
* If you have questions, contact Nedko Arnaudov <nedko@arnaudov.name> or | |||||
* ask in #lad channel, FreeNode IRC network. | |||||
* | |||||
*****************************************************************************/ | |||||
/** | |||||
* @file lv2_rtmempool.h | |||||
* @brief LV2 realtime safe memory pool extension definition | |||||
* | |||||
*/ | |||||
#ifndef LV2_RTMEMPOOL_H__8914012A_720D_4EAC_B0DB_6F93F2B47975__INCLUDED | |||||
#define LV2_RTMEMPOOL_H__8914012A_720D_4EAC_B0DB_6F93F2B47975__INCLUDED | |||||
#define LV2_RTSAFE_MEMORY_POOL_URI "http://home.gna.org/lv2dynparam/rtmempool/v1" | |||||
#ifdef __cplusplus | |||||
extern "C" { | |||||
#endif | |||||
#if 0 | |||||
} /* Adjust editor indent */ | |||||
#endif | |||||
/** opaque handle to memory pool */ | |||||
typedef struct { /** fake */ int unused; } * lv2_rtsafe_memory_pool_handle; | |||||
/** max size of memory pool name, in chars, including terminating zero char */ | |||||
#define LV2_RTSAFE_MEMORY_POOL_NAME_MAX 128 | |||||
/** structure, pointer to which is to be supplied as @c data member of ::LV2_Feature */ | |||||
typedef struct | |||||
{ | |||||
/** | |||||
* This function is called when plugin wants to create memory pool | |||||
* | |||||
* <b>may/will sleep</b> | |||||
* | |||||
* @param pool_name pool name, for debug purposes, max RTSAFE_MEMORY_POOL_NAME_MAX chars, including terminating zero char. May be NULL. | |||||
* @param data_size memory chunk size | |||||
* @param min_preallocated min chunks preallocated | |||||
* @param max_preallocated chunks preallocated | |||||
* @param pool_ptr pointer to variable receiving handle to newly created pool object | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error | |||||
*/ | |||||
unsigned char | |||||
(*create)( | |||||
const char * pool_name, | |||||
size_t data_size, /* chunk size */ | |||||
size_t min_preallocated, /* min chunks preallocated */ | |||||
size_t max_preallocated, /* max chunks preallocated */ | |||||
lv2_rtsafe_memory_pool_handle * pool_ptr); | |||||
/** | |||||
* This function is called when plugin wants to destroy previously created memory pool | |||||
* | |||||
* <b>may/will sleep</b> | |||||
* | |||||
* @param pool handle to pool object | |||||
*/ | |||||
void | |||||
(*destroy)( | |||||
lv2_rtsafe_memory_pool_handle pool); | |||||
/** | |||||
* This function is called when plugin wants to allocate memory in context where sleeping is not allowed | |||||
* | |||||
* <b>will not sleep</b> | |||||
* | |||||
* @param pool handle to pool object | |||||
* | |||||
* @return Pointer to allocated memory or NULL if memory no memory is available | |||||
*/ | |||||
void * | |||||
(*allocate_atomic)( | |||||
lv2_rtsafe_memory_pool_handle pool); | |||||
/** | |||||
* This function is called when plugin wants to allocate memory in context where sleeping is allowed | |||||
* | |||||
* <b>may/will sleep</b> | |||||
* | |||||
* @param pool handle to pool object | |||||
* | |||||
* @return Pointer to allocated memory or NULL if memory no memory is available (should not happen under normal conditions) | |||||
*/ | |||||
void * | |||||
(*allocate_sleepy)( | |||||
lv2_rtsafe_memory_pool_handle pool); | |||||
/** | |||||
* This function is called when plugin wants to deallocate previously allocated memory | |||||
* | |||||
* <b>will not sleep</b> | |||||
* | |||||
* @param pool handle to pool object | |||||
* @param memory_ptr pointer to previously allocated memory chunk | |||||
*/ | |||||
/* will not sleep */ | |||||
void | |||||
(*deallocate)( | |||||
lv2_rtsafe_memory_pool_handle pool, | |||||
void * memory_ptr); | |||||
} lv2_rtsafe_memory_pool_provider; | |||||
#if 0 | |||||
{ /* Adjust editor indent */ | |||||
#endif | |||||
#ifdef __cplusplus | |||||
} /* extern "C" */ | |||||
#endif | |||||
#endif /* #ifndef LV2_RTMEMPOOL_H__8914012A_720D_4EAC_B0DB_6F93F2B47975__INCLUDED */ |
@@ -1,469 +0,0 @@ | |||||
/* -*- Mode: C ; c-basic-offset: 2 -*- */ | |||||
/***************************************************************************** | |||||
* | |||||
* This work is in public domain. | |||||
* | |||||
* This file 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. | |||||
* | |||||
* If you have questions, contact Nedko Arnaudov <nedko@arnaudov.name> or | |||||
* ask in #lad channel, FreeNode IRC network. | |||||
* | |||||
*****************************************************************************/ | |||||
/** | |||||
* @file lv2dynparam.h | |||||
* @brief LV2 dynparam extension definition | |||||
* | |||||
* @par Purpose | |||||
* | |||||
* The purpose of this extension is to allow plugin parameters appear | |||||
* and disappear as response of existing parameter changes (i.e. number | |||||
* of voices) or executing commands (i.e. "add new voice"). It also | |||||
* allows grouping of parameters and groups. Groups can be used for | |||||
* things like ADSR abstraction, i.e. group of 4 float parameters. | |||||
* | |||||
* @par Architectural overview | |||||
* | |||||
* Plugin notifies host for changes through callbacks. During | |||||
* initialization, plugin notifies host about initial groups, | |||||
* parameters and commands through same callbacks used for later | |||||
* notification. There are callbacks to notify host for group, | |||||
* parameter and command disappears. | |||||
* | |||||
* Groups are containers of other groups, parameters and | |||||
* commands. Parameters and groups have URIs. Parameter URIs are | |||||
* used to describe type of parameter (i.e. boolean, integer, | |||||
* string, etc.). Parameters are as simple as possible. There is one | |||||
* predefined Group URI for "generic group" type, i.e. container | |||||
* that is just that - a container of other groups, parameters and | |||||
* commands. Other group types are just hints and ones that are | |||||
* unknown to host, can be looked as generic ones. Only generic | |||||
* groups can contain groups. Groups of other types can contain only | |||||
* parameters. There is always one, root group. Name of the root | |||||
* groop is expected to match name of the plugin. | |||||
* | |||||
* Groups, parameters and commands, have "name" containing short | |||||
* human readble description of object purpose. | |||||
* | |||||
* Parameter ports, are bidirectional. Parameters have values, and | |||||
* some of them (depending of type) - range. Data storage for | |||||
* current, min and max values is in plugin memory. Host gets | |||||
* pointers to that memory and accesses the data in type specific | |||||
* way. | |||||
* | |||||
* When plugin decides to change parameter value or range (as | |||||
* response to command execution or other parameter value change), it | |||||
* notifies host through callback. | |||||
* | |||||
* When host decides to change parameter value or execute command (as | |||||
* resoponse to user action, i.e. knob rotation/button press, or some | |||||
* kind of automation), it calls plugin callback. In case of | |||||
* parameter, it first changes the value in the plugin data storage | |||||
* for particular parameter. Host ensures that values being set are | |||||
* within current range (if range is defined for particular port | |||||
* type). | |||||
* | |||||
* Apart from initialization (host_attach), plugin may call host | |||||
* callbacks only as response to command execution or parameter | |||||
* change notification (from host). | |||||
* | |||||
* Host serializes calls to plugin dynparam callbacks and the | |||||
* run/connect_port lv2 callbacks. Thus plugin does not need to take | |||||
* special measures for thread safety. in callbacks called by host. | |||||
* | |||||
* Plugin can assume that host will never call dynamic parameter | |||||
* functions when lv2 plugin callbacks (like run and connect_port) are | |||||
* being called. I.e. calls are serialized, no need for locks in | |||||
* plugin. Plugin must not suspend execution (sleep/lock) while being | |||||
* called by host. If it needs to sleep to implement action requested | |||||
* by host, like allocation of data for new voice, the allocation | |||||
* should be done in background thread and when ready, transfered to | |||||
* the realtime code. During initialization (host_attach) plugin is | |||||
* allowed to sleep. Thus conventional memory allocation is allowed | |||||
* in host_attach. | |||||
* | |||||
* @par Intialization sequence | |||||
* | |||||
* -# Host discovers whether plugin supports the extension by | |||||
* inspecting the RDF Turtle file. | |||||
* -# Host calls lv2 extension_data callback, plugin returns pointer | |||||
* to struct lv2dynparam_plugin_callbacks containing pointers to | |||||
* several funtions, including host_attach. | |||||
* -# For each instantiated plugin supporting this extension, host | |||||
* calls host_attach function with parameters: | |||||
* - a LV2_Handle, plugin instance handle | |||||
* - pointer to struct lv2dynparam_host_callbacks, containing | |||||
* pointers to several functions, to be called by plugin. | |||||
* - instance host context, opaque pointer | |||||
* -# During initialization (host_attach), initial groups and | |||||
* parameters appear and host callbacks are called by plugin. | |||||
* | |||||
* @par Parameter types | |||||
* - float, with range | |||||
* - 32-bit 2's complement signed int, with range | |||||
* - midi note, value stored as byte, with range | |||||
* - string | |||||
* - filename | |||||
* - boolean, value stored as byte, non-zero means TRUE, zero means FALSE | |||||
* | |||||
* @par Notes: | |||||
* - if function fails, variables where output parameters are normally | |||||
* stored remain unmodified. | |||||
* - If host callback, called by plugin, fails - plugin should try the | |||||
* operation later. | |||||
*/ | |||||
#ifndef LV2DYNPARAM_H__31DEB371_3874_44A0_A9F2_AAFB0360D8C5__INCLUDED | |||||
#define LV2DYNPARAM_H__31DEB371_3874_44A0_A9F2_AAFB0360D8C5__INCLUDED | |||||
#ifdef __cplusplus | |||||
extern "C" { | |||||
#endif | |||||
#if 0 | |||||
} /* Adjust editor indent */ | |||||
#endif | |||||
/** base URI to be used for composing real URIs (internal use only) */ | |||||
#define LV2DYNPARAM_BASE_URI "http://home.gna.org/lv2dynparam/v1" | |||||
/** URI of the LV2 extension defined in this file */ | |||||
#define LV2DYNPARAM_URI LV2DYNPARAM_BASE_URI | |||||
/** max size of name and type_uri buffers, including terminating zero char */ | |||||
#define LV2DYNPARAM_MAX_STRING_SIZE 1024 | |||||
/** handle identifying parameter, supplied by plugin */ | |||||
typedef void * lv2dynparam_parameter_handle; | |||||
/** handle identifying group, supplied by plugin */ | |||||
typedef void * lv2dynparam_group_handle; | |||||
/** handle identifying command, supplied by plugin */ | |||||
typedef void * lv2dynparam_command_handle; | |||||
/** | |||||
* Structure containing set of hints. | |||||
*/ | |||||
struct lv2dynparam_hints | |||||
{ | |||||
unsigned char count; /**< Number of hints in the set. Size of @c names and @c values arrays. */ | |||||
char ** names; /**< Hint names. Array of hint names with size @c count. */ | |||||
char ** values; /**< Hint values. Array of hint values with size @c count. Element can be NULL if hint has no value. */ | |||||
}; | |||||
/** | |||||
* Structure containing poitners to functions called by | |||||
* plugin and implemented by host. | |||||
*/ | |||||
struct lv2dynparam_host_callbacks | |||||
{ | |||||
/** | |||||
* This function is called by plugin to notify host about new | |||||
* group. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param parent_group_host_context Host context of parent | |||||
* group. For the root group, parent context is NULL. | |||||
* @param group Plugin context for the group | |||||
* @param hints_ptr Pointer to structure representing hints set | |||||
* associated with appearing group. | |||||
* @param group_host_context Pointer to variable where host context | |||||
* for the new group will be stored. | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*group_appear)( | |||||
void * instance_host_context, | |||||
void * parent_group_host_context, | |||||
lv2dynparam_group_handle group, | |||||
const struct lv2dynparam_hints * hints_ptr, | |||||
void ** group_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about group | |||||
* removal. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param group_host_context Host context of the group | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*group_disappear)( | |||||
void * instance_host_context, | |||||
void * group_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about new | |||||
* parameter. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param group_host_context Host context of parent group. | |||||
* @param parameter Plugin context for the parameter | |||||
* @param hints_ptr Pointer to structure representing hints set | |||||
* associated with appearing parameter. | |||||
* @param parameter_host_context Pointer to variable where host | |||||
* context for the new parameter will be stored. | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*parameter_appear)( | |||||
void * instance_host_context, | |||||
void * group_host_context, | |||||
lv2dynparam_parameter_handle parameter, | |||||
const struct lv2dynparam_hints * hints_ptr, | |||||
void ** parameter_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about parameter | |||||
* removal. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param parameter_host_context Host context of the parameter | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*parameter_disappear)( | |||||
void * instance_host_context, | |||||
void * parameter_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about parameter | |||||
* value or range change. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param parameter_host_context Host context of the parameter | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*parameter_change)( | |||||
void * instance_host_context, | |||||
void * parameter_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about new commmand. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param group_host_context Host context of parent group. | |||||
* @param command Plugin context for the command | |||||
* @param hints_ptr Pointer to structure representing hints set | |||||
* associated with appearing command. | |||||
* @param command_host_context Pointer to variable where host | |||||
* context for the new command will be stored. | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*command_appear)( | |||||
void * instance_host_context, | |||||
void * group_host_context, | |||||
lv2dynparam_command_handle command, | |||||
const struct lv2dynparam_hints * hints_ptr, | |||||
void ** command_host_context); | |||||
/** | |||||
* This function is called by plugin to notify host about command | |||||
* removal. | |||||
* | |||||
* @param instance_host_context Host instance context, as supplied | |||||
* during initialization (host_attach). | |||||
* @param command_host_context Host context of the command | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*command_disappear)( | |||||
void * instance_host_context, | |||||
void * command_host_context); | |||||
}; | |||||
/** | |||||
* Structure containing poitners to functions called by | |||||
* host and implemented by plugin. | |||||
* Pointer to this struct is returned by LV2 extension_data plugin callback | |||||
*/ | |||||
struct lv2dynparam_plugin_callbacks | |||||
{ | |||||
/** | |||||
* This callback is called by host during initialization. | |||||
* Plugin is allowed to suspend execution (sleep/lock). | |||||
* Thus conventional memory allocation is allowed. | |||||
* | |||||
* @param instance Handle of instantiated LV2 plugin | |||||
* @param host_callbacks Pointer to struncture containing pointer to | |||||
* functions implemented by host, to be called by plugin. | |||||
* @param instance_host_context Context to be supplied as parameter | |||||
* to callbacks implemented by host and called by plugin. | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error | |||||
*/ | |||||
unsigned char (*host_attach)( | |||||
LV2_Handle instance, | |||||
struct lv2dynparam_host_callbacks * host_callbacks, | |||||
void * instance_host_context); | |||||
/** | |||||
* This function is called by host to retrieve name of group | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param group Group handle, as supplied by plugin | |||||
* @param buffer Pointer to buffer with size of | |||||
* LV2DYNPARAM_MAX_STRING_SIZE bytes, where ASCIIZ string containing | |||||
* name of the group will be stored. | |||||
*/ | |||||
void (*group_get_name)( | |||||
lv2dynparam_group_handle group, | |||||
char * buffer); | |||||
/** | |||||
* This function is called by host to retrieve type URI of parameter | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param parameter Parameter handle, as supplied by plugin | |||||
* @param buffer Pointer to buffer with size of | |||||
* LV2DYNPARAM_MAX_STRING_SIZE bytes, where ASCIIZ string containing | |||||
* type URI of the parameter will be stored. | |||||
*/ | |||||
void (*parameter_get_type_uri)( | |||||
lv2dynparam_parameter_handle parameter, | |||||
char * buffer); | |||||
/** | |||||
* This function is called by host to retrieve name of parameter | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param parameter Parameter handle, as supplied by plugin | |||||
* @param buffer Pointer to buffer with size of | |||||
* LV2DYNPARAM_MAX_STRING_SIZE bytes, where ASCIIZ string containing | |||||
* name of the parameter will be stored. | |||||
*/ | |||||
void (*parameter_get_name)( | |||||
lv2dynparam_parameter_handle parameter, | |||||
char * buffer); | |||||
/** | |||||
* This funtion is called by host to retrieve pointer to memory | |||||
* where value data for particular parameter is stored. | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param parameter Parameter handle, as supplied by plugin | |||||
* @param value_buffer Pointer to variable where pointer to value | |||||
* data will be stored. | |||||
*/ | |||||
void (*parameter_get_value)( | |||||
lv2dynparam_parameter_handle parameter, | |||||
void ** value_buffer); | |||||
/** | |||||
* This funtion is called by host to retrieve pointer to memory | |||||
* where range min and max values data for particular parameter are | |||||
* stored. Host calls this function only for parameter with types | |||||
* that have range. | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param parameter Parameter handle, as supplied by plugin | |||||
* @param value_min_buffer Pointer to variable where pointer to min | |||||
* value data will be stored. | |||||
* @param value_max_buffer Pointer to variable where pointer to max | |||||
* value data will be stored. | |||||
*/ | |||||
void (*parameter_get_range)( | |||||
lv2dynparam_parameter_handle parameter, | |||||
void ** value_min_buffer, | |||||
void ** value_max_buffer); | |||||
/** | |||||
* This function is called by host to notify plugin about value | |||||
* change. For parameters with types that have range, value is | |||||
* guaranteed to be with the range. Before calling this function, | |||||
* host updates value data storage with the new value. | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param parameter Parameter handle, as supplied by plugin | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*parameter_change)( | |||||
lv2dynparam_parameter_handle parameter); | |||||
/** | |||||
* This function is called by host to retrieve name of command | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param command Command handle, as supplied by plugin | |||||
* @param buffer Pointer to buffer with size of | |||||
* LV2DYNPARAM_MAX_STRING_SIZE bytes, where ASCIIZ string containing | |||||
* name of the command will be stored. | |||||
*/ | |||||
void (*command_get_name)( | |||||
lv2dynparam_command_handle command, | |||||
char * buffer); | |||||
/** | |||||
* This function is called by host to execute command defined by | |||||
* plugin. | |||||
* Plugin implementation must not suspend execution (sleep/lock). | |||||
* | |||||
* @param command Command handle, as supplied by plugin | |||||
* | |||||
* @return Success status | |||||
* @retval Non-zero - success | |||||
* @retval Zero - error, try later | |||||
*/ | |||||
unsigned char (*command_execute)( | |||||
lv2dynparam_command_handle command); | |||||
}; | |||||
/** URI for float parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_FLOAT_URI LV2DYNPARAM_BASE_URI "#parameter_float" | |||||
/** URI for integer parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_INT_URI LV2DYNPARAM_BASE_URI "#parameter_int" | |||||
/** URI for note parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_NOTE_URI LV2DYNPARAM_BASE_URI "#parameter_note" | |||||
/** URI for string parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_STRING_URI LV2DYNPARAM_BASE_URI "#parameter_string" | |||||
/** URI for filename parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_FILENAME_URI LV2DYNPARAM_BASE_URI "#parameter_filename" | |||||
/** URI for boolean parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_BOOLEAN_URI LV2DYNPARAM_BASE_URI "#parameter_boolean" | |||||
/** URI for enumeration parameter */ | |||||
#define LV2DYNPARAM_PARAMETER_TYPE_ENUM_URI LV2DYNPARAM_BASE_URI "#parameter_enum" | |||||
#if 0 | |||||
{ /* Adjust editor indent */ | |||||
#endif | |||||
#ifdef __cplusplus | |||||
} /* extern "C" */ | |||||
#endif | |||||
#endif /* #ifndef LV2DYNPARAM_H__31DEB371_3874_44A0_A9F2_AAFB0360D8C5__INCLUDED */ |
@@ -12,7 +12,7 @@ SORD_VERSION = 0.8.0 | |||||
SRATOM_VERSION = 0.2.0 | SRATOM_VERSION = 0.2.0 | ||||
LILV_VERSION = 0.14.2 | LILV_VERSION = 0.14.2 | ||||
BUILD_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fvisibility=hidden -fPIC -mtune=generic -msse -std=c99 -Wall $(CFLAGS) | |||||
BUILD_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fvisibility=hidden -fPIC -mtune=generic -msse -mfpmath=sse -std=c99 -Wall $(CFLAGS) | |||||
BUILD_FLAGS += -Iconfig -I../carla-includes | BUILD_FLAGS += -Iconfig -I../carla-includes | ||||
32BIT_FLAGS = -m32 | 32BIT_FLAGS = -m32 | ||||