Move ducker to separate directory

This commit is contained in:
2013-02-01 17:39:11 +00:00
parent 4d16160270
commit 60bbaac366
4 changed files with 31 additions and 0 deletions

24
ducker/Makefile Normal file
View File

@@ -0,0 +1,24 @@
CFLAGS := -Wall -O3 -g -D_GNU_SOURCE
LDFLAGS := -lm
CFLAGS += `pkg-config lv2core --cflags`
LDFLAGS += `pkg-config lv2core --libs`
DUCKERSRC := ducker.c
DUCKEROBJ := $(DUCKERSRC:.c=.o)
DUCKERO := ducker.so
all: $(DUCKERO)
clean:
rm $(DUCKEROBJ) $(DUCKERO)
depend:
makedepend $(DUCKERSRC)
$(DUCKERO): $(DUCKEROBJ)
$(CC) -shared -fPIC -Wl,-soname,$(DUCKERO) $(DUCKEROBJ) -o $@
.c.o:
$(CC) -c -fPIC $(CFLAGS) $< -o $@

90
ducker/ducker.c Normal file
View File

@@ -0,0 +1,90 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <lv2.h>
struct ducker
{
double sample_rate;
float on_factor;
float off_factor;
float *in_main_l;
float *in_main_r;
float *in_aux_l;
float *in_aux_r;
float *out_l;
float *out_r;
};
static LV2_Handle ducker_instantiate(
const LV2_Descriptor *descriptor,
double sample_rate,
const char *bundle_path,
const LV2_Feature *const *host_features)
{
/* Allocate local data */
struct ducker *d = malloc(sizeof *d);
if (d == NULL) {
return NULL;
}
memset(d, 0, sizeof *d);
d->sample_rate = sample_rate;
d->on_factor = 0.0006f * 44100.0f / sample_rate;
d->off_factor = 0.00028f * 44100.0f / sample_rate;
return (LV2_Handle)d;
}
static void ducker_connect_port(LV2_Handle lv2instance, uint32_t port, void *data)
{
struct ducker *d = (struct ducker *)lv2instance;
/* Audio ports */
switch (port) {
case 0: d->in_main_l = data; break;
case 1: d->in_main_r = data; break;
case 2: d->in_aux_l = data; break;
case 3: d->in_aux_r = data; break;
case 4: d->out_l = data; break;
case 5: d->out_r = data; break;
}
}
static void ducker_run(LV2_Handle lv2instance, uint32_t sample_count)
{
struct ducker *d = (struct ducker *)lv2instance;
while (sample_count--) {
}
}
static void ducker_cleanup(LV2_Handle lv2instance)
{
struct ducker *d = (struct ducker *)lv2instance;
free(d);
}
static const LV2_Descriptor s_lv2descriptor =
{
.URI = "http://fuzzle.org/~petern/ducker/1",
.instantiate = &ducker_instantiate,
.connect_port = &ducker_connect_port,
.run = &ducker_run,
.cleanup = &ducker_cleanup,
};
const LV2_Descriptor *lv2_descriptor(uint32_t index)
{
if (index == 0) {
return &s_lv2descriptor;
}
return NULL;
}

66
ducker/ducker.ttl Normal file
View File

@@ -0,0 +1,66 @@
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> .
<http://fuzzle.org/~petern/ptap/1>
a lv2:Plugin;
doap:maintainer [
foaf:name "Peter Nelson";
foaf:homepage <http://fuzzle.org/~petern/ptap/>;
foaf:mbox <mailto:peter@fuzzle.org>;
];
doap:name "PTap";
doap:license <http://usefulinc.com/doap/licenses/gpl>;
lv2:port [
a lv2:InputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 0;
lv2:symbol "in L";
lv2:name "Main Input L";
],
[
a lv2:InputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 1;
lv2:symbol "in R";
lv2:name "Main Input R";
],
[
a lv2:InputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 2;
lv2:symbol "aux L";
lv2:name "Aux Input R";
],
[
a lv2:InputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 3;
lv2:symbol "aux R";
lv2:name "Aux Input R";
],
[
a lv2:OutputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 4;
lv2:symbol "out L";
lv2:name "Output L";
],
[
a lv2:OutputPort, lv2:AudioPort;
lv2:datatype lv2:float;
lv2:index 5;
lv2:symbol "out R";
lv2:name "Output R";
],
[
a lv2:InputPort, lv2:ControlPort;
lv2:index 4;
lv2:symbol "t1_1_gain";
lv2:name "Tap 1_1 Gain";
lv2:minimum 0;
lv2:default 0;
lv2:maximum 1;
].

7
ducker/manifest.ttl Normal file
View File

@@ -0,0 +1,7 @@
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://fuzzle.org/~petern/ptap/1>
a lv2:Plugin, lv2:DelayPlugin;
lv2:binary <ptap.so>;
rdfs:seeAlso <ptap.ttl>.