diff options
author | David Robillard <d@drobilla.net> | 2011-03-11 07:07:08 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-03-11 07:07:08 +0000 |
commit | adc47674662935851f3821ae175c1fe742f4107c (patch) | |
tree | e94ccb242399c41b1549c6a93372a9e04fdb9a38 /lvz | |
parent | d810e069029ea3aa52c5d3fed02dc607f4e6b743 (diff) | |
download | mda.lv2-adc47674662935851f3821ae175c1fe742f4107c.tar.gz mda.lv2-adc47674662935851f3821ae175c1fe742f4107c.tar.bz2 mda.lv2-adc47674662935851f3821ae175c1fe742f4107c.zip |
Remove GUI stuff.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/mdala.lv2@3074 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'lvz')
-rw-r--r-- | lvz/AEffEditor.hpp | 32 | ||||
-rw-r--r-- | lvz/AEffect.h | 24 | ||||
-rw-r--r-- | lvz/audioeffectx.h | 8 | ||||
-rw-r--r-- | lvz/gui_wrapper.cpp | 198 |
4 files changed, 25 insertions, 237 deletions
diff --git a/lvz/AEffEditor.hpp b/lvz/AEffEditor.hpp deleted file mode 100644 index d118a9a..0000000 --- a/lvz/AEffEditor.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __LVZ_AUDIOEFFECT_HPP -#define __LVZ_AUDIOEFFECT_HPP - -class AudioEffect; - -class AEffEditor { -public: - AEffEditor (AudioEffect* eff) - : effect(eff) - , URI("NULL") - , pluginURI("NULL") - {} - - virtual long open(void* ptr) { return true; } - virtual void close() {} - - virtual void idle() {} - virtual void postUpdate() {} - - virtual const char* getURI() { return URI; } - virtual void setURI(const char* u) { URI = u; } - - virtual const char* getPluginURI() { return pluginURI; } - virtual void setPluginURI(const char* u) { pluginURI = u; } - -protected: - AudioEffect* effect; - const char* URI; - const char* pluginURI; -}; - -#endif // __LVZ_AUDIOEFFECT_HPP diff --git a/lvz/AEffect.h b/lvz/AEffect.h index 8d46cde..f547083 100644 --- a/lvz/AEffect.h +++ b/lvz/AEffect.h @@ -1,5 +1,23 @@ -#ifndef __LVZ_AEFFECT_H -#define __LVZ_AEFFECT_H +/* LVZ - A C++ interface for writing LV2 plugins. + * Copyright 2008-2011 David Robillard <http://drobilla.net> + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This library 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 LVZ_AEFFECT_H +#define LVZ_AEFFECT_H class AudioEffect; @@ -11,4 +29,4 @@ struct AEffect { int flags; }; -#endif // __LVZ_AFFECT_H +#endif // LVZ_AFFECT_H diff --git a/lvz/audioeffectx.h b/lvz/audioeffectx.h index 28058bf..607bd33 100644 --- a/lvz/audioeffectx.h +++ b/lvz/audioeffectx.h @@ -1,5 +1,5 @@ /* LVZ - A C++ interface for writing LV2 plugins. - * Copyright (C) 2008-2009 David Robillard <http://drobilla.net> + * Copyright 2008-2011 David Robillard <http://drobilla.net> * * This library 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 @@ -16,8 +16,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __LVZ_AUDIOEFFECTX_H -#define __LVZ_AUDIOEFFECTX_H +#ifndef LVZ_AUDIOEFFECTX_H +#define LVZ_AUDIOEFFECTX_H #include <stdint.h> #include <string.h> @@ -163,5 +163,5 @@ protected: AEffect cEffect; }; -#endif // __LVZ_AUDIOEFFECTX_H +#endif // LVZ_AUDIOEFFECTX_H diff --git a/lvz/gui_wrapper.cpp b/lvz/gui_wrapper.cpp deleted file mode 100644 index 9d3a627..0000000 --- a/lvz/gui_wrapper.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* LVZ - A C++ interface for writing LV2 plugins. - * Copyright (C) 2008-2009 David Robillard <http://drobilla.net> - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library 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 UI_CLASS -#error "This file requires UI_CLASS to be defined" -#endif -#ifndef URI_PREFIX -#error "This file requires URI_PREFIX to be defined" -#endif -#ifndef UI_URI_SUFFIX -#error "This file requires UI_URI_SUFFIX to be defined" -#endif - -#include <stdlib.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <cassert> -#include "AEffEditor.hpp" -#include "lv2_ui.h" -#include UI_HEADER -#include PLUGIN_HEADER - -extern "C" { - -/* UI */ - -typedef struct { - bool stolen; - UI_CLASS* ui; - GtkSocket* socket; - Window x_window; - AudioEffectX* effect; -} MDAPluginUI; - - -static gboolean -mda_ui_idle(void* data) -{ - MDAPluginUI* ui = (MDAPluginUI*)data; - if (!ui->stolen) { - //gtk_socket_add_id(GTK_SOCKET(ui->socket), ui->x_window); - ui->x_window = (Window)gtk_socket_get_id(GTK_SOCKET(ui->socket)); - bool success = ui->ui->open((void*)ui->x_window); - if (!success) - fprintf(stderr, "FAILED TO OPEN GUI\n"); - ui->ui->getFrame()->draw(); - ui->stolen = true; - } - - ui->ui->idle(); - return true; -} - - -static LV2UI_Handle -mda_ui_instantiate(const struct _LV2UI_Descriptor* descriptor, - const char* plugin_uri, - const char* bundle_path, - LV2UI_Write_Function write_function, - LV2UI_Controller controller, - LV2UI_Widget* widget, - const LV2_Feature* const* features) -{ - VSTGUI::setBundlePath(bundle_path); - - MDAPluginUI* ui = (MDAPluginUI*)malloc(sizeof(MDAPluginUI)); - ui->effect = NULL; - - typedef struct { const void* (*extension_data)(const char* uri); } LV2_DataAccess; - - typedef const void* (*extension_data_func)(const char* uri); - typedef const AudioEffectX* (*get_effect_func)(LV2_Handle instance); - - LV2_Handle instance = NULL; - get_effect_func get_effect = NULL; - - - if (features != NULL) { - const LV2_Feature* feature = features[0]; - for (size_t i = 0; (feature = features[i]) != NULL; ++i) { - if (!strcmp(feature->URI, "http://lv2plug.in/ns/ext/instance-access")) { - instance = (LV2_Handle)feature->data; - } else if (!strcmp(feature->URI, "http://lv2plug.in/ns/ext/data-access")) { - LV2_DataAccess* ext_data = (LV2_DataAccess*)feature->data; - extension_data_func func = (extension_data_func)feature->data; - get_effect = (get_effect_func)ext_data->extension_data( - "http://drobilla.net/ns/ext/vstgui"); - } - } - } - - if (instance && get_effect) { - ui->effect = (AudioEffectX*)get_effect(instance); - } else { - fprintf(stderr, "Host does not support required features, aborting.\n"); - return NULL; - } - - ui->ui = new UI_CLASS(ui->effect); - ui->stolen = false; - - ui->socket = GTK_SOCKET(gtk_socket_new()); - gtk_widget_show_all(GTK_WIDGET(ui->socket)); - - *widget = ui->socket; - g_timeout_add(30, mda_ui_idle, ui); - - return ui; -} - - -static void -mda_ui_cleanup(LV2UI_Handle instance) -{ - g_idle_remove_by_data(instance); -} - - -static void -mda_ui_port_event(LV2UI_Handle ui, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void* buffer) -{ - // VST UIs seem to not use this at all, it's all polling - // The shit the proprietary people come up (and get away) with... -} - - -static const void* -mda_ui_extension_data(const char* uri) -{ - return NULL; -} - - -/* Library */ - -static LV2UI_Descriptor *mda_ui_descriptor = NULL; - -static void -init_ui_descriptor() -{ - mda_ui_descriptor = (LV2UI_Descriptor*)malloc(sizeof(LV2UI_Descriptor)); - - mda_ui_descriptor->URI = URI_PREFIX UI_URI_SUFFIX; - mda_ui_descriptor->instantiate = mda_ui_instantiate; - mda_ui_descriptor->cleanup = mda_ui_cleanup; - mda_ui_descriptor->port_event = mda_ui_port_event; - mda_ui_descriptor->extension_data = mda_ui_extension_data; -} - - -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor* -lv2ui_descriptor(uint32_t index) -{ - if (!mda_ui_descriptor) - init_ui_descriptor(); - - switch (index) { - case 0: - return mda_ui_descriptor; - default: - return NULL; - } -} - - -LV2_SYMBOL_EXPORT -AEffEditor* -lvz_new_aeffeditor(AudioEffect* effect) -{ - UI_CLASS* ui = new UI_CLASS(effect); - ui->setURI(URI_PREFIX UI_URI_SUFFIX); - ui->setPluginURI(URI_PREFIX PLUGIN_URI_SUFFIX); - return ui; -} - - -} // extern "C" - |