diff options
Diffstat (limited to 'lvz')
-rw-r--r-- | lvz/AEffEditor.hpp | 4 | ||||
-rw-r--r-- | lvz/audioeffectx.h | 10 | ||||
-rw-r--r-- | lvz/gendata.cpp | 42 | ||||
-rw-r--r-- | lvz/gui_wrapper.cpp | 12 | ||||
-rw-r--r-- | lvz/wrapper.cpp | 20 |
5 files changed, 44 insertions, 44 deletions
diff --git a/lvz/AEffEditor.hpp b/lvz/AEffEditor.hpp index f8da52a..d118a9a 100644 --- a/lvz/AEffEditor.hpp +++ b/lvz/AEffEditor.hpp @@ -16,10 +16,10 @@ public: 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; } diff --git a/lvz/audioeffectx.h b/lvz/audioeffectx.h index f278d63..e2ddb49 100644 --- a/lvz/audioeffectx.h +++ b/lvz/audioeffectx.h @@ -1,6 +1,6 @@ /* LVZ - A C++ interface for writing LV2 plugins. * Copyright (C) 2008 Dave 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) @@ -36,7 +36,7 @@ typedef int16_t LvzInt16; typedef int32_t LvzInt32; typedef int (*audioMasterCallback)(int, int ver, int, int, int, int); - + class AEffEditor; struct VstFileSelect { @@ -87,7 +87,7 @@ class AudioEffect { public: AudioEffect() : editor(NULL) {} virtual ~AudioEffect() {} - + virtual void setParameter(LvzInt32 index, float value) = 0; virtual void setParameterAutomated(LvzInt32 index, float value) {} virtual float getParameter(LvzInt32 index) = 0; @@ -113,14 +113,14 @@ public: { cEffect.flags = 0; } - + virtual void process (float **inputs, float **outputs, LvzInt32 nframes) = 0; virtual void processReplacing(float **inputs, float **outputs, LvzInt32 nframes) = 0; virtual const char* getURI() { return URI; } virtual const char* getUniqueID() { return uniqueID; } virtual float getSampleRate() { return sampleRate; } - virtual LvzInt32 getNumInputs() { return numInputs; } + virtual LvzInt32 getNumInputs() { return numInputs; } virtual LvzInt32 getNumOutputs() { return numOutputs; } virtual LvzInt32 getNumParameters() { return numParams; } diff --git a/lvz/gendata.cpp b/lvz/gendata.cpp index bf9c9ab..90709e8 100644 --- a/lvz/gendata.cpp +++ b/lvz/gendata.cpp @@ -1,6 +1,6 @@ /* LVZ - A C++ interface for writing LV2 plugins. * Copyright (C) 2008 Dave 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) @@ -47,19 +47,19 @@ Manifest manifest; typedef std::map<string, Record> GUIManifest; GUIManifest gui_manifest; - + string symbolify(const char* name) { string str(name); - + // Like This -> Like_This for (size_t i=0; i < str.length(); ++i) if (str[i] == ' ') str[i] = '_'; str[0] = std::tolower(str[0]); - + // LikeThis -> like_this for (size_t i=1; i < str.length(); ++i) if (str[i] >= 'A' && str[i] <= 'Z' @@ -69,7 +69,7 @@ symbolify(const char* name) && (!(str[i-1] == 'F' && str[i] == 'X')) && (!(str[i-1] == 'D' && str[i] == 'C'))) str = str.substr(0, i) + '_' + str.substr(i); - + // To lowercase, and skip invalids for (size_t i=1; i < str.length(); ) { if (std::isalpha(str[i]) || std::isdigit(str[i])) { @@ -82,7 +82,7 @@ symbolify(const char* name) str = str.substr(0, i) + str.substr(i+1); } } - + return str; } @@ -92,10 +92,10 @@ write_plugin(AudioEffectX* effect, const string& lib_file_name) { const string base_name = lib_file_name.substr(0, lib_file_name.find_last_of(".")); const string data_file_name = base_name + ".ttl"; - + fstream os(data_file_name.c_str(), ios::out); effect->getProductString(name_buf); - + os << "@prefix : <http://lv2plug.in/ns/lv2core#> ." << endl; os << "@prefix doap: <http://usefulinc.com/ns/doap#> ." << endl << endl; os << "<" << effect->getURI() << ">" << endl; @@ -108,12 +108,12 @@ write_plugin(AudioEffectX* effect, const string& lib_file_name) uint32_t num_audio_ins = effect->getNumInputs(); uint32_t num_audio_outs = effect->getNumOutputs(); uint32_t num_ports = num_params + num_audio_ins + num_audio_outs; - + if (num_ports > 0) os << " ;" << endl << "\t:port [" << endl; else os << " ." << endl; - + uint32_t idx = 0; for (uint32_t i = idx; i < num_params; ++i, ++idx) { @@ -135,7 +135,7 @@ write_plugin(AudioEffectX* effect, const string& lib_file_name) os << "\t\t:name \"Input " << i+1 << "\" ;" << endl; os << ((idx == num_ports - 1) ? "\t] ." : "\t] , [") << endl; } - + for (uint32_t i = 0; i < num_audio_outs; ++i, ++idx) { os << "\t\ta :OutputPort, :AudioPort ;" << endl; os << "\t\t:index " << idx << " ;" << endl; @@ -154,7 +154,7 @@ write_plugin(AudioEffectX* effect, const string& lib_file_name) } } - + void write_gui(AEffEditor* gui, const string& lib_file_name) { @@ -191,7 +191,7 @@ write_manifest(ostream& os) os << ";" << endl << "\tuiext:ui <" << *j << "> "; os << "." << endl << endl; } - + for (GUIManifest::iterator i = gui_manifest.begin(); i != gui_manifest.end(); ++i) { Record& r = i->second; os << "<" << i->first << "> a uiext:GtkUI ;" << endl; @@ -212,15 +212,15 @@ main(int argc, char** argv) cout << "A manifest of the plugins found is written to stdout" << endl; return 1; } - + typedef AudioEffectX* (*new_effect_func)(); typedef AEffEditor* (*new_gui_func)(); typedef AudioEffectX* (*plugin_uri_func)(); new_effect_func constructor = NULL; new_gui_func gui_constructor = NULL; - AudioEffectX* effect = NULL; - AEffEditor* gui = NULL; + AudioEffectX* effect = NULL; + AEffEditor* gui = NULL; for (int i = 1; i < argc; ++i) { void* handle = dlopen(argv[i], RTLD_LAZY); @@ -233,28 +233,28 @@ main(int argc, char** argv) size_t last_slash = lib_path.find_last_of("/"); if (last_slash != string::npos) lib_path = lib_path.substr(last_slash + 1); - + constructor = (new_effect_func)dlsym(handle, "lvz_new_audioeffectx"); if (constructor != NULL) { effect = constructor(); write_plugin(effect, lib_path); } - + gui_constructor = (new_gui_func)dlsym(handle, "lvz_new_aeffeditor"); if (gui_constructor != NULL) { gui = gui_constructor(); write_gui(gui, lib_path); } - + if (constructor == NULL && gui_constructor == NULL) { cerr << "ERROR: " << argv[i] << ": not an LVZ plugin library, ignoring" << endl; } - + dlclose(handle); } write_manifest(cout); - + return 0; } diff --git a/lvz/gui_wrapper.cpp b/lvz/gui_wrapper.cpp index 96d4f28..1ad8f0c 100644 --- a/lvz/gui_wrapper.cpp +++ b/lvz/gui_wrapper.cpp @@ -1,6 +1,6 @@ /* LVZ - A C++ interface for writing LV2 plugins. * Copyright (C) 2008 Dave 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) @@ -82,10 +82,10 @@ mda_ui_instantiate(const struct _LV2UI_Descriptor* descriptor, 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; @@ -116,10 +116,10 @@ mda_ui_instantiate(const struct _LV2UI_Descriptor* descriptor, 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; } @@ -141,7 +141,7 @@ mda_ui_port_event(LV2UI_Handle ui, // 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) diff --git a/lvz/wrapper.cpp b/lvz/wrapper.cpp index 5a2d8fe..d6c2242 100644 --- a/lvz/wrapper.cpp +++ b/lvz/wrapper.cpp @@ -1,6 +1,6 @@ /* LVZ - A C++ interface for writing LV2 plugins. * Copyright (C) 2008 Dave 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) @@ -58,7 +58,7 @@ mda_connect_port(LV2_Handle instance, uint32_t port, void* data) uint32_t num_params = plugin->effect->getNumParameters(); uint32_t num_inputs = plugin->effect->getNumInputs(); - + if (port < num_params) { plugin->control_buffers[port] = (float*)data; if (data != NULL) @@ -87,14 +87,14 @@ mda_instantiate(const LV2_Descriptor* descriptor, PLUGIN_CLASS* effect = new PLUGIN_CLASS(master_callback); effect->setURI(URI_PREFIX PLUGIN_URI_SUFFIX); effect->setSampleRate(rate); - + uint32_t num_params = effect->getNumParameters(); uint32_t num_inputs = effect->getNumInputs(); uint32_t num_outputs = effect->getNumOutputs(); - + MDAPlugin* plugin = (MDAPlugin*)malloc(sizeof(MDAPlugin)); plugin->effect = effect; - + if (num_params > 0) { plugin->controls = (float*)malloc(sizeof(float) * num_params); plugin->control_buffers = (float**)malloc(sizeof(float*) * num_params); @@ -114,7 +114,7 @@ mda_instantiate(const LV2_Descriptor* descriptor, } else { plugin->inputs = NULL; } - + if (num_outputs > 0) { plugin->outputs = (float**)malloc(sizeof(float*) * num_outputs); for (uint32_t i = 0; i < num_outputs; ++i) @@ -122,7 +122,7 @@ mda_instantiate(const LV2_Descriptor* descriptor, } else { plugin->outputs = NULL; } - + return (LV2_Handle)plugin; } @@ -131,7 +131,7 @@ static void mda_run(LV2_Handle instance, uint32_t sample_count) { MDAPlugin* plugin = (MDAPlugin*)instance; - + for (int32_t i = 0; i < plugin->effect->getNumParameters(); ++i) { float val = plugin->control_buffers[i][0]; if (val != plugin->controls[i]) { @@ -139,7 +139,7 @@ mda_run(LV2_Handle instance, uint32_t sample_count) plugin->controls[i] = val; } } - + plugin->effect->processReplacing(plugin->inputs, plugin->outputs, sample_count); } @@ -162,7 +162,7 @@ mda_extension_data(const char* uri) return NULL; } } - + static void mda_deactivate(LV2_Handle instance) |