Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add separate Vibrato/Chorus LV2 plugin
- Loading branch information
Showing
6 changed files
with
336 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| include ../common.mak | ||
| include ../git2lv2.mk | ||
|
|
||
| LOADLIBES = -lm | ||
| override CFLAGS+= -I../src | ||
| override CFLAGS+=`pkg-config --cflags lv2` -fvisibility=hidden | ||
|
|
||
| targets= | ||
|
|
||
| LV2NAME=b_chorato | ||
|
|
||
| ifeq ($(LV2AVAIL), yes) | ||
| targets+=lv2 | ||
| endif | ||
|
|
||
| all: $(targets) | ||
|
|
||
| lv2: manifest.ttl $(LV2NAME)$(LIB_EXT) $(LV2NAME).ttl | ||
|
|
||
| manifest.ttl: | ||
| sed "s/@LV2NAME@/$(LV2NAME)/;s/@LIB_EXT@/$(LIB_EXT)/" manifest.ttl.in > manifest.ttl | ||
|
|
||
| $(LV2NAME).ttl: $(LV2NAME).ttl.in Makefile | ||
| sed "s/@VERSION@/lv2:microVersion $(LV2MIC) ;lv2:minorVersion $(LV2MIN) ;/g" \ | ||
| $(LV2NAME).ttl.in > $(LV2NAME).ttl | ||
|
|
||
| $(LV2NAME)$(LIB_EXT): lv2.c ../src/vibrato.c ../src/vibrato.h | ||
| $(CC) $(CPPFLAGS) $(CFLAGS) \ | ||
| -o $(LV2NAME)$(LIB_EXT) lv2.c ../src/vibrato.c \ | ||
| -shared $(LV2LDFLAGS) $(LDFLAGS) | ||
|
|
||
| install: $(targets) | ||
| ifeq ($(LV2AVAIL), yes) | ||
| install -d $(DESTDIR)$(lv2dir)/$(LV2NAME) | ||
| install -m755 $(LV2NAME)$(LIB_EXT) $(DESTDIR)$(lv2dir)/$(LV2NAME) | ||
| install -m644 manifest.ttl $(LV2NAME).ttl $(DESTDIR)$(lv2dir)/$(LV2NAME) | ||
| endif | ||
|
|
||
| uninstall: | ||
| rm -f $(DESTDIR)$(lv2dir)/$(LV2NAME)/*.ttl | ||
| rm -f $(DESTDIR)$(lv2dir)/$(LV2NAME)/$(LV2NAME)$(LIB_EXT) | ||
| -rmdir $(DESTDIR)$(lv2dir)/$(LV2NAME) | ||
|
|
||
| clean: | ||
| rm -f *.o manifest.ttl $(LV2NAME)$(LIB_EXT) $(LV2NAME).ttl | ||
|
|
||
| .PHONY: clean all install uninstall lv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| @prefix doap: <http://usefulinc.com/ns/doap#> . | ||
| @prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | ||
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
| @prefix units: <http://lv2plug.in/ns/extensions/units#> . | ||
|
|
||
| <http://gareus.org/rgareus#me> | ||
| a foaf:Person ; | ||
| foaf:name "Robin Gareus" ; | ||
| foaf:mbox <mailto:robin@gareus.org> ; | ||
| foaf:homepage <http://gareus.org/> . | ||
|
|
||
| <http://gareus.org/oss/lv2/b_chorato> | ||
| a doap:Project, lv2:Plugin, lv2:SpatialPlugin ; | ||
| doap:maintainer <http://gareus.org/rgareus#me> ; | ||
| doap:name "setBfree Chorus/Vibrato"; | ||
| doap:license <http://usefulinc.com/doap/licenses/gpl> ; | ||
| @VERSION@ | ||
| lv2:optionalFeature lv2:hardRTCapable ; | ||
| lv2:port | ||
| [ | ||
| a lv2:AudioPort , | ||
| lv2:InputPort ; | ||
| lv2:index 0 ; | ||
| lv2:symbol "in" ; | ||
| lv2:name "In" | ||
| ], | ||
| [ | ||
| a lv2:AudioPort , | ||
| lv2:OutputPort ; | ||
| lv2:index 1 ; | ||
| lv2:symbol "out" ; | ||
| lv2:name "Out" | ||
| ], | ||
| [ | ||
| a lv2:InputPort , | ||
| lv2:ControlPort ; | ||
| lv2:index 2 ; | ||
| lv2:symbol "mode" ; | ||
| lv2:name "Vibrato/Chorus Modulation"; | ||
| lv2:portProperty lv2:integer, lv2:enumeration ; | ||
| lv2:default 0; | ||
| lv2:minimum 0; | ||
| lv2:maximum 5; | ||
| lv2:scalePoint [ rdfs:label "V1"; rdf:value 0 ; ] ; | ||
| lv2:scalePoint [ rdfs:label "C1"; rdf:value 1 ; ] ; | ||
| lv2:scalePoint [ rdfs:label "V2"; rdf:value 2 ; ] ; | ||
| lv2:scalePoint [ rdfs:label "C2"; rdf:value 3 ; ] ; | ||
| lv2:scalePoint [ rdfs:label "V3"; rdf:value 4 ; ] ; | ||
| lv2:scalePoint [ rdfs:label "C3"; rdf:value 5 ; ] ; | ||
| ], | ||
| [ | ||
| a lv2:InputPort , | ||
| lv2:ControlPort ; | ||
| lv2:index 3 ; | ||
| lv2:symbol "Speed" ; | ||
| lv2:name "Frequency of the scanner"; | ||
| units:unit units:hz; | ||
| lv2:default 7.5; | ||
| lv2:minimum 2; | ||
| lv2:maximum 20; | ||
| ] ; | ||
| . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| /* setBfree - Chorus/Vibrato Plugin | ||
| * | ||
| * Copyright (C) 2018 Robin Gareus <robin@gareus.org> | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 2, or (at your option) | ||
| * any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #include <math.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
|
|
||
| #include "vibrato.h" | ||
|
|
||
| double SampleRateD = 48000.0; // global | ||
|
|
||
| #include "lv2/lv2plug.in/ns/lv2core/lv2.h" | ||
|
|
||
| #define B3V_URI "http://gareus.org/oss/lv2/b_chorato" | ||
|
|
||
| typedef enum { | ||
| B3V_INPUT = 0, | ||
| B3V_OUTPUT, | ||
| B3V_MODE, | ||
| B3V_FREQ, | ||
| } PortIndex; | ||
|
|
||
| typedef struct { | ||
| float* input; | ||
| float* output; | ||
| float* mode; | ||
| float* freq; | ||
| struct b_vibrato* instance; | ||
| } B3V; | ||
|
|
||
| static LV2_Handle | ||
| instantiate (const LV2_Descriptor* descriptor, | ||
| double rate, | ||
| const char* bundle_path, | ||
| const LV2_Feature* const* features) | ||
| { | ||
| B3V* b3v = (B3V*)calloc (1, sizeof (B3V)); | ||
| if (!b3v) { | ||
| return NULL; | ||
| } | ||
|
|
||
| b3v->instance = (struct b_vibrato*)calloc (1, sizeof (struct b_vibrato)); | ||
| if (!b3v->instance) { | ||
| free (b3v); | ||
| return NULL; | ||
| } | ||
|
|
||
| SampleRateD = rate; | ||
| reset_vibrato (b3v->instance); | ||
| init_vibrato (b3v->instance); | ||
|
|
||
| return (LV2_Handle)b3v; | ||
| } | ||
|
|
||
| static void | ||
| connect_port (LV2_Handle instance, | ||
| uint32_t port, | ||
| void* data) | ||
| { | ||
| B3V* b3v = (B3V*)instance; | ||
|
|
||
| switch ((PortIndex)port) { | ||
| case B3V_INPUT: | ||
| b3v->input = (float*)data; | ||
| break; | ||
| case B3V_OUTPUT: | ||
| b3v->output = (float*)data; | ||
| break; | ||
| case B3V_MODE: | ||
| b3v->mode = (float*)data; | ||
| break; | ||
| case B3V_FREQ: | ||
| b3v->freq = (float*)data; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| static void | ||
| activate (LV2_Handle instance) | ||
| { | ||
| } | ||
|
|
||
| static void | ||
| run (LV2_Handle instance, uint32_t n_samples) | ||
| { | ||
| B3V* b3v = (B3V*)instance; | ||
| struct b_vibrato* v = b3v->instance; | ||
|
|
||
| int mode = rint (*(b3v->mode)); | ||
| switch (mode) { | ||
| default: | ||
| case 0: | ||
| case 1: | ||
| v->offsetTable = v->offset1Table; | ||
| break; | ||
| case 2: | ||
| case 3: | ||
| v->offsetTable = v->offset2Table; | ||
| break; | ||
| case 4: | ||
| case 5: | ||
| v->offsetTable = v->offset3Table; | ||
| break; | ||
| } | ||
| v->effectEnabled = 1; | ||
| v->mixedBuffers = mode & 1; /* chorus */ | ||
|
|
||
| v->vibFqHertz = *(b3v->freq); | ||
| v->statorIncrement = | ||
| (unsigned int)(((v->vibFqHertz * INCTBL_SIZE) / SampleRateD) * 65536.0); | ||
|
|
||
| vibratoProc (v, b3v->input, b3v->output, n_samples); | ||
| } | ||
|
|
||
| static void | ||
| deactivate (LV2_Handle instance) | ||
| { | ||
| } | ||
|
|
||
| static void | ||
| cleanup (LV2_Handle instance) | ||
| { | ||
| B3V* b3v = (B3V*)instance; | ||
| free (b3v->instance); | ||
| free (instance); | ||
| } | ||
|
|
||
| const void* | ||
| extension_data (const char* uri) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static const LV2_Descriptor descriptor = { | ||
| B3V_URI, | ||
| instantiate, | ||
| connect_port, | ||
| activate, | ||
| run, | ||
| deactivate, | ||
| cleanup, | ||
| extension_data | ||
| }; | ||
|
|
||
| // fix for -fvisibility=hidden | ||
| #undef LV2_SYMBOL_EXPORT | ||
| #ifdef _WIN32 | ||
| #define LV2_SYMBOL_EXPORT __declspec(dllexport) | ||
| #else | ||
| #define LV2_SYMBOL_EXPORT __attribute__ ((visibility ("default"))) | ||
| #endif | ||
|
|
||
| LV2_SYMBOL_EXPORT | ||
| const LV2_Descriptor* | ||
| lv2_descriptor (uint32_t index) | ||
| { | ||
| switch (index) { | ||
| case 0: | ||
| return &descriptor; | ||
| default: | ||
| return NULL; | ||
| } | ||
| } | ||
|
|
||
| #include <assert.h> | ||
|
|
||
| void | ||
| setVibratoLower (void* t, int isEnabled) | ||
| { | ||
| assert (0); | ||
| } | ||
| void | ||
| setVibratoUpper (void* t, int isEnabled) | ||
| { | ||
| assert (0); | ||
| } | ||
| int | ||
| getVibratoRouting (void* t) | ||
| { | ||
| assert (0); | ||
| return 0; | ||
| } | ||
| void | ||
| notifyControlChangeByName (void* mcfg, const char* cfname, unsigned char val) | ||
| { | ||
| } | ||
| void | ||
| useMIDIControlFunction (void* m, const char* cfname, void (*f) (void* d, unsigned char), void* d) | ||
| { | ||
| } | ||
| int | ||
| getConfigParameter_dr (const char* par, ConfigContext* cfg, double* dp, double lowInc, double highInc) | ||
| { | ||
| return 0; | ||
| } | ||
| int | ||
| getConfigParameter_d (const char* par, ConfigContext* cfg, double* dp) | ||
| { | ||
| return 0; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| @prefix lv2: <http://lv2plug.in/ns/lv2core#> . | ||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
|
|
||
| <http://gareus.org/oss/lv2/b_chorato> | ||
| a lv2:Plugin ; | ||
| lv2:binary <b_chorato@LIB_EXT@> ; | ||
| rdfs:seeAlso <b_chorato.ttl> . |