mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
a-comp: Add stereo version
This commit is contained in:
parent
b27d9bb02a
commit
46bfe2b51a
5 changed files with 448 additions and 61 deletions
157
libs/plugins/a-comp.lv2/a-comp#stereo.ttl.in
Normal file
157
libs/plugins/a-comp.lv2/a-comp#stereo.ttl.in
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
||||||
|
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
||||||
|
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
@prefix rsz: <http://lv2plug.in/ns/ext/resize-port#> .
|
||||||
|
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
|
||||||
|
@prefix unit: <http://lv2plug.in/ns/extensions/units#> .
|
||||||
|
|
||||||
|
<http://ardour.org/credits.html>
|
||||||
|
a foaf:Person ;
|
||||||
|
foaf:name "Ardour Team" ;
|
||||||
|
foaf:homepage <http://ardour.org/> .
|
||||||
|
|
||||||
|
<urn:ardour:a-comp#stereo>
|
||||||
|
a lv2:Plugin, doap:Project, lv2:CompressorPlugin ;
|
||||||
|
|
||||||
|
lv2:optionalFeature <http://lv2plug.in/ns/lv2core#hardRTCapable>;
|
||||||
|
|
||||||
|
lv2:port [
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 0 ;
|
||||||
|
lv2:name "Attack" ;
|
||||||
|
lv2:symbol "att" ;
|
||||||
|
lv2:default 10.000000 ;
|
||||||
|
lv2:minimum 0.100000 ;
|
||||||
|
lv2:maximum 100.000000 ;
|
||||||
|
unit:unit unit:ms ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 1 ;
|
||||||
|
lv2:name "Release" ;
|
||||||
|
lv2:symbol "rel" ;
|
||||||
|
lv2:default 80.000000 ;
|
||||||
|
lv2:minimum 1.000000 ;
|
||||||
|
lv2:maximum 500.000000 ;
|
||||||
|
unit:unit unit:ms ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 2 ;
|
||||||
|
lv2:name "Knee" ;
|
||||||
|
lv2:symbol "kn" ;
|
||||||
|
lv2:default 0.000000 ;
|
||||||
|
lv2:minimum 0.000000 ;
|
||||||
|
lv2:maximum 8.000000 ;
|
||||||
|
unit:unit unit:db ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 3 ;
|
||||||
|
lv2:name "Ratio" ;
|
||||||
|
lv2:symbol "rat" ;
|
||||||
|
lv2:default 4.000000 ;
|
||||||
|
lv2:minimum 1.000000 ;
|
||||||
|
lv2:maximum 20.000000 ;
|
||||||
|
unit:unit [
|
||||||
|
rdfs:label " " ;
|
||||||
|
unit:symbol " " ;
|
||||||
|
unit:render "%f " ;
|
||||||
|
] ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 4 ;
|
||||||
|
lv2:name "Threshold" ;
|
||||||
|
lv2:symbol "thr" ;
|
||||||
|
lv2:default 0.000000 ;
|
||||||
|
lv2:minimum -60.000000 ;
|
||||||
|
lv2:maximum 0.000000 ;
|
||||||
|
unit:unit unit:db ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 5 ;
|
||||||
|
lv2:name "Makeup" ;
|
||||||
|
lv2:symbol "mak" ;
|
||||||
|
lv2:default 0.000000 ;
|
||||||
|
lv2:minimum 0.000000 ;
|
||||||
|
lv2:maximum 30.000000 ;
|
||||||
|
unit:unit unit:db ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:OutputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 6 ;
|
||||||
|
lv2:name "Gain Reduction" ;
|
||||||
|
lv2:symbol "gr" ;
|
||||||
|
lv2:default 0.000000 ;
|
||||||
|
lv2:minimum 0.000000 ;
|
||||||
|
lv2:maximum 45.000000 ;
|
||||||
|
unit:unit unit:db ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:OutputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 7 ;
|
||||||
|
lv2:name "Output Level" ;
|
||||||
|
lv2:symbol "outlevel" ;
|
||||||
|
lv2:default -45.000000 ;
|
||||||
|
lv2:minimum -45.000000 ;
|
||||||
|
lv2:maximum 0.000000 ;
|
||||||
|
unit:unit unit:db ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
|
lv2:index 8 ;
|
||||||
|
lv2:name "Sidechain" ;
|
||||||
|
lv2:symbol "sidech" ;
|
||||||
|
lv2:default 0.000000 ;
|
||||||
|
lv2:minimum 0.000000 ;
|
||||||
|
lv2:maximum 1.000000 ;
|
||||||
|
lv2:portProperty lv2:toggled ;
|
||||||
|
] ;
|
||||||
|
|
||||||
|
lv2:port [
|
||||||
|
a lv2:InputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 9 ;
|
||||||
|
lv2:symbol "in_1" ;
|
||||||
|
lv2:name "Audio Input 1" ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 10 ;
|
||||||
|
lv2:symbol "in_2" ;
|
||||||
|
lv2:name "Audio Input 2" ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 11 ;
|
||||||
|
lv2:symbol "sidechain_in" ;
|
||||||
|
lv2:name "Sidechain Input" ;
|
||||||
|
lv2:portProperty lv2:isSideChain;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
a lv2:OutputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 12 ;
|
||||||
|
lv2:symbol "out_1" ;
|
||||||
|
lv2:name "Audio Output 1" ;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
a lv2:OutputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 13 ;
|
||||||
|
lv2:symbol "out_2" ;
|
||||||
|
lv2:name "Audio Output 2" ;
|
||||||
|
] ;
|
||||||
|
|
||||||
|
rdfs:comment """
|
||||||
|
A powerful stereo compressor.
|
||||||
|
""" ;
|
||||||
|
|
||||||
|
doap:name "a-comp stereo" ;
|
||||||
|
doap:license "GPL v2+" ;
|
||||||
|
doap:maintainer <http://ardour.org/credits.html>
|
||||||
|
|
||||||
|
# ui:ui <urn:ardour:a-comp#ui>;
|
||||||
|
|
||||||
|
lv2:microVersion 1 ;
|
||||||
|
lv2:minorVersion 1 .
|
||||||
|
|
@ -25,13 +25,10 @@
|
||||||
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
|
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
|
||||||
|
|
||||||
#define ACOMP_URI "urn:ardour:a-comp"
|
#define ACOMP_URI "urn:ardour:a-comp"
|
||||||
|
#define ACOMP_STEREO_URI "urn:ardour:a-comp#stereo"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ACOMP_INPUT0 = 0,
|
ACOMP_ATTACK = 0,
|
||||||
ACOMP_INPUT1,
|
|
||||||
ACOMP_OUTPUT,
|
|
||||||
|
|
||||||
ACOMP_ATTACK,
|
|
||||||
ACOMP_RELEASE,
|
ACOMP_RELEASE,
|
||||||
ACOMP_KNEE,
|
ACOMP_KNEE,
|
||||||
ACOMP_RATIO,
|
ACOMP_RATIO,
|
||||||
|
|
@ -41,14 +38,32 @@ typedef enum {
|
||||||
ACOMP_GAINR,
|
ACOMP_GAINR,
|
||||||
ACOMP_OUTLEVEL,
|
ACOMP_OUTLEVEL,
|
||||||
ACOMP_SIDECHAIN,
|
ACOMP_SIDECHAIN,
|
||||||
} PortIndex;
|
|
||||||
|
|
||||||
|
ACOMP_INPUT,
|
||||||
|
ACOMP_SC,
|
||||||
|
ACOMP_OUTPUT,
|
||||||
|
} PortIndexMono;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ACOMP_STEREO_ATTACK = 0,
|
||||||
|
ACOMP_STEREO_RELEASE,
|
||||||
|
ACOMP_STEREO_KNEE,
|
||||||
|
ACOMP_STEREO_RATIO,
|
||||||
|
ACOMP_STEREO_THRESHOLD,
|
||||||
|
ACOMP_STEREO_MAKEUP,
|
||||||
|
|
||||||
|
ACOMP_STEREO_GAINR,
|
||||||
|
ACOMP_STEREO_OUTLEVEL,
|
||||||
|
ACOMP_STEREO_SIDECHAIN,
|
||||||
|
|
||||||
|
ACOMP_STEREO_INPUT0,
|
||||||
|
ACOMP_STEREO_INPUT1,
|
||||||
|
ACOMP_STEREO_SC,
|
||||||
|
ACOMP_STEREO_OUTPUT0,
|
||||||
|
ACOMP_STEREO_OUTPUT1,
|
||||||
|
} PortIndexStereo;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float* input0;
|
|
||||||
float* input1;
|
|
||||||
float* output;
|
|
||||||
|
|
||||||
float* attack;
|
float* attack;
|
||||||
float* release;
|
float* release;
|
||||||
float* knee;
|
float* knee;
|
||||||
|
|
@ -60,6 +75,12 @@ typedef struct {
|
||||||
float* outlevel;
|
float* outlevel;
|
||||||
float* sidechain;
|
float* sidechain;
|
||||||
|
|
||||||
|
float* input0;
|
||||||
|
float* input1;
|
||||||
|
float* sc;
|
||||||
|
float* output0;
|
||||||
|
float* output1;
|
||||||
|
|
||||||
float srate;
|
float srate;
|
||||||
float old_yl;
|
float old_yl;
|
||||||
float old_y1;
|
float old_y1;
|
||||||
|
|
@ -108,14 +129,15 @@ instantiate(const LV2_Descriptor* descriptor,
|
||||||
return (LV2_Handle)acomp;
|
return (LV2_Handle)acomp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
connect_port(LV2_Handle instance,
|
connect_port_mono(LV2_Handle instance,
|
||||||
uint32_t port,
|
uint32_t port,
|
||||||
void* data)
|
void* data)
|
||||||
{
|
{
|
||||||
AComp* acomp = (AComp*)instance;
|
AComp* acomp = (AComp*)instance;
|
||||||
|
|
||||||
switch ((PortIndex)port) {
|
switch ((PortIndexMono)port) {
|
||||||
case ACOMP_ATTACK:
|
case ACOMP_ATTACK:
|
||||||
acomp->attack = (float*)data;
|
acomp->attack = (float*)data;
|
||||||
break;
|
break;
|
||||||
|
|
@ -143,14 +165,67 @@ connect_port(LV2_Handle instance,
|
||||||
case ACOMP_SIDECHAIN:
|
case ACOMP_SIDECHAIN:
|
||||||
acomp->sidechain = (float*)data;
|
acomp->sidechain = (float*)data;
|
||||||
break;
|
break;
|
||||||
case ACOMP_INPUT0:
|
case ACOMP_INPUT:
|
||||||
acomp->input0 = (float*)data;
|
acomp->input0 = (float*)data;
|
||||||
break;
|
break;
|
||||||
case ACOMP_INPUT1:
|
case ACOMP_SC:
|
||||||
acomp->input1 = (float*)data;
|
acomp->sc = (float*)data;
|
||||||
break;
|
break;
|
||||||
case ACOMP_OUTPUT:
|
case ACOMP_OUTPUT:
|
||||||
acomp->output = (float*)data;
|
acomp->output0 = (float*)data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
connect_port_stereo(LV2_Handle instance,
|
||||||
|
uint32_t port,
|
||||||
|
void* data)
|
||||||
|
{
|
||||||
|
AComp* acomp = (AComp*)instance;
|
||||||
|
|
||||||
|
switch ((PortIndexStereo)port) {
|
||||||
|
case ACOMP_STEREO_ATTACK:
|
||||||
|
acomp->attack = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_RELEASE:
|
||||||
|
acomp->release = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_KNEE:
|
||||||
|
acomp->knee = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_RATIO:
|
||||||
|
acomp->ratio = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_THRESHOLD:
|
||||||
|
acomp->thresdb = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_MAKEUP:
|
||||||
|
acomp->makeup = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_GAINR:
|
||||||
|
acomp->gainr = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_OUTLEVEL:
|
||||||
|
acomp->outlevel = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_SIDECHAIN:
|
||||||
|
acomp->sidechain = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_INPUT0:
|
||||||
|
acomp->input0 = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_INPUT1:
|
||||||
|
acomp->input1 = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_SC:
|
||||||
|
acomp->sc = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_OUTPUT0:
|
||||||
|
acomp->output0 = (float*)data;
|
||||||
|
break;
|
||||||
|
case ACOMP_STEREO_OUTPUT1:
|
||||||
|
acomp->output1 = (float*)data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,13 +260,13 @@ activate(LV2_Handle instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run(LV2_Handle instance, uint32_t n_samples)
|
run_mono(LV2_Handle instance, uint32_t n_samples)
|
||||||
{
|
{
|
||||||
AComp* acomp = (AComp*)instance;
|
AComp* acomp = (AComp*)instance;
|
||||||
|
|
||||||
const float* const input0 = acomp->input0;
|
const float* const input = acomp->input0;
|
||||||
const float* const input1 = acomp->input1;
|
const float* const sc = acomp->sc;
|
||||||
float* const output = acomp->output;
|
float* const output = acomp->output0;
|
||||||
|
|
||||||
float srate = acomp->srate;
|
float srate = acomp->srate;
|
||||||
float width = (6.f * *(acomp->knee)) + 0.01;
|
float width = (6.f * *(acomp->knee)) + 0.01;
|
||||||
|
|
@ -207,7 +282,7 @@ run(LV2_Handle instance, uint32_t n_samples)
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
float ingain;
|
float ingain;
|
||||||
float in0;
|
float in0;
|
||||||
float in1;
|
float sc0;
|
||||||
float ratio = *(acomp->ratio);
|
float ratio = *(acomp->ratio);
|
||||||
float thresdb = *(acomp->thresdb);
|
float thresdb = *(acomp->thresdb);
|
||||||
|
|
||||||
|
|
@ -231,9 +306,9 @@ run(LV2_Handle instance, uint32_t n_samples)
|
||||||
float in_peak = 0;
|
float in_peak = 0;
|
||||||
|
|
||||||
for (i = 0; i < n_samples; i++) {
|
for (i = 0; i < n_samples; i++) {
|
||||||
in0 = input0[i];
|
in0 = input[i];
|
||||||
in1 = input1[i];
|
sc0 = sc[i];
|
||||||
ingain = usesidechain ? in1 : in0;
|
ingain = usesidechain ? sc0 : in0;
|
||||||
Lyg = 0.f;
|
Lyg = 0.f;
|
||||||
Lxg = (ingain==0.f) ? -160.f : to_dB(fabs(ingain));
|
Lxg = (ingain==0.f) ? -160.f : to_dB(fabs(ingain));
|
||||||
Lxg = sanitize_denormal(Lxg);
|
Lxg = sanitize_denormal(Lxg);
|
||||||
|
|
@ -295,6 +370,124 @@ run(LV2_Handle instance, uint32_t n_samples)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
run_stereo(LV2_Handle instance, uint32_t n_samples)
|
||||||
|
{
|
||||||
|
AComp* acomp = (AComp*)instance;
|
||||||
|
|
||||||
|
const float* const input0 = acomp->input0;
|
||||||
|
const float* const input1 = acomp->input1;
|
||||||
|
const float* const sc = acomp->sc;
|
||||||
|
float* const output0 = acomp->output0;
|
||||||
|
float* const output1 = acomp->output1;
|
||||||
|
|
||||||
|
float srate = acomp->srate;
|
||||||
|
float width = (6.f * *(acomp->knee)) + 0.01;
|
||||||
|
float cdb=0.f;
|
||||||
|
float attack_coeff = exp(-1000.f/(*(acomp->attack) * srate));
|
||||||
|
float release_coeff = exp(-1000.f/(*(acomp->release) * srate));
|
||||||
|
|
||||||
|
float max = 0.f;
|
||||||
|
float lgaininp = 0.f;
|
||||||
|
float rgaininp = 0.f;
|
||||||
|
float Lgain = 1.f;
|
||||||
|
float Lxg, Lxl, Lyg, Lyl, Ly1;
|
||||||
|
int usesidechain = (*(acomp->sidechain) < 0.5) ? 0 : 1;
|
||||||
|
uint32_t i;
|
||||||
|
float ingain;
|
||||||
|
float in0;
|
||||||
|
float in1;
|
||||||
|
float sc0;
|
||||||
|
float ratio = *(acomp->ratio);
|
||||||
|
float thresdb = *(acomp->thresdb);
|
||||||
|
|
||||||
|
#ifdef LV2_EXTENDED
|
||||||
|
if (acomp->v_knee != *acomp->knee) {
|
||||||
|
acomp->v_knee = *acomp->knee;
|
||||||
|
acomp->need_expose = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acomp->v_ratio != *acomp->ratio) {
|
||||||
|
acomp->v_ratio = *acomp->ratio;
|
||||||
|
acomp->need_expose = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acomp->v_thresdb != *acomp->thresdb) {
|
||||||
|
acomp->v_thresdb = *acomp->thresdb;
|
||||||
|
acomp->need_expose = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float in_peak = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < n_samples; i++) {
|
||||||
|
in0 = input0[i];
|
||||||
|
in1 = input1[i];
|
||||||
|
sc0 = sc[i];
|
||||||
|
ingain = usesidechain ? fabs(sc0) : fmaxf(fabs(in0), fabs(in1));
|
||||||
|
Lyg = 0.f;
|
||||||
|
Lxg = (ingain==0.f) ? -160.f : to_dB(ingain);
|
||||||
|
Lxg = sanitize_denormal(Lxg);
|
||||||
|
|
||||||
|
Lyg = Lxg + (1.f/ratio-1.f)*(Lxg-thresdb+width/2.f)*(Lxg-thresdb+width/2.f)/(2.f*width);
|
||||||
|
|
||||||
|
if (2.f*(Lxg-thresdb) < -width) {
|
||||||
|
Lyg = Lxg;
|
||||||
|
} else {
|
||||||
|
Lyg = thresdb + (Lxg-thresdb)/ratio;
|
||||||
|
Lyg = sanitize_denormal(Lyg);
|
||||||
|
}
|
||||||
|
|
||||||
|
Lxl = Lxg - Lyg;
|
||||||
|
|
||||||
|
acomp->old_y1 = sanitize_denormal(acomp->old_y1);
|
||||||
|
acomp->old_yl = sanitize_denormal(acomp->old_yl);
|
||||||
|
Ly1 = fmaxf(Lxl, release_coeff * acomp->old_y1+(1.f-release_coeff)*Lxl);
|
||||||
|
Lyl = attack_coeff * acomp->old_yl+(1.f-attack_coeff)*Ly1;
|
||||||
|
Ly1 = sanitize_denormal(Ly1);
|
||||||
|
Lyl = sanitize_denormal(Lyl);
|
||||||
|
|
||||||
|
cdb = -Lyl;
|
||||||
|
Lgain = from_dB(cdb);
|
||||||
|
|
||||||
|
*(acomp->gainr) = Lyl;
|
||||||
|
|
||||||
|
if (ingain > in_peak) {
|
||||||
|
in_peak = ingain;
|
||||||
|
}
|
||||||
|
lgaininp = in0 * Lgain;
|
||||||
|
rgaininp = in1 * Lgain;
|
||||||
|
output0[i] = lgaininp * from_dB(*(acomp->makeup));
|
||||||
|
output1[i] = rgaininp * from_dB(*(acomp->makeup));
|
||||||
|
|
||||||
|
max = (fmaxf(fabsf(output0[i]), fabsf(output1[i])) > max) ? fmaxf(fabsf(output0[i]), fabsf(output1[i])) : sanitize_denormal(max);
|
||||||
|
|
||||||
|
// TODO re-use local variables on stack
|
||||||
|
// store values back to acomp at the end of the inner-loop
|
||||||
|
acomp->old_yl = Lyl;
|
||||||
|
acomp->old_y1 = Ly1;
|
||||||
|
acomp->old_yg = Lyg;
|
||||||
|
}
|
||||||
|
|
||||||
|
*(acomp->outlevel) = (max < 0.0056f) ? -45.f : to_dB(max);
|
||||||
|
|
||||||
|
#ifdef LV2_EXTENDED
|
||||||
|
acomp->v_lvl += .1 * (in_peak - acomp->v_lvl); // crude LPF TODO use n_samples/rate TC
|
||||||
|
const float v_lvl_in = (acomp->v_lvl < 0.001f) ? -60.f : to_dB(acomp->v_lvl);
|
||||||
|
const float v_lvl_out = (max < 0.001f) ? -60.f : to_dB(max);
|
||||||
|
if (fabsf (acomp->v_lvl_out - v_lvl_out) >= 1 || fabsf (acomp->v_lvl_in - v_lvl_in) >= 1) {
|
||||||
|
// >= 1dB difference
|
||||||
|
acomp->need_expose = true;
|
||||||
|
acomp->v_lvl_in = v_lvl_in;
|
||||||
|
acomp->v_lvl_out = v_lvl_out - *acomp->makeup;
|
||||||
|
}
|
||||||
|
if (acomp->need_expose && acomp->queue_draw) {
|
||||||
|
acomp->need_expose = false;
|
||||||
|
acomp->queue_draw->queue_draw (acomp->queue_draw->handle);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
deactivate(LV2_Handle instance)
|
deactivate(LV2_Handle instance)
|
||||||
{
|
{
|
||||||
|
|
@ -464,12 +657,23 @@ extension_data(const char* uri)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const LV2_Descriptor descriptor = {
|
static const LV2_Descriptor descriptor_mono = {
|
||||||
ACOMP_URI,
|
ACOMP_URI,
|
||||||
instantiate,
|
instantiate,
|
||||||
connect_port,
|
connect_port_mono,
|
||||||
activate,
|
activate,
|
||||||
run,
|
run_mono,
|
||||||
|
deactivate,
|
||||||
|
cleanup,
|
||||||
|
extension_data
|
||||||
|
};
|
||||||
|
|
||||||
|
static const LV2_Descriptor descriptor_stereo = {
|
||||||
|
ACOMP_STEREO_URI,
|
||||||
|
instantiate,
|
||||||
|
connect_port_stereo,
|
||||||
|
activate,
|
||||||
|
run_stereo,
|
||||||
deactivate,
|
deactivate,
|
||||||
cleanup,
|
cleanup,
|
||||||
extension_data
|
extension_data
|
||||||
|
|
@ -481,7 +685,9 @@ lv2_descriptor(uint32_t index)
|
||||||
{
|
{
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return &descriptor;
|
return &descriptor_mono;
|
||||||
|
case 1:
|
||||||
|
return &descriptor_stereo;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,30 +16,9 @@
|
||||||
|
|
||||||
lv2:optionalFeature <http://lv2plug.in/ns/lv2core#hardRTCapable>;
|
lv2:optionalFeature <http://lv2plug.in/ns/lv2core#hardRTCapable>;
|
||||||
|
|
||||||
lv2:port [
|
|
||||||
a lv2:InputPort, lv2:AudioPort ;
|
|
||||||
lv2:index 0 ;
|
|
||||||
lv2:symbol "lv2_audio_in_1" ;
|
|
||||||
lv2:name "Audio Input 1" ;
|
|
||||||
] ,
|
|
||||||
[
|
|
||||||
a lv2:InputPort, lv2:AudioPort ;
|
|
||||||
lv2:index 1 ;
|
|
||||||
lv2:symbol "lv2_sidechain_in" ;
|
|
||||||
lv2:name "Sidechain Input" ;
|
|
||||||
lv2:portProperty lv2:isSideChain;
|
|
||||||
] ;
|
|
||||||
|
|
||||||
lv2:port [
|
|
||||||
a lv2:OutputPort, lv2:AudioPort ;
|
|
||||||
lv2:index 2 ;
|
|
||||||
lv2:symbol "lv2_audio_out_1" ;
|
|
||||||
lv2:name "Audio Output 1" ;
|
|
||||||
] ;
|
|
||||||
|
|
||||||
lv2:port [
|
lv2:port [
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 3 ;
|
lv2:index 0 ;
|
||||||
lv2:name "Attack" ;
|
lv2:name "Attack" ;
|
||||||
lv2:symbol "att" ;
|
lv2:symbol "att" ;
|
||||||
lv2:default 10.000000 ;
|
lv2:default 10.000000 ;
|
||||||
|
|
@ -49,7 +28,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 4 ;
|
lv2:index 1 ;
|
||||||
lv2:name "Release" ;
|
lv2:name "Release" ;
|
||||||
lv2:symbol "rel" ;
|
lv2:symbol "rel" ;
|
||||||
lv2:default 80.000000 ;
|
lv2:default 80.000000 ;
|
||||||
|
|
@ -59,7 +38,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 5 ;
|
lv2:index 2 ;
|
||||||
lv2:name "Knee" ;
|
lv2:name "Knee" ;
|
||||||
lv2:symbol "kn" ;
|
lv2:symbol "kn" ;
|
||||||
lv2:default 0.000000 ;
|
lv2:default 0.000000 ;
|
||||||
|
|
@ -69,7 +48,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 6 ;
|
lv2:index 3 ;
|
||||||
lv2:name "Ratio" ;
|
lv2:name "Ratio" ;
|
||||||
lv2:symbol "rat" ;
|
lv2:symbol "rat" ;
|
||||||
lv2:default 4.000000 ;
|
lv2:default 4.000000 ;
|
||||||
|
|
@ -83,7 +62,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 7 ;
|
lv2:index 4 ;
|
||||||
lv2:name "Threshold" ;
|
lv2:name "Threshold" ;
|
||||||
lv2:symbol "thr" ;
|
lv2:symbol "thr" ;
|
||||||
lv2:default 0.000000 ;
|
lv2:default 0.000000 ;
|
||||||
|
|
@ -93,7 +72,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 8 ;
|
lv2:index 5 ;
|
||||||
lv2:name "Makeup" ;
|
lv2:name "Makeup" ;
|
||||||
lv2:symbol "mak" ;
|
lv2:symbol "mak" ;
|
||||||
lv2:default 0.000000 ;
|
lv2:default 0.000000 ;
|
||||||
|
|
@ -103,7 +82,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:OutputPort, lv2:ControlPort ;
|
a lv2:OutputPort, lv2:ControlPort ;
|
||||||
lv2:index 9 ;
|
lv2:index 6 ;
|
||||||
lv2:name "Gain Reduction" ;
|
lv2:name "Gain Reduction" ;
|
||||||
lv2:symbol "gr" ;
|
lv2:symbol "gr" ;
|
||||||
lv2:default 0.000000 ;
|
lv2:default 0.000000 ;
|
||||||
|
|
@ -113,7 +92,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:OutputPort, lv2:ControlPort ;
|
a lv2:OutputPort, lv2:ControlPort ;
|
||||||
lv2:index 10 ;
|
lv2:index 7 ;
|
||||||
lv2:name "Output Level" ;
|
lv2:name "Output Level" ;
|
||||||
lv2:symbol "outlevel" ;
|
lv2:symbol "outlevel" ;
|
||||||
lv2:default -45.000000 ;
|
lv2:default -45.000000 ;
|
||||||
|
|
@ -123,7 +102,7 @@
|
||||||
] ,
|
] ,
|
||||||
[
|
[
|
||||||
a lv2:InputPort, lv2:ControlPort ;
|
a lv2:InputPort, lv2:ControlPort ;
|
||||||
lv2:index 11 ;
|
lv2:index 8 ;
|
||||||
lv2:name "Sidechain" ;
|
lv2:name "Sidechain" ;
|
||||||
lv2:symbol "sidech" ;
|
lv2:symbol "sidech" ;
|
||||||
lv2:default 0.000000 ;
|
lv2:default 0.000000 ;
|
||||||
|
|
@ -132,6 +111,26 @@
|
||||||
lv2:portProperty lv2:toggled ;
|
lv2:portProperty lv2:toggled ;
|
||||||
] ;
|
] ;
|
||||||
|
|
||||||
|
lv2:port [
|
||||||
|
a lv2:InputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 9 ;
|
||||||
|
lv2:symbol "lv2_audio_in_1" ;
|
||||||
|
lv2:name "Audio Input 1" ;
|
||||||
|
] ,
|
||||||
|
[
|
||||||
|
a lv2:InputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 10 ;
|
||||||
|
lv2:symbol "lv2_sidechain_in" ;
|
||||||
|
lv2:name "Sidechain Input" ;
|
||||||
|
lv2:portProperty lv2:isSideChain;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
a lv2:OutputPort, lv2:AudioPort ;
|
||||||
|
lv2:index 11 ;
|
||||||
|
lv2:symbol "lv2_audio_out_1" ;
|
||||||
|
lv2:name "Audio Output 1" ;
|
||||||
|
] ;
|
||||||
|
|
||||||
rdfs:comment """
|
rdfs:comment """
|
||||||
A powerful mono compressor.
|
A powerful mono compressor.
|
||||||
""" ;
|
""" ;
|
||||||
|
|
@ -142,5 +141,5 @@ A powerful mono compressor.
|
||||||
|
|
||||||
# ui:ui <urn:ardour:a-comp#ui>;
|
# ui:ui <urn:ardour:a-comp#ui>;
|
||||||
|
|
||||||
lv2:microVersion 0 ;
|
lv2:microVersion 1 ;
|
||||||
lv2:minorVersion 1 .
|
lv2:minorVersion 1 .
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@
|
||||||
lv2:binary <a-comp@LIB_EXT@> ;
|
lv2:binary <a-comp@LIB_EXT@> ;
|
||||||
rdfs:seeAlso <a-comp.ttl> .
|
rdfs:seeAlso <a-comp.ttl> .
|
||||||
|
|
||||||
|
<urn:ardour:a-comp#stereo>
|
||||||
|
a lv2:Plugin ;
|
||||||
|
lv2:binary <a-comp@LIB_EXT@> ;
|
||||||
|
rdfs:seeAlso <a-comp#stereo.ttl> .
|
||||||
|
|
||||||
#<urn:ardour:a-comp#ui>
|
#<urn:ardour:a-comp#ui>
|
||||||
# a ui:GtkUI ;
|
# a ui:GtkUI ;
|
||||||
# ui:binary <a-comp-ui@LIB_EXT@> ;
|
# ui:binary <a-comp-ui@LIB_EXT@> ;
|
||||||
|
|
@ -30,3 +35,23 @@
|
||||||
lv2:appliesTo <urn:ardour:a-comp> ;
|
lv2:appliesTo <urn:ardour:a-comp> ;
|
||||||
rdfs:label "VocalLeveller" ;
|
rdfs:label "VocalLeveller" ;
|
||||||
rdfs:seeAlso <presets.ttl> .
|
rdfs:seeAlso <presets.ttl> .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<urn:ardour:a-comp#preset001>
|
||||||
|
a pset:Preset ;
|
||||||
|
lv2:appliesTo <urn:ardour:a-comp#stereo> ;
|
||||||
|
rdfs:label "Zero" ;
|
||||||
|
rdfs:seeAlso <presets.ttl> .
|
||||||
|
|
||||||
|
<urn:ardour:a-comp#preset002>
|
||||||
|
a pset:Preset ;
|
||||||
|
lv2:appliesTo <urn:ardour:a-comp#stereo> ;
|
||||||
|
rdfs:label "PoppySnare" ;
|
||||||
|
rdfs:seeAlso <presets.ttl> .
|
||||||
|
|
||||||
|
<urn:ardour:a-comp#preset003>
|
||||||
|
a pset:Preset ;
|
||||||
|
lv2:appliesTo <urn:ardour:a-comp#stereo> ;
|
||||||
|
rdfs:label "VocalLeveller" ;
|
||||||
|
rdfs:seeAlso <presets.ttl> .
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ def build(bld):
|
||||||
|
|
||||||
if bld.is_defined ('HAVE_LV2'):
|
if bld.is_defined ('HAVE_LV2'):
|
||||||
# Build RDF files
|
# Build RDF files
|
||||||
for i in ['manifest.ttl', 'a-comp.ttl', 'presets.ttl']:
|
for i in ['manifest.ttl', 'a-comp.ttl', 'a-comp#stereo.ttl', 'presets.ttl']:
|
||||||
bld(features = 'subst',
|
bld(features = 'subst',
|
||||||
source = i + '.in',
|
source = i + '.in',
|
||||||
target = '../../LV2/%s/%s' % (bundle, i),
|
target = '../../LV2/%s/%s' % (bundle, i),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue