diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-03-20 08:56:55 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-03-20 08:56:55 +0100 |
commit | 830769798357588cc68e67420a16f20504fa5d77 (patch) | |
tree | 4e18fc57c9101b863d1b74de1c117bccf35b5fb8 | |
parent | 9486ad42e12884e2b3f40cbd76fba2cf889a416f (diff) |
Remove obsolete files.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | lv2/Makefile.am | 36 | ||||
-rw-r--r-- | lv2/drumgizmo.ttl | 156 | ||||
-rw-r--r-- | lv2/input_lv2.cc | 117 | ||||
-rw-r--r-- | lv2/input_lv2.h | 56 | ||||
-rw-r--r-- | lv2/lv2.cc | 250 | ||||
-rw-r--r-- | lv2/lv2_event.h | 281 | ||||
-rw-r--r-- | lv2/lv2_gui.cc | 237 | ||||
-rw-r--r-- | lv2/lv2_gui.h | 40 | ||||
-rw-r--r-- | lv2/lv2_instance.h | 50 | ||||
-rw-r--r-- | lv2/manifest.ttl | 7 | ||||
-rw-r--r-- | lv2/output_lv2.cc | 82 | ||||
-rw-r--r-- | lv2/output_lv2.h | 61 | ||||
-rw-r--r-- | plugin/README_VST.txt (renamed from vst/README.txt) | 0 | ||||
-rw-r--r-- | vst/Makefile.am | 53 | ||||
-rw-r--r-- | vst/Makefile.mingw32.in | 150 | ||||
-rw-r--r-- | vst/constants.h | 32 | ||||
-rw-r--r-- | vst/drumgizmo_vst.cc | 590 | ||||
-rw-r--r-- | vst/drumgizmo_vst.h | 119 | ||||
-rw-r--r-- | vst/input_vst.cc | 108 | ||||
-rw-r--r-- | vst/input_vst.h | 59 | ||||
-rw-r--r-- | vst/output_vst.cc | 86 | ||||
-rw-r--r-- | vst/output_vst.h | 54 |
23 files changed, 1 insertions, 2624 deletions
@@ -1,5 +1,6 @@ Makefile Makefile.in +Makefile.mingw32 aclocal.m4 autom4te.cache/ compile diff --git a/lv2/Makefile.am b/lv2/Makefile.am deleted file mode 100644 index 09ef24c..0000000 --- a/lv2/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -include $(top_srcdir)/plugingui/Makefile.am.plugingui -include $(top_srcdir)/src/Makefile.am.drumgizmo - -plugindir = $(libdir)/lv2/drumgizmo.lv2 - -if ENABLE_LV2 -plugin_LTLIBRARIES = drumgizmo.la -endif - -plugin_DATA = manifest.ttl drumgizmo.ttl - -EXTRA_DIST = \ - $(plugin_DATA) \ - input_lv2.h \ - output_lv2.h \ - lv2_event.h \ - lv2_gui.h \ - lv2_instance.h - -drumgizmo_la_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/plugingui \ - -I$(top_srcdir)/include $(SNDFILE_CXXFLAGS) \ - $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(LV2_CFLAGS) \ - $(PLUGIN_GUI_CFLAGS) $(SSEFLAGS) $(ZITA_CPPFLAGS) \ - -DUSE_THREAD $(SAMPLERATE_CFLAGS) - -drumgizmo_la_SOURCES = \ - $(DRUMGIZMO_SOURCES) \ - $(PLUGIN_GUI_SOURCES) \ - lv2.cc \ - lv2_gui.cc \ - input_lv2.cc \ - output_lv2.cc - -drumgizmo_la_LDFLAGS = -module -avoid-version -drumgizmo_la_LIBADD = $(LV2_LIBS) $(PLUGIN_GUI_LIBS) $(DRUMGIZMO_LIBS) - diff --git a/lv2/drumgizmo.ttl b/lv2/drumgizmo.ttl deleted file mode 100644 index 1854d74..0000000 --- a/lv2/drumgizmo.ttl +++ /dev/null @@ -1,156 +0,0 @@ -# LV2 DrumGizmo Plugin -# Copyright 2011 Bent Bisballe Nyeng <deva@aasimon.org> -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -@prefix doap: <http://usefulinc.com/ns/doap#> . -@prefix foaf: <http://xmlns.com/foaf/0.1/> . -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . -@prefix atom: <http://lv2plug.in/ns/ext/atom#> . -@prefix uiext: <http://lv2plug.in/ns/extensions/ui#> . -@prefix state: <http://lv2plug.in/ns/ext/state#> . -@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> . - -<http://drumgizmo.org/lv2-gui> - a uiext:external ; - uiext:binary <drumgizmo.so> . - -<http://drumgizmo.org/lv2> - a lv2:InstrumentPlugin ; - doap:name "DrumGizmo" ; - doap:maintainer [ - foaf:name "DrumGizmo.org"; - foaf:homepage <http://www.drumgizmo.org> ; - ] ; - doap:license <http://usefulinc.com/doap/licenses/gpl> ; - uiext:ui <http://drumgizmo.org/lv2-gui> ; - doap:license <http://opensource.org/licenses/gpl-3.0> ; - lv2:optionalFeature <http://lv2plug.in/ns/ext/uri-map> ; - lv2:optionalFeature <http://lv2plug.in/ns/ext/event> ; - lv2:extensionData state:interface ; - lv2:port [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 0 ; - lv2:symbol "lv2_freewheel" ; - lv2:name "Freewheel" ; - lv2:default 0.0 ; - lv2:minimum 0.0 ; - lv2:maximum 1.0 ; - lv2:designation <http://lv2plug.in/ns/lv2core#freeWheeling> ; - lv2:portProperty lv2:toggled ; - lv2:portProperty pprops:hasStrictBounds; - ] , [ - a atom:AtomPort , - lv2:InputPort; - atom:bufferType atom:Sequence ; - atom:supports <http://lv2plug.in/ns/ext/midi#MidiEvent> ; - lv2:index 1 ; - lv2:symbol "control" ; - lv2:name "Control" - ] , [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 2 ; - lv2:symbol "out1" ; - lv2:name "Out1" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 3 ; - lv2:symbol "out2" ; - lv2:name "Out2" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 4 ; - lv2:symbol "out3" ; - lv2:name "Out3" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 5 ; - lv2:symbol "out4" ; - lv2:name "Out4" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 6 ; - lv2:symbol "out5" ; - lv2:name "Out5" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 7 ; - lv2:symbol "out6" ; - lv2:name "Out6" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 8 ; - lv2:symbol "out7" ; - lv2:name "Out7" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 9 ; - lv2:symbol "out8" ; - lv2:name "Out8" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 10 ; - lv2:symbol "out9" ; - lv2:name "Out9" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 11 ; - lv2:symbol "out10" ; - lv2:name "Out10" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 12 ; - lv2:symbol "out11" ; - lv2:name "Out11" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 13 ; - lv2:symbol "out12" ; - lv2:name "Out12" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 14 ; - lv2:symbol "out13" ; - lv2:name "Out13" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 15 ; - lv2:symbol "out14" ; - lv2:name "Out14" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 16 ; - lv2:symbol "out15" ; - lv2:name "Out15" - ], [ - a lv2:AudioPort , - lv2:OutputPort ; - lv2:index 17 ; - lv2:symbol "out16" ; - lv2:name "Out16" - ] . diff --git a/lv2/input_lv2.cc b/lv2/input_lv2.cc deleted file mode 100644 index aa3ff9d..0000000 --- a/lv2/input_lv2.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * input_lv2.cc - * - * Wed Jul 13 14:27:02 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "input_lv2.h" - -#include "lv2/lv2plug.in/ns/ext/atom/util.h" - -#include <midimapparser.h> - -#include <hugin.hpp> - -InputLV2::InputLV2() -{ - eventPort = NULL; -} - -InputLV2::~InputLV2() -{ -} - -bool InputLV2::init(Instruments &i) -{ - instruments = &i; - return true; -} - -void InputLV2::setParm(std::string parm, std::string value) -{ -} - -bool InputLV2::start() -{ - return true; -} - -void InputLV2::stop() -{ -} - -void InputLV2::pre() -{ -} - -event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents) -{ - if(eventPort == NULL) { - *nevents = 0; - return NULL; - } - - event_t *list; - size_t listsize; - - list = (event_t *)malloc(sizeof(event_t) * 1000); - listsize = 0; - - LV2_Atom_Event* ev = lv2_atom_sequence_begin(&eventPort->body); - - while(!lv2_atom_sequence_is_end(&eventPort->body, - eventPort->atom.size, - ev)) { - uint8_t* const data = (uint8_t*)(ev+1); - - if ((data[0] & 0xF0) == 0x80) { // note off - int key = data[1]; - (void)key; - DEBUG(lv2input, "Event (off) key:%d\n", key); - } - - if ((data[0] & 0xF0) == 0x90) { // note on - int key = data[1]; - int velocity = data[2]; - - DEBUG(lv2input, "Event key:%d vel:%d\n", key, velocity); - - int i = mmap.lookup(key); - if(velocity && i != -1) { - list[listsize].type = TYPE_ONSET; - list[listsize].instrument = i; - list[listsize].velocity = velocity / 127.0; - list[listsize].offset = ev->time.frames; - listsize++; - } - } - ev = lv2_atom_sequence_next(ev); - } - - *nevents = listsize; - return list; -} - -void InputLV2::post() -{ -} diff --git a/lv2/input_lv2.h b/lv2/input_lv2.h deleted file mode 100644 index 44ad7da..0000000 --- a/lv2/input_lv2.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * input_lv2.h - * - * Wed Jul 13 14:27:02 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_INPUT_LV2_H__ -#define __DRUMGIZMO_INPUT_LV2_H__ - -#include <audioinputenginemidi.h> - -#include <lv2/lv2plug.in/ns/ext/atom/atom.h> - -class InputLV2 : public AudioInputEngineMidi { -public: - InputLV2(); - ~InputLV2(); - - bool init(Instruments &instruments); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); - - LV2_Atom_Sequence *eventPort{nullptr}; - -private: - Instruments *instruments{nullptr}; -}; - -#endif/*__DRUMGIZMO_INPUT_LV2_H__*/ diff --git a/lv2/lv2.cc b/lv2/lv2.cc deleted file mode 100644 index 224fca9..0000000 --- a/lv2/lv2.cc +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * lv2.cc - * - * Wed Jul 13 13:50:33 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include <lv2/lv2plug.in/ns/lv2core/lv2.h> -#include <lv2/lv2plug.in/ns/ext/atom/atom.h> - -#include <stdlib.h> -#include <string.h> - -#include "lv2_gui.h" -#include "lv2_instance.h" - -#include <hugin.hpp> - -enum { - FREE_WHEEL_PORT = 0, - MIDI_PORT, - AUDIO_PORT_BASE -}; - -#define DRUMGIZMO_URI "http://drumgizmo.org/lv2" -#define NS_DG DRUMGIZMO_URI "/atom#" - -// Stuff to handle DrumGizmo* transmission from instance to GUI. -static LV2_DrumGizmo_Descriptor dg_descriptor; - -static DrumGizmo *dg_get_pci(LV2_Handle instance) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - return dglv2->dg; -} - -LV2_State_Status dg_save(LV2_Handle instance, - LV2_State_Store_Function store, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature *const * features) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - - if(!dglv2 || !dglv2->map || !dglv2->map->map) { - // Missing urid feature? - return LV2_STATE_ERR_NO_FEATURE; - } - - std::string config = dglv2->dg->configString(); - - // Backwards compatible fix for errornously stored '\0' byte in < v0.9.8. - // Remove when we reach v1.0 - config += "\n"; - - store(handle, - dglv2->map->map(dglv2->map->handle, NS_DG "config"), - config.data(), - config.length(), - dglv2->map->map(dglv2->map->handle, LV2_ATOM__Chunk), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - return LV2_STATE_SUCCESS; -} - -LV2_State_Status dg_restore(LV2_Handle instance, - LV2_State_Retrieve_Function retrieve, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature *const * features) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - - if(!dglv2 || !dglv2->map || !dglv2->map->map) { - // Missing urid feature? - return LV2_STATE_ERR_NO_FEATURE; - } - - size_t size; - uint32_t type; - - const char* data = - (const char*)retrieve(handle, - dglv2->map->map(dglv2->map->handle, NS_DG "config"), - &size, &type, &flags); - - DEBUG(lv2, "Config string size: %d, data*: %p\n", (int)size, data); - - if(data && size) { - std::string config; - - // Fix for errornously stored '\0' byte in < v0.9.8. - // Remove when we reach v1.0 - if(data[size - 1] == '\0') size--; - - config.append(data, size); - dglv2->dg->setConfigString(config); - } - - return LV2_STATE_SUCCESS; -} - -static LV2_State_Interface dg_persist = { - dg_save, - dg_restore -}; - -LV2_Handle instantiate(const struct _LV2_Descriptor *descriptor, - double sample_rate, - const char *bundle_path, - const LV2_Feature *const *features) -{ - DGLV2 *dglv2 = new DGLV2; - - dglv2->free_wheel_port = NULL; // Not assigned - dglv2->pos = 0; // Start from the beginning - - dglv2->map = NULL; - for (int i = 0 ; features[i] ; i++) { - if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) { - dglv2->map = (LV2_URID_Map*)features[i]->data; - } - } - - dg_descriptor.get_pci = dg_get_pci; - - dglv2->in = new InputLV2(); - dglv2->out = new OutputLV2(); - - dglv2->buffer = NULL; - dglv2->buffer_size = 0; - - dglv2->dg = new DrumGizmo(dglv2->out, dglv2->in); - dglv2->dg->setSamplerate(sample_rate); - - return (LV2_Handle)dglv2; -} - -void connect_port(LV2_Handle instance, uint32_t port, void *data_location) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - - if(port == FREE_WHEEL_PORT) { - dglv2->free_wheel_port = (float*)data_location; - } - - if(port == MIDI_PORT) { // MIDI in - dglv2->in->eventPort = (LV2_Atom_Sequence*)data_location; - } - - if(port >= AUDIO_PORT_BASE) { // Audio Port - uint32_t audio_port = port - AUDIO_PORT_BASE; - dglv2->out->outputPorts[audio_port].samples = (sample_t*)data_location; - dglv2->out->outputPorts[audio_port].size = 0; - } -} - -void activate(LV2_Handle instance) -{ - // We don't really need to do anything here. - DGLV2 *dglv2 = (DGLV2 *)instance; - (void)dglv2; -} - -void run(LV2_Handle instance, uint32_t sample_count) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - - if(dglv2->free_wheel_port) { - dglv2->dg->setFreeWheel(*dglv2->free_wheel_port); - } - - if(dglv2->buffer_size != sample_count) { - dglv2->buffer_size = sample_count; - dglv2->dg->setFrameSize(sample_count); - } - dglv2->dg->run(dglv2->pos, dglv2->buffer, sample_count); - - dglv2->pos += sample_count; -} - -void deactivate(LV2_Handle instance) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - dglv2->dg->stop(); -} - -void cleanup(LV2_Handle instance) -{ - DGLV2 *dglv2 = (DGLV2 *)instance; - delete dglv2->dg; - delete dglv2->in; - delete dglv2->out; -} - -const void* extension_data(const char *uri) -{ - if(!strcmp(uri, PLUGIN_INSTANCE_URI)) return &dg_descriptor; - if(!strcmp(uri, LV2_STATE__interface)) return &dg_persist; - return NULL; -} - -#ifdef __cplusplus -extern "C" { -#endif - -static const LV2_Descriptor descriptor = { - DRUMGIZMO_URI, - instantiate, - connect_port, - activate, - run, - deactivate, - cleanup, - extension_data -}; - -LV2_SYMBOL_EXPORT -const LV2_Descriptor* lv2_descriptor(uint32_t index) -{ - switch (index) { - case 0: - return &descriptor; - default: - return NULL; - } -} - -#ifdef __cplusplus -} -#endif diff --git a/lv2/lv2_event.h b/lv2/lv2_event.h deleted file mode 100644 index 2c340ba..0000000 --- a/lv2/lv2_event.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - LV2 Event Extension - Copyright 2008-2011 David Robillard <http://drobilla.net> - Copyright 2006-2007 Lars Luthman <lars.luthman@gmail.com> - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef LV2_EVENT_H -#define LV2_EVENT_H - -#define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" -#define LV2_EVENT_AUDIO_STAMP 0 - -#include <stdint.h> - -/** - @file event.h - C API for the LV2 Event extension <http://lv2plug.in/ns/ext/event>. - - This extension is a generic transport mechanism for time stamped events - of any type (e.g. MIDI, OSC, ramps, etc). Each port can transport mixed - events of any type; the type of events and timestamps are defined by a URI - which is mapped to an integer by the host for performance reasons. - - This extension requires the host to support the LV2 URI Map extension. - Any host which supports this extension MUST guarantee that any call to - the LV2 URI Map uri_to_id function with the URI of this extension as the - 'map' argument returns a value within the range of uint16_t. -*/ - -/** - The best Pulses Per Quarter Note for tempo-based uint32_t timestamps. - Equal to 2^12 * 5 * 7 * 9 * 11 * 13 * 17, which is evenly divisble - by all integers from 1 through 18 inclusive, and powers of 2 up to 2^12. -*/ -static const uint32_t LV2_EVENT_PPQN = 3136573440U; - -/** - An LV2 event (header only). - - LV2 events are generic time-stamped containers for any type of event. - The type field defines the format of a given event's contents. - - This struct defines the header of an LV2 event. An LV2 event is a single - chunk of POD (plain old data), usually contained in a flat buffer (see - LV2_EventBuffer below). Unless a required feature says otherwise, hosts may - assume a deep copy of an LV2 event can be created safely using a simple: - - memcpy(ev_copy, ev, sizeof(LV2_Event) + ev->size); (or equivalent) -*/ -typedef struct { - - /** - The frames portion of timestamp. The units used here can optionally be - set for a port (with the lv2ev:timeUnits property), otherwise this is - audio frames, corresponding to the sample_count parameter of the LV2 run - method (e.g. frame 0 is the first frame for that call to run). - */ - uint32_t frames; - - /** - The sub-frames portion of timestamp. The units used here can optionally - be set for a port (with the lv2ev:timeUnits property), otherwise this is - 1/(2^32) of an audio frame. - */ - uint32_t subframes; - - /** - The type of this event, as a number which represents some URI - defining an event type. This value MUST be some value previously - returned from a call to the uri_to_id function defined in the LV2 - URI map extension (see lv2_uri_map.h). - There are special rules which must be followed depending on the type - of an event. If the plugin recognizes an event type, the definition - of that event type will describe how to interpret the event, and - any required behaviour. Otherwise, if the type is 0, this event is a - non-POD event and lv2_event_unref MUST be called if the event is - 'dropped' (see above). Even if the plugin does not understand an event, - it may pass the event through to an output by simply copying (and NOT - calling lv2_event_unref). These rules are designed to allow for generic - event handling plugins and large non-POD events, but with minimal hassle - on simple plugins that "don't care" about these more advanced features. - */ - uint16_t type; - - /** - The size of the data portion of this event in bytes, which immediately - follows. The header size (12 bytes) is not included in this value. - */ - uint16_t size; - - /* size bytes of data follow here */ - -} LV2_Event; - - -/** - A buffer of LV2 events (header only). - - Like events (which this contains) an event buffer is a single chunk of POD: - the entire buffer (including contents) can be copied with a single memcpy. - The first contained event begins sizeof(LV2_EventBuffer) bytes after the - start of this struct. - - After this header, the buffer contains an event header (defined by struct - LV2_Event), followed by that event's contents (padded to 64 bits), followed - by another header, etc: - - | | | | | | | - | | | | | | | | | | | | | | | | | | | | | | | | | - |FRAMES |SUBFRMS|TYP|LEN|DATA..DATA..PAD|FRAMES | ... -*/ -typedef struct { - - /** - The contents of the event buffer. This may or may not reside in the - same block of memory as this header, plugins must not assume either. - The host guarantees this points to at least capacity bytes of allocated - memory (though only size bytes of that are valid events). - */ - uint8_t* data; - - /** - The size of this event header in bytes (including everything). - - This is to allow for extending this header in the future without - breaking binary compatibility. Whenever this header is copied, - it MUST be done using this field (and NOT the sizeof this struct). - */ - uint16_t header_size; - - /** - The type of the time stamps for events in this buffer. - As a special exception, '0' always means audio frames and subframes - (1/UINT32_MAX'th of a frame) in the sample rate passed to instantiate. - - INPUTS: The host must set this field to the numeric ID of some URI - defining the meaning of the frames/subframes fields of contained events - (obtained by the LV2 URI Map uri_to_id function with the URI of this - extension as the 'map' argument, see lv2_uri_map.h). The host must - never pass a plugin a buffer which uses a stamp type the plugin does not - 'understand'. The value of this field must never change, except when - connect_port is called on the input port, at which time the host MUST - have set the stamp_type field to the value that will be used for all - subsequent run calls. - - OUTPUTS: The plugin may set this to any value that has been returned - from uri_to_id with the URI of this extension for a 'map' argument. - When connected to a buffer with connect_port, output ports MUST set this - field to the type of time stamp they will be writing. On any call to - connect_port on an event input port, the plugin may change this field on - any output port, it is the responsibility of the host to check if any of - these values have changed and act accordingly. - */ - uint16_t stamp_type; - - /** - The number of events in this buffer. - - INPUTS: The host must set this field to the number of events contained - in the data buffer before calling run(). The plugin must not change - this field. - - OUTPUTS: The plugin must set this field to the number of events it has - written to the buffer before returning from run(). Any initial value - should be ignored by the plugin. - */ - uint32_t event_count; - - /** - The size of the data buffer in bytes. - This is set by the host and must not be changed by the plugin. - The host is allowed to change this between run() calls. - */ - uint32_t capacity; - - /** - The size of the initial portion of the data buffer containing data. - - INPUTS: The host must set this field to the number of bytes used - by all events it has written to the buffer (including headers) - before calling the plugin's run(). - The plugin must not change this field. - - OUTPUTS: The plugin must set this field to the number of bytes - used by all events it has written to the buffer (including headers) - before returning from run(). - Any initial value should be ignored by the plugin. - */ - uint32_t size; - -} LV2_Event_Buffer; - - -/** - Opaque pointer to host data. -*/ -typedef void* LV2_Event_Callback_Data; - - -/** - Non-POD events feature. - - To support this feature the host must pass an LV2_Feature struct to the - plugin's instantiate method with URI "http://lv2plug.in/ns/ext/event" - and data pointed to an instance of this struct. Note this feature - is not mandatory to support the event extension. -*/ -typedef struct { - - /** - Opaque pointer to host data. - - The plugin MUST pass this to any call to functions in this struct. - Otherwise, it must not be interpreted in any way. - */ - LV2_Event_Callback_Data callback_data; - - /** - Take a reference to a non-POD event. - - If a plugin receives an event with type 0, it means the event is a - pointer to some object in memory and not a flat sequence of bytes - in the buffer. When receiving a non-POD event, the plugin already - has an implicit reference to the event. If the event is stored AND - passed to an output, lv2_event_ref MUST be called on that event. - If the event is only stored OR passed through, this is not necessary - (as the plugin already has 1 implicit reference). - - @param event An event received at an input that will not be copied to - an output or stored in any way. - - @param context The calling context. Like event types, this is a mapped - URI, see lv2_context.h. Simple plugin with just a run() method should - pass 0 here (the ID of the 'standard' LV2 run context). The host - guarantees that this function is realtime safe iff @a context is - realtime safe. - - PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. - */ - uint32_t (*lv2_event_ref)(LV2_Event_Callback_Data callback_data, - LV2_Event* event); - - /** - Drop a reference to a non-POD event. - - If a plugin receives an event with type 0, it means the event is a - pointer to some object in memory and not a flat sequence of bytes - in the buffer. If the plugin does not pass the event through to - an output or store it internally somehow, it MUST call this function - on the event (more information on using non-POD events below). - - @param event An event received at an input that will not be copied to an - output or stored in any way. - - @param context The calling context. Like event types, this is a mapped - URI, see lv2_context.h. Simple plugin with just a run() method should - pass 0 here (the ID of the 'standard' LV2 run context). The host - guarantees that this function is realtime safe iff @a context is - realtime safe. - - PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. - */ - uint32_t (*lv2_event_unref)(LV2_Event_Callback_Data callback_data, - LV2_Event* event); - -} LV2_Event_Feature; - - -#endif /* LV2_EVENT_H */ diff --git a/lv2/lv2_gui.cc b/lv2/lv2_gui.cc deleted file mode 100644 index f683c8c..0000000 --- a/lv2/lv2_gui.cc +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * lv2.cc - * - * Wed Jul 13 13:50:33 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "lv2_gui.h" - -#include <stdio.h> -#include <string.h> - -#include <lv2/lv2plug.in/ns/ext/instance-access/instance-access.h> -#include <lv2/lv2plug.in/ns/extensions/ui/ui.h> - -#include "lv2_instance.h" - -// From: http://codesearch.google.com/#50sg5qT6WNE/src/lv2_ui_dssi.c -// git://repo.or.cz/nekobee.git/src/lv2_ui_dssi.c - -#define DRUMGIZMO_UI_URI "http://drumgizmo.org/lv2-gui" - -#include <plugingui.h> - -/** - * When LV2_EXTERNAL_UI_URI UI is instantiated, the returned - * LV2UI_Widget handle must be cast to pointer to struct lv2_external_ui. - * UI is created in invisible state. - */ -struct lv2_external_ui -{ - /** - * Host calls this function regulary. UI library implementing the - * callback may do IPC or redraw the UI. - * - * @param _this_ the UI context - */ - void (* run)(struct lv2_external_ui * _this_); - - /** - * Host calls this function to make the plugin UI visible. - * - * @param _this_ the UI context - */ - void (* show)(struct lv2_external_ui * _this_); - - /** - * Host calls this function to make the plugin UI invisible again. - * - * @param _this_ the UI context - */ - void (* hide)(struct lv2_external_ui * _this_); -}; - -/** UI extension suitable for out-of-process UIs */ -#define LV2_EXTERNAL_UI_URI "http://lv2plug.in/ns/extensions/ui#external" - -/** - * On UI instantiation, host must supply LV2_EXTERNAL_UI_URI - * feature. LV2_Feature::data must be pointer to struct lv2_external_ui_host. */ -struct lv2_external_ui_host -{ - /** - * Callback that plugin UI will call - * when UI (GUI window) is closed by user. - * This callback wil; be called during execution of lv2_external_ui::run() - * (i.e. not from background thread). - * - * After this callback is called, UI is defunct. Host must call - * LV2UI_Descriptor::cleanup(). If host wants to make the UI visible - * again UI must be reinstantiated. - * - * @param controller Host context associated with plugin UI, as - * supplied to LV2UI_Descriptor::instantiate() - */ - void (* ui_closed)(LV2UI_Controller controller); - - /** - * Optional (may be NULL) "user friendly" identifier which the UI - * may display to allow a user to easily associate this particular - * UI instance with the correct plugin instance as it is represented - * by the host (e.g. "track 1" or "channel 4"). - * - * If supplied by host, the string will be referenced only during - * LV2UI_Descriptor::instantiate() - */ - const char * plugin_human_id; -}; - -struct DG_GUI { - struct lv2_external_ui virt; - - LV2_Handle instance_handle; - LV2_Extension_Data_Feature *data_access; - DrumGizmo *instance; - LV2UI_Controller controller; - - GUI::PluginGUI *gui; - struct lv2_external_ui_host *ui_host_ptr; -}; - -static void ui_run(struct lv2_external_ui * _this_) -{ - struct DG_GUI *dggui = (struct DG_GUI *)_this_; - dggui->gui->processEvents(); -} - -static void ui_show(struct lv2_external_ui * _this_) -{ - struct DG_GUI *dggui = (struct DG_GUI *)_this_; - dggui->gui->show(); -} - -static void ui_hide(struct lv2_external_ui * _this_) -{ - struct DG_GUI *dggui = (struct DG_GUI *)_this_; - if(dggui->gui) dggui->gui->hide(); -} - -static void closeHandler(void *ptr) -{ - struct DG_GUI *gui = (struct DG_GUI *)ptr; - - if(gui->ui_host_ptr && gui->ui_host_ptr->ui_closed) { - gui->ui_host_ptr->ui_closed(gui->controller); - } - - delete gui->gui; - gui->gui = NULL; -} - -static LV2UI_Handle 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) -{ - printf("ui_instantiate\n"); - - struct DG_GUI* pt = new struct DG_GUI; - - pt->ui_host_ptr = NULL; - pt->controller = controller; - - while (*features != NULL) { - std::string uri = (*features)->URI; - void *data = (*features)->data; - - printf("DGUI: feature: %s\n", uri.c_str()); - - if(uri == LV2_INSTANCE_ACCESS_URI) { - pt->instance_handle = data; - } - - if(uri == LV2_DATA_ACCESS_URI) { - pt->data_access = (LV2_Extension_Data_Feature *)data; - } - - if(uri == LV2_EXTERNAL_UI_URI) { - pt->ui_host_ptr = (struct lv2_external_ui_host *)data; - } - features++; - } - - LV2_DrumGizmo_Descriptor *dgd = - (LV2_DrumGizmo_Descriptor *)(*pt->data_access->data_access)(PLUGIN_INSTANCE_URI); - - pt->instance = dgd->get_pci(pt->instance_handle); - pt->virt.run = ui_run; - pt->virt.show = ui_show; - pt->virt.hide = ui_hide; - pt->gui = new GUI::PluginGUI(); - pt->gui->setWindowClosedCallback(closeHandler, pt); - - *widget = (LV2UI_Widget)pt; - - return pt; -} - -static void ui_cleanup(LV2UI_Handle ui) -{ - struct DG_GUI* pt = (struct DG_GUI*)ui; - delete pt->gui; - pt->gui = NULL; - delete pt; -} - -static void ui_port_event(LV2UI_Handle ui, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void * buffer) -{ -} - -#ifdef __cplusplus -extern "C" { -#endif - -static LV2UI_Descriptor descriptor = { - DRUMGIZMO_UI_URI, - ui_instantiate, - ui_cleanup, - ui_port_event, - NULL -}; - -const LV2UI_Descriptor *lv2ui_descriptor(uint32_t index) -{ - if(index == 0) return &descriptor; - return NULL; -} - -#ifdef __cplusplus -} -#endif diff --git a/lv2/lv2_gui.h b/lv2/lv2_gui.h deleted file mode 100644 index a929da3..0000000 --- a/lv2/lv2_gui.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * lv2_gui.h - * - * Fri Oct 21 10:48:53 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_LV2_GUI_H__ -#define __DRUMGIZMO_LV2_GUI_H__ - -#include <lv2/lv2plug.in/ns/lv2core/lv2.h> -#include <lv2/lv2plug.in/ns/ext/data-access/data-access.h> - -#define PLUGIN_INSTANCE_URI "http://drumgizmo.org/ns/drumgizmo-plugin-instance" - -class DrumGizmo; -struct LV2_DrumGizmo_Descriptor { - DrumGizmo *(*get_pci)(LV2_Handle instance); -}; - -#endif/*__DRUMGIZMO_LV2_GUI_H__*/ diff --git a/lv2/lv2_instance.h b/lv2/lv2_instance.h deleted file mode 100644 index d1abb9a..0000000 --- a/lv2/lv2_instance.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * lv2_instance.h - * - * Sun Nov 20 15:27:41 CET 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_LV2_INSTANCE_H__ -#define __DRUMGIZMO_LV2_INSTANCE_H__ - -#include <lv2/lv2plug.in/ns/lv2core/lv2.h> -#include <lv2/lv2plug.in/ns/ext/state/state.h> -#include <lv2/lv2plug.in/ns/ext/urid/urid.h> - -#include "input_lv2.h" -#include "output_lv2.h" - -#include <drumgizmo.h> - -typedef struct { - InputLV2 *in; - OutputLV2 *out; - DrumGizmo *dg; - sample_t *buffer; - size_t buffer_size; - LV2_URID_Map* map; - float* free_wheel_port; - size_t pos; -} DGLV2; - -#endif/*__DRUMGIZMO_LV2_INSTANCE_H__*/ diff --git a/lv2/manifest.ttl b/lv2/manifest.ttl deleted file mode 100644 index 65a8953..0000000 --- a/lv2/manifest.ttl +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - -<http://drumgizmo.org/lv2> - a lv2:Plugin ; - lv2:binary <drumgizmo.so> ; - rdfs:seeAlso <drumgizmo.ttl> . diff --git a/lv2/output_lv2.cc b/lv2/output_lv2.cc deleted file mode 100644 index fdd795b..0000000 --- a/lv2/output_lv2.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * output_lv2.cc - * - * Wed Jul 13 14:27:06 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "output_lv2.h" - -#include <string.h> - -OutputLV2::OutputLV2() -{ - for(size_t i = 0; i < NUM_OUTPUTS; i++) { - outputPorts[i].size = 0; - outputPorts[i].samples = NULL; - } -} - -OutputLV2::~OutputLV2() -{ -} - -bool OutputLV2::init(Channels channels) -{ - return true; -} - -void OutputLV2::setParm(std::string parm, std::string value) -{ -} - -bool OutputLV2::start() -{ - return true; -} - -void OutputLV2::stop() -{ -} - -void OutputLV2::pre(size_t nsamples) -{ -} - -void OutputLV2::run(int ch, sample_t *samples, size_t nsamples) -{ - if(ch < NUM_OUTPUTS) { - if(outputPorts[ch].samples) { - memcpy(outputPorts[ch].samples, samples, nsamples * sizeof(sample_t)); - } - } -} - -void OutputLV2::post(size_t nsamples) -{ -} - -sample_t *OutputLV2::getBuffer(int ch) -{ - if(ch < NUM_OUTPUTS) return outputPorts[ch].samples; - return NULL; -} diff --git a/lv2/output_lv2.h b/lv2/output_lv2.h deleted file mode 100644 index 88b8a4b..0000000 --- a/lv2/output_lv2.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * output_lv2.h - * - * Wed Jul 13 14:27:06 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_OUTPUT_LV2_H__ -#define __DRUMGIZMO_OUTPUT_LV2_H__ - -#include <audiooutputengine.h> - -#define NUM_OUTPUTS 64 - -class OutputPort { -public: - size_t size; - sample_t *samples; -}; - -class OutputLV2 : public AudioOutputEngine { -public: - OutputLV2(); - ~OutputLV2(); - - bool init(Channels channels); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(size_t nsamples); - void run(int ch, sample_t *samples, size_t nsamples); - void post(size_t nsamples); - - sample_t *getBuffer(int c); - - OutputPort outputPorts[NUM_OUTPUTS]; -}; - -#endif/*__DRUMGIZMO_OUTPUT_LV2_H__*/ diff --git a/vst/README.txt b/plugin/README_VST.txt index 30aa640..30aa640 100644 --- a/vst/README.txt +++ b/plugin/README_VST.txt diff --git a/vst/Makefile.am b/vst/Makefile.am deleted file mode 100644 index 1f337b6..0000000 --- a/vst/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -include $(top_srcdir)/plugingui/Makefile.am.plugingui -include $(top_srcdir)/src/Makefile.am.drumgizmo - -VST_BASE = ${VST_SOURCE_PATH} -VST_SRC_BASE = ${VST_BASE}/public.sdk/source/vst2.x/ -VST_SOURCES = \ - ${VST_SRC_BASE}/audioeffectx.cpp \ - ${VST_SRC_BASE}/audioeffect.cpp \ - ${VST_SRC_BASE}/vstplugmain.cpp - -AM_CPPFLAGS = -I$(top_srcdir)/hugin -DWITH_HUG_SYSLOG -DWITH_HUG_MUTEX - -EXTRA_DIST = \ - Makefile.mingw32.in \ - constants.h \ - drumgizmo_vst.cc \ - drumgizmo_vst.h \ - input_vst.cc \ - input_vst.h \ - output_vst.cc \ - output_vst.h - -if ENABLE_VST -plugin_LTLIBRARIES = -plugindir = $(prefix)/lib/vst -plugin_LTLIBRARIES += drumgizmo_vst.la -noinst_LTLIBRARIES = libdg.la -endif - -libdg_la_SOURCES = \ - $(DRUMGIZMO_SOURCES) \ - $(PLUGIN_GUI_SOURCES) - -libdg_la_LDFLAGS = -all-static -static -static-libgcc -libdg_la_LIBADD = $(PLUGIN_GUI_LIBS) $(DRUMGIZMO_LIBS) -libdg_la_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/plugingui \ - -I$(top_srcdir)/include $(SNDFILE_CXXFLAGS) \ - $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(VST_CPPFLAGS) \ - $(PLUGIN_GUI_CFLAGS) $(SSEFLAGS)\ - -DUSE_THREAD $(SAMPLERATE_CFLAGS) - -nodist_drumgizmo_vst_la_SOURCES = \ - $(VST_SOURCES) - -drumgizmo_vst_la_SOURCES = \ - drumgizmo_vst.cc \ - input_vst.cc \ - output_vst.cc - -drumgizmo_vst_la_LDFLAGS = -shared -module -avoid-version -drumgizmo_vst_la_LIBADD = libdg.la -drumgizmo_vst_la_CXXFLAGS = -w $(VST_CPPFLAGS) \ - -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/plugingui
\ No newline at end of file diff --git a/vst/Makefile.mingw32.in b/vst/Makefile.mingw32.in deleted file mode 100644 index bf0e7f4..0000000 --- a/vst/Makefile.mingw32.in +++ /dev/null @@ -1,150 +0,0 @@ -VST_BASE=@VST_SOURCE_PATH@ -VST_SRC_BASE = ${VST_BASE}/public.sdk/source/vst2.x/ -VST_SRC = \ - ${VST_SRC_BASE}/audioeffectx.cpp \ - ${VST_SRC_BASE}/audioeffect.cpp \ - ${VST_SRC_BASE}/vstplugmain.cpp -VST_CFLAGS=-I$(VST_BASE) - -DG_SRC = \ - @top_srcdir@/src/audiocachefile.cc \ - @top_srcdir@/src/audiocache.cc \ - @top_srcdir@/src/audiocacheeventhandler.cc \ - @top_srcdir@/src/audiocacheidmanager.cc \ - @top_srcdir@/src/audioinputenginemidi.cc \ - @top_srcdir@/src/audiofile.cc \ - @top_srcdir@/src/channel.cc \ - @top_srcdir@/src/channelmixer.cc \ - @top_srcdir@/src/chresampler.cc \ - @top_srcdir@/src/configfile.cc \ - @top_srcdir@/src/configuration.cc \ - @top_srcdir@/src/configparser.cc \ - @top_srcdir@/src/drumgizmo.cc \ - @top_srcdir@/src/drumkit.cc \ - @top_srcdir@/src/drumkitloader.cc \ - @top_srcdir@/src/drumkitparser.cc \ - @top_srcdir@/src/events.cc \ - @top_srcdir@/src/instrument.cc \ - @top_srcdir@/src/instrumentparser.cc \ - @top_srcdir@/src/memchecker.cc \ - @top_srcdir@/src/messagehandler.cc \ - @top_srcdir@/src/messagereceiver.cc \ - @top_srcdir@/src/midimapparser.cc \ - @top_srcdir@/src/midimapper.cc \ - @top_srcdir@/src/mutex.cc \ - @top_srcdir@/src/path.cc \ - @top_srcdir@/src/powerlist.cc \ - @top_srcdir@/src/sample.cc \ - @top_srcdir@/src/semaphore.cc \ - @top_srcdir@/src/saxparser.cc \ - @top_srcdir@/src/thread.cc \ - @top_srcdir@/src/velocity.cc \ - @top_srcdir@/src/versionstr.cc -DG_CFLAGS = -I.. -I../include -I../src -DSSE -msse -msse2 -# -DDISABLE_HUGIN - -GUI_SRC = \ - @top_srcdir@/plugingui/dgwindow.cc \ - @top_srcdir@/plugingui/nativewindow_win32.cc \ - @top_srcdir@/plugingui/plugingui.cc \ - @top_srcdir@/plugingui/pluginconfig.cc \ - @top_srcdir@/plugingui/label.cc \ - @top_srcdir@/plugingui/eventhandler.cc \ - @top_srcdir@/plugingui/font.cc \ - @top_srcdir@/plugingui/window.cc \ - @top_srcdir@/plugingui/widget.cc \ - @top_srcdir@/plugingui/colour.cc \ - @top_srcdir@/plugingui/painter.cc \ - @top_srcdir@/plugingui/button.cc \ - @top_srcdir@/plugingui/pixelbuffer.cc \ - @top_srcdir@/plugingui/lineedit.cc \ - @top_srcdir@/plugingui/led.cc \ - @top_srcdir@/plugingui/layout.cc \ - @top_srcdir@/plugingui/checkbox.cc \ - @top_srcdir@/plugingui/slider.cc \ - @top_srcdir@/plugingui/scrollbar.cc \ - @top_srcdir@/plugingui/textedit.cc \ - @top_srcdir@/plugingui/listbox.cc \ - @top_srcdir@/plugingui/listboxthin.cc \ - @top_srcdir@/plugingui/listboxbasic.cc \ - @top_srcdir@/plugingui/knob.cc \ - @top_srcdir@/plugingui/filebrowser.cc \ - @top_srcdir@/plugingui/directory.cc \ - @top_srcdir@/plugingui/image.cc \ - @top_srcdir@/plugingui/combobox.cc \ - @top_srcdir@/plugingui/progressbar.cc \ - @top_srcdir@/plugingui/verticalline.cc \ - @top_srcdir@/plugingui/resource.cc \ - @top_srcdir@/plugingui/resource_data.cc \ - @top_srcdir@/plugingui/lodepng/lodepng.cpp - -GUI_CFLAGS=-I@top_srcdir@/plugingui/ -DUSE_THREAD @GUI_CFLAGS@ -GUI_LIBS=-lgdi32 -lsetupapi -lws2_32 - -DBG_SRC = \ - @top_srcdir@/hugin/hugin.c \ - @top_srcdir@/hugin/hugin_syslog.c - -DBG_CFLAGS=-I../hugin -DWITH_HUG_SYSLOG -DWITH_HUG_MUTEX -# -DDISABLE_HUGIN - -# -# http://old.nabble.com/using-VC%2B%2B-.lib-with-mingw-td23151303.html -# Given `-lfoo', the win32 build of GNU ld will search for libfoo.a and foo.lib -# - -EXPAT_CFLAGS=@EXPAT_CFLAGS@ -EXPAT_LIBS=@EXPAT_LIBS@ - -SNDFILE_CFLAGS=@SNDFILE_CFLAGS@ -SNDFILE_LIBS=@SNDFILE_LIBS@ - -SRC_CFLAGS=@SAMPLERATE_CFLAGS@ -SRC_LIBS=@SAMPLERATE_LIBS@ - -ZITA_CXXFLAGS=@ZITA_CPPFLAGS@ -ZITA_LIBS=@ZITA_LIBS@ - -SRC = \ - drumgizmo_vst.cc \ - input_vst.cc \ - output_vst.cc - -####################### -# -#CXXFLAGS=-DWIN32 $(EXPAT_CFLAGS) $(SNDFILE_CFLAGS) $(DG_CFLAGS) $(GUI_CFLAGS) $(DBG_CFLAGS) $(VST_CFLAGS) -#CFLAGS=$(CXXFLAGS) -#LDFLAGS=$(EXPAT_LIBS) $(SNDFILE_LIBS) $(GUI_LIBS) $(DBG_LIBS) -# -#C_SOURCES=$(DBG_SRC) -#CXX_SOURCES=$(GUI_SRC) $(DG_SRC) -#CPP_SOURCES=$(VST_SRC) -# -#OBJECTS=$(CXX_SOURCES:.cc=.o) $(CPP_SOURCES:.cpp=.o) $(C_SOURCES:.c=.o) -#all: $(CXX_SOURCES) $(CPP_SOURCES) $(C_SOURCES) drumgizmo_vst.dll -# -#drumgizmo_vst.dll: $(OBJECTS) -# g++ $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) -shared -o drumgizmo_vst.dll -Wl,--out-implib,libdrumgizmo_vst.a -# -#%.o: %.cc -# g++ -O3 -c $(CXXFLAGS) $(LDFLAGS) $< -o $(notdir $@) -# -#%.o: %.cpp -# g++ -O3 -c $(CXXFLAGS) $(LDFLAGS) $< -o $(notdir $@) -# -#%.o: %.c -# gcc -O3 -c $(CFLAGS) $(LDFLAGS) $< -o $@ -# -#clean: -# del -f $(notdir $(OBJECTS)) drumgizmo_vst.dll libdrumgizmo_vst.a -# -######################## - - -all: - gcc $(DBG_CFLAGS) @top_srcdir@/hugin/hugin.c -c - gcc $(DBG_CFLAGS) @top_srcdir@/hugin/hugin_syslog.c -c - g++ $(CXXFLAGS) -std=c++11 -static -static-libgcc -O2 -g -Wall $(DBG_CFLAGS) $(DG_CFLAGS) $(DG_LIBS) $(VST_CFLAGS) hugin.o hugin_syslog.o $(DG_SRC) $(VST_SRC) ${SRC} ${GUI_SRC} ${GUI_CFLAGS} $(GUI_LIBS) $(EXPAT_CFLAGS) $(SRC_CFLAGS) $(ZITA_CXXFLAGS) $(EXPAT_LIBS) $(SNDFILE_CFLAGS) $(SNDFILE_LIBS) $(SRC_LIBS) $(ZITA_LIBS) -shared -o drumgizmo_vst.dll -Wl,--out-implib,libdrumgizmo_vst.a - -clean: - del -f drumgizmo_vst.dll libdrumgizmo_vst.a diff --git a/vst/constants.h b/vst/constants.h deleted file mode 100644 index 655bfc8..0000000 --- a/vst/constants.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * constants.h - * - * Tue Sep 20 11:49:29 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_CONSTANTS_H__ -#define __DRUMGIZMO_CONSTANTS_H__ - -#define NUM_OUTPUTS 16 - -#endif/*__DRUMGIZMO_CONSTANTS_H__*/ diff --git a/vst/drumgizmo_vst.cc b/vst/drumgizmo_vst.cc deleted file mode 100644 index 81b8875..0000000 --- a/vst/drumgizmo_vst.cc +++ /dev/null @@ -1,590 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * drumgizmo_vst.cc - * - * Tue Sep 20 08:22:48 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "drumgizmo_vst.h" - -#include "constants.h" - -#include <time.h> -#include <drumgizmo.h> - -#include <hugin.hpp> -#include <stdlib.h> -#include <string> - -#define NUM_PROGRAMS 0 -#define NUM_PARAMS 0 - -DGEditor::DGEditor(AudioEffect* effect) -{ - DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__); - dgeff = (DrumGizmoVst*)effect; - plugingui = nullptr; - drumgizmo = dgeff->drumgizmo; -} - -bool DGEditor::open(void* ptr) -{ - DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__); - if(plugingui) - { - delete plugingui; - } - - plugingui = new GUI::PluginGUI(); - plugingui->show(); - return true; -} - -void DGEditor::close() -{ - DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__); - - if(plugingui) - { - delete plugingui; - } - - plugingui = nullptr; -} - -bool DGEditor::isOpen() -{ - DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__); - return plugingui != nullptr; -} - -void DGEditor::idle() -{ - DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__); - // if(plugingui) plugingui->processEvents(); -} - -AudioEffect* createEffectInstance(audioMasterCallback audioMaster) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - return new DrumGizmoVst(audioMaster); -} - -DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster) - : AudioEffectX(audioMaster, NUM_PROGRAMS, NUM_PARAMS) -{ - hug_status_t status = HUG_STATUS_OK; - - int hugin_flags = HUG_FLAG_USE_MUTEX; - - const char* syslog_host_env = getenv("DG_SYSLOG_HOST"); - - if(syslog_host_env) - { - std::string syslog_host = syslog_host_env; - int syslog_port = 514; - const char* syslog_port_env = getenv("DG_SYSLOG_PORT"); - if(syslog_port_env) - { - syslog_port = atoi(syslog_port_env); - } - - status = hug_init(hugin_flags | HUG_FLAG_OUTPUT_TO_SYSLOG, - HUG_OPTION_SYSLOG_HOST, syslog_host.c_str(), - HUG_OPTION_SYSLOG_PORT, syslog_port, - HUG_OPTION_END); - } - else - { - status = hug_init(hugin_flags); - } - - if(status != HUG_STATUS_OK) - { - printf("Error: %d\n", status); - } - - INFO(vst, "We are up and running"); - - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - - pos = 0; - buffer = nullptr; - buffer_size = 0; - - output = nullptr; - input = nullptr; - drumgizmo = nullptr; - - output = new OutputVST(); - input = new InputVST(); - drumgizmo = new DrumGizmo(output, input); - - // initialize programs - // programs = new DrumGizmoVstProgram[kNumPrograms]; - // for(VstInt32 i = 0; i < 16; i++) channelPrograms[i] = i; - - // if(programs) setProgram(0); - - if(audioMaster) - { - setNumInputs(0); // no audio inputs - setNumOutputs(NUM_OUTPUTS); - canProcessReplacing(); - isSynth(); - - union - { - char cid[4]; - unsigned int iid; - } id; - - memcpy(id.cid, "DGV5", 4); // Four bytes typecasted into an unsigned integer - setUniqueID(id.iid); - - // setUniqueID((unsigned int)time(nullptr)); - } - - initProcess(); - suspend(); - - editor = new DGEditor(this); - setEditor(editor); - - programsAreChunks(true); - - // getChunk - // file:///home/deva/docs/c/drumgizmo/vst/vstsdk2.4/doc/html/class_audio_effect.html#42883c327783d7d31ed513b10c9204fc - - // setChunk - // file:///home/deva/docs/c/drumgizmo/vst/vstsdk2.4/doc/html/class_audio_effect.html#b6e4c31c1acf8d1fc4046521912787b1 -} - -DrumGizmoVst::~DrumGizmoVst() -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - - DEBUG(vst, "~DrumGizmoVst(1)\n"); - if(drumgizmo) - { - delete drumgizmo; - } - - DEBUG(vst, "~DrumGizmoVst(2)\n"); - if(input) - { - delete input; - } - - DEBUG(vst, "~DrumGizmoVst(3)\n"); - if(output) - { - delete output; - } - - DEBUG(vst, "~DrumGizmoVst(4)\n"); - - hug_close(); -} - -VstInt32 DrumGizmoVst::getChunk(void** data, bool isPreset) -{ - DEBUG(vst, "%s - data: %p isPreset: %d\n", - __PRETTY_FUNCTION__, *data, isPreset ? 1 : 0); - std::string cfg = drumgizmo->configString(); - DEBUG(vst, "drumgizmo->config := %s\n", cfg.c_str()); - char* config = strdup(cfg.c_str()); - *data = config; - return cfg.length(); -} - -VstInt32 DrumGizmoVst::setChunk(void* data, VstInt32 byteSize, bool isPreset) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - - std::string config; - config.append((const char*)data, (size_t)byteSize); - DEBUG(vst, "setChunk(isPreset: %d): [%d] %s\n", isPreset ? 1 : 0, byteSize, - config.c_str()); - - if(!drumgizmo->setConfigString(config)) - { - ERR(vst, "setConfigString failed...\n"); - return 1; - } - - return 0; -} - -void DrumGizmoVst::setProgram(VstInt32 program) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); -} -void DrumGizmoVst::setProgramName(char* name) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); -} -void DrumGizmoVst::getProgramName(char* name) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - name[0] = '\0'; -} - -void DrumGizmoVst::getParameterLabel(VstInt32 index, char* label) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - label[0] = '\0'; - /* - switch(index) - { - case kWaveform1: - case kWaveform2: - vst_strncpy(label, "Shape", kVstMaxParamStrLen); - break; - - case kFreq1: - case kFreq2: - vst_strncpy(label, "Hz", kVstMaxParamStrLen); - break; - - case kVolume1: - case kVolume2: - case kVolume: - vst_strncpy(label, "dB", kVstMaxParamStrLen); - break; - } - */ -} - -void DrumGizmoVst::getParameterDisplay(VstInt32 index, char* text) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - text[0] = 0; - /* - switch(index) - { - case kWaveform1: - if(fWaveform1 < .5) - vst_strncpy(text, "Sawtooth", kVstMaxParamStrLen); - else - vst_strncpy(text, "Pulse", kVstMaxParamStrLen); - break; - - case kFreq1: float2string(fFreq1, text, kVstMaxParamStrLen); - break; - case kVolume1: dB2string(fVolume1, text, kVstMaxParamStrLen); - break; - - case kWaveform2: - if(fWaveform2 < .5) - vst_strncpy(text, "Sawtooth", kVstMaxParamStrLen); - else - vst_strncpy(text, "Pulse", kVstMaxParamStrLen); - break; - - case kFreq2: float2string(fFreq2, text, kVstMaxParamStrLen); - break; - case kVolume2: dB2string(fVolume2, text, kVstMaxParamStrLen); - break; - case kVolume: dB2string(fVolume, text, kVstMaxParamStrLen); - break; - } - */ -} - -void DrumGizmoVst::getParameterName(VstInt32 index, char* label) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - /* - switch(index) - { - case kWaveform1: vst_strncpy(label, "Wave 1", kVstMaxParamStrLen); - break; - case kFreq1: vst_strncpy(label, "Freq 1", kVstMaxParamStrLen); - break; - case kVolume1: vst_strncpy(label, "Levl 1", kVstMaxParamStrLen); - break; - case kWaveform2: vst_strncpy(label, "Wave 2", kVstMaxParamStrLen); - break; - case kFreq2: vst_strncpy(label, "Freq 2", kVstMaxParamStrLen); - break; - case kVolume2: vst_strncpy(label, "Levl 2", kVstMaxParamStrLen); - break; - case kVolume: vst_strncpy(label, "Volume", kVstMaxParamStrLen); - break; - } - */ -} - -void DrumGizmoVst::setParameter(VstInt32 index, float value) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - /* - DrumGizmoVstProgram *ap = &programs[curProgram]; - switch(index) - { - case kWaveform1: fWaveform1 = ap->fWaveform1 = value; break; - case kFreq1: fFreq1 = ap->fFreq1 = value; break; - case kVolume1: fVolume1 = ap->fVolume1 = value; break; - case kWaveform2: fWaveform2 = ap->fWaveform2 = value; break; - case kFreq2: fFreq2 = ap->fFreq2 = value; break; - case kVolume2: fVolume2 = ap->fVolume2 = value; break; - case kVolume: fVolume = ap->fVolume = value; break; - } - */ -} - -float DrumGizmoVst::getParameter(VstInt32 index) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - float value = 0; - /* - switch(index) - { - case kWaveform1: value = fWaveform1; break; - case kFreq1: value = fFreq1; break; - case kVolume1: value = fVolume1; break; - case kWaveform2: value = fWaveform2; break; - case kFreq2: value = fFreq2; break; - case kVolume2: value = fVolume2; break; - case kVolume: value = fVolume; break; - } - */ - return value; -} - -bool DrumGizmoVst::getOutputProperties(VstInt32 index, - VstPinProperties* properties) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - if(index < NUM_OUTPUTS) - { - vst_strncpy(properties->label, "Channel ", 63); - char temp[11] = {0}; - int2string(index + 1, temp, 10); - vst_strncat(properties->label, temp, 63); - - properties->flags = kVstPinIsActive; - - return true; - } - return false; -} - -bool DrumGizmoVst::getProgramNameIndexed(VstInt32 category, VstInt32 index, - char* text) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - return false; -} - -bool DrumGizmoVst::getEffectName(char* name) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - vst_strncpy(name, "DrumGizmo4", kVstMaxEffectNameLen); - return true; -} - -bool DrumGizmoVst::getVendorString(char* text) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - vst_strncpy(text, "Aasimon.org", kVstMaxVendorStrLen); - return true; -} - -bool DrumGizmoVst::getProductString(char* text) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - vst_strncpy(text, "Vst Synth", kVstMaxProductStrLen); - return true; -} - -VstInt32 DrumGizmoVst::getVendorVersion() -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - return 1000; -} - -VstInt32 DrumGizmoVst::canDo(char* text) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - if(!strcmp(text, "receiveVstEvents")) - { - return 1; - } - - if(!strcmp(text, "receiveVstMidiEvent")) - { - return 1; - } - - // if(!strcmp(text, "midiProgramNames")) return 1; - return -1; // explicitly can't do; 0 => don't know -} - -VstInt32 DrumGizmoVst::getNumMidiInputChannels() -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - return 1; // we are monophonic -} - -VstInt32 DrumGizmoVst::getNumMidiOutputChannels() -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - return 0; // no MIDI output back to Host app -} - -VstInt32 DrumGizmoVst::getMidiProgramName(VstInt32 channel, - MidiProgramName* mpn) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - VstInt32 prg = mpn->thisProgramIndex; - if((prg < 0) || (prg >= 128)) - { - return 0; - } - - fillProgram(channel, prg, mpn); - if(channel == 9) - { - return 1; - } - - return 128L; -} - -VstInt32 DrumGizmoVst::getCurrentMidiProgram(VstInt32 channel, - MidiProgramName* mpn) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - if((channel < 0) || (channel >= 16) || !mpn) - { - return -1; - } - - VstInt32 prg = 0; - mpn->thisProgramIndex = prg; - fillProgram(channel, prg, mpn); - - return prg; -} - -void DrumGizmoVst::fillProgram(VstInt32 channel, VstInt32 prg, - MidiProgramName* mpn) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - mpn->midiBankMsb = mpn->midiBankLsb = -1; - mpn->reserved = 0; - mpn->flags = 0; - - vst_strncpy(mpn->name, "Standard", 63); - mpn->midiProgram = 0; - mpn->parentCategoryIndex = 0; -} - -VstInt32 DrumGizmoVst::getMidiProgramCategory(VstInt32 channel, - MidiProgramCategory* cat) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - cat->parentCategoryIndex = -1; // -1:no parent category - cat->flags = 0; // reserved, none defined yet, zero. - // VstInt32 category = cat->thisCategoryIndex; - vst_strncpy(cat->name, "Drums", 63); - return 1; -} - -bool DrumGizmoVst::hasMidiProgramsChanged(VstInt32 channel) -{ - return false; // updateDisplay() -} - -bool DrumGizmoVst::getMidiKeyName(VstInt32 channel, MidiKeyName* key) -// struct will be filled with information for 'thisProgramIndex' and -// 'thisKeyNumber' -// if keyName is "" the standard name of the key will be displayed. -// if false is returned, no MidiKeyNames defined for 'thisProgramIndex'. -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - // key->thisProgramIndex; // >= 0. fill struct for this program index. - // key->thisKeyNumber; // 0 - 127. fill struct for this key number. - key->keyName[0] = 0; - key->reserved = 0; // zero - key->flags = 0; // reserved, none defined yet, zero. - return false; -} - -void DrumGizmoVst::setSampleRate(float sampleRate) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - AudioEffectX::setSampleRate(sampleRate); - drumgizmo->setSamplerate(sampleRate); -} - -void DrumGizmoVst::setBlockSize(VstInt32 blockSize) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - AudioEffectX::setBlockSize(blockSize); -} - -void DrumGizmoVst::initProcess() -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - // drumgizmo->loadkit(getenv("DRUMGIZMO_DRUMKIT")); - drumgizmo->init(); -} - -void DrumGizmoVst::processReplacing(float** inputs, float** outputs, - VstInt32 sampleFrames) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - long lvl = getCurrentProcessLevel(); - // 0 = realtime/normal - // 1 = non-realtime/rendering - // 2 = offline processing - drumgizmo->setFreeWheel(lvl != 0); - - output->setOutputs(outputs); - - if(buffer_size != (size_t)sampleFrames) - { - if(buffer) - { - free(buffer); - } - - buffer_size = sampleFrames; - buffer = (sample_t*)malloc(sizeof(sample_t) * buffer_size); - - drumgizmo->setFrameSize(buffer_size); - } - - drumgizmo->run(pos, buffer, buffer_size); - - pos += sampleFrames; -} - -VstInt32 DrumGizmoVst::processEvents(VstEvents* ev) -{ - DEBUG(vst, "%s\n", __PRETTY_FUNCTION__); - input->processEvents(ev); - return 1; -} diff --git a/vst/drumgizmo_vst.h b/vst/drumgizmo_vst.h deleted file mode 100644 index dde4cbb..0000000 --- a/vst/drumgizmo_vst.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * drumgizmo_vst.h - * - * Tue Sep 20 08:22:48 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_DRUMGIZMO_VST_H__ -#define __DRUMGIZMO_DRUMGIZMO_VST_H__ - -#include <public.sdk/source/vst2.x/audioeffectx.h> -#include <public.sdk/source/vst2.x/aeffeditor.h> - -#include <drumgizmo.h> -#include <plugingui.h> - -#include "input_vst.h" -#include "output_vst.h" - -class DGEditor; - -class DrumGizmoVst : public AudioEffectX -{ -public: - DrumGizmoVst(audioMasterCallback audioMaster); - ~DrumGizmoVst(); - - void processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames); - VstInt32 processEvents(VstEvents* events); - - void setProgram(VstInt32 program); - void setProgramName(char* name); - void getProgramName(char* name); - bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text); - - void setParameter(VstInt32 index, float value); - float getParameter(VstInt32 index); - void getParameterLabel(VstInt32 index, char* label); - void getParameterDisplay(VstInt32 index, char* text); - void getParameterName(VstInt32 index, char* text); - - void setSampleRate(float sampleRate); - void setBlockSize(VstInt32 blockSize); - - bool getOutputProperties(VstInt32 index, VstPinProperties* properties); - - bool getEffectName(char* name); - bool getVendorString(char* text); - bool getProductString(char* text); - VstInt32 getVendorVersion(); - VstInt32 canDo(char* text); - - VstInt32 getNumMidiInputChannels(); - VstInt32 getNumMidiOutputChannels(); - - VstInt32 getMidiProgramName(VstInt32 channel, - MidiProgramName* midiProgramName); - VstInt32 getCurrentMidiProgram(VstInt32 channel, - MidiProgramName* currentProgram); - VstInt32 getMidiProgramCategory(VstInt32 channel, - MidiProgramCategory* category); - bool hasMidiProgramsChanged(VstInt32 channel); - bool getMidiKeyName(VstInt32 channel, MidiKeyName* keyName); - - VstInt32 getChunk(void **data, bool isPreset); - VstInt32 setChunk(void *data, VstInt32 byteSize, bool isPreset); - - DrumGizmo *drumgizmo; - InputVST *input; - OutputVST *output; - -private: - void initProcess(); - // void noteOn(VstInt32 note, VstInt32 velocity, VstInt32 delta); - // void noteOff(); - void fillProgram(VstInt32 channel, VstInt32 prg, MidiProgramName* mpn); - - size_t pos; - sample_t *buffer; - size_t buffer_size; - - DGEditor *editor; -}; - -class DGEditor : public AEffEditor { -public: - DGEditor(AudioEffect* effect); - - bool open(void* ptr); - void close(); - bool isOpen(); - void idle(); - -private: - DrumGizmoVst* dgeff; - GUI::PluginGUI *plugingui; - DrumGizmo *drumgizmo; -}; - -#endif/*__DRUMGIZMO_DRUMGIZMO_VST_H__*/ diff --git a/vst/input_vst.cc b/vst/input_vst.cc deleted file mode 100644 index 74ecb01..0000000 --- a/vst/input_vst.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * input_vst.cc - * - * Tue Sep 20 10:40:10 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "input_vst.h" - -#include <midimapparser.h> -#include <hugin.hpp> - -InputVST::InputVST() -{ - list = NULL; - listsize = 0; -} - -InputVST::~InputVST() -{ -} - -bool InputVST::init(Instruments &i) -{ - DEBUG(inputvst, "init\n"); - instruments = &i; - return true; -} - -void InputVST::setParm(std::string parm, std::string value) -{ -} - -bool InputVST::start() -{ - return true; -} - -void InputVST::stop() -{ -} - -void InputVST::pre() -{ -} - -event_t *InputVST::run(size_t pos, size_t len, size_t *nevents) -{ - *nevents = listsize; - return list; -} - -void InputVST::post() -{ - list = NULL; - listsize = 0; -} - -void InputVST::processEvents(VstEvents* ev) -{ - if(list == NULL) { - list = (event_t *)malloc(sizeof(event_t) * 1000); - // listsize = 0; - } - - for(VstInt32 i = 0; i < ev->numEvents; i++) { - if(ev->events[i]->type != kVstMidiType) continue; - - VstMidiEvent* event =(VstMidiEvent*)ev->events[i]; - char* midiData = event->midiData; - VstInt32 status = midiData[0] & 0xf0; // ignoring channel - if(status == 0x90) { // we only look at notes - VstInt32 note = midiData[1] & 0x7f; - VstInt32 velocity = midiData[2] & 0x7f; - - int i = mmap.lookup(note); - DEBUG(inputvst, "Note: %d -> %d\n", note, i); - if(velocity && i != -1) { - list[listsize].type = TYPE_ONSET; - list[listsize].instrument = i; - list[listsize].velocity = velocity / 127.0; - list[listsize].offset = event->deltaFrames; - listsize++; - } - - } - event++; - } -} diff --git a/vst/input_vst.h b/vst/input_vst.h deleted file mode 100644 index 88a6d06..0000000 --- a/vst/input_vst.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * input_vst.h - * - * Tue Sep 20 10:40:10 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_INPUT_VST_H__ -#define __DRUMGIZMO_INPUT_VST_H__ - -#include <audioinputenginemidi.h> - -#include <public.sdk/source/vst2.x/audioeffectx.h> - -class InputVST : public AudioInputEngineMidi { -public: - InputVST(); - virtual ~InputVST(); - - bool init(Instruments &instruments); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(); - event_t *run(size_t pos, size_t len, size_t *nevents); - void post(); - - void processEvents(VstEvents* ev); - -private: - event_t *list; - size_t listsize; - - Instruments *instruments; -}; - -#endif/*__DRUMGIZMO_INPUT_VST_H__*/ diff --git a/vst/output_vst.cc b/vst/output_vst.cc deleted file mode 100644 index 4a0d6d9..0000000 --- a/vst/output_vst.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * output_vst.cc - * - * Tue Sep 20 10:40:14 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "output_vst.h" - -#include <string.h> - -#include "constants.h" - -OutputVST::OutputVST() -{ - outputs = NULL; -} - -OutputVST::~OutputVST() -{ -} - -bool OutputVST::init(Channels channels) -{ - return true; -} - -void OutputVST::setParm(std::string parm, std::string value) -{ -} - -bool OutputVST::start() -{ - return true; -} - -void OutputVST::stop() -{ -} - -void OutputVST::pre(size_t nsamples) -{ - if(!outputs) return; - - for(size_t ch = 0; ch < NUM_OUTPUTS; ch++) { - memset(outputs[ch], 0, nsamples * sizeof(sample_t)); - } -} - -void OutputVST::run(int ch, sample_t *samples, size_t nsamples) -{ - if(!outputs) return; - - if(ch < NUM_OUTPUTS) { - memcpy(outputs[ch], samples, nsamples * sizeof(sample_t)); - } -} - -void OutputVST::post(size_t nsamples) -{ - outputs = NULL; -} - -void OutputVST::setOutputs(float **outputs) -{ - this->outputs = outputs; -} diff --git a/vst/output_vst.h b/vst/output_vst.h deleted file mode 100644 index 914e2e8..0000000 --- a/vst/output_vst.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * output_vst.h - * - * Tue Sep 20 10:40:14 CEST 2011 - * Copyright 2011 Bent Bisballe Nyeng - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of DrumGizmo. - * - * DrumGizmo 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 3 of the License, or - * (at your option) any later version. - * - * DrumGizmo 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 DrumGizmo; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#ifndef __DRUMGIZMO_OUTPUT_VST_H__ -#define __DRUMGIZMO_OUTPUT_VST_H__ - -#include <audiooutputengine.h> - -class OutputVST : public AudioOutputEngine { -public: - OutputVST(); - ~OutputVST(); - - bool init(Channels channels); - - void setParm(std::string parm, std::string value); - - bool start(); - void stop(); - - void pre(size_t nsamples); - void run(int ch, sample_t *samples, size_t nsamples); - void post(size_t nsamples); - - void setOutputs(float **outputs); - -private: - sample_t **outputs; -}; - -#endif/*__DRUMGIZMO_OUTPUT_VST_H__*/ |