Bump gains to 32. Add pans pointer (no controls yet)

This commit is contained in:
Nick Lanham 2012-02-12 21:40:12 +01:00
parent ba2b776b0b
commit d36035e0ab
3 changed files with 267 additions and 56 deletions

65
drmr.c
View File

@ -96,7 +96,8 @@ instantiate(const LV2_Descriptor* descriptor,
load_hydrogen_kit(drmr,drmr->kits->kits->path);
drmr->curKit = 0;
drmr->gains = malloc(16*sizeof(float*));
drmr->gains = malloc(32*sizeof(float*));
drmr->pans = malloc(32*sizeof(float*));
for(i = 0;i<16;i++) drmr->gains[i] = NULL;
return (LV2_Handle)drmr;
@ -107,7 +108,8 @@ connect_port(LV2_Handle instance,
uint32_t port,
void* data) {
DrMr* drmr = (DrMr*)instance;
switch ((DrMrPortIndex)port) {
DrMrPortIndex port_index = (DrMrPortIndex)port;
switch (port_index) {
case DRMR_MIDI:
drmr->midi_port = (LV2_Event_Buffer*)data;
break;
@ -120,61 +122,17 @@ connect_port(LV2_Handle instance,
case DRMR_KITNUM:
if(data) drmr->kitReq = (float*)data;
break;
case DRMR_GAIN_ONE:
if (data) drmr->gains[0] = (float*)data;
break;
case DRMR_GAIN_TWO:
if (data) drmr->gains[1] = (float*)data;
break;
case DRMR_GAIN_THREE:
if (data) drmr->gains[2] = (float*)data;
break;
case DRMR_GAIN_FOUR:
if (data) drmr->gains[3] = (float*)data;
break;
case DRMR_GAIN_FIVE:
if (data) drmr->gains[4] = (float*)data;
break;
case DRMR_GAIN_SIX:
if (data) drmr->gains[5] = (float*)data;
break;
case DRMR_GAIN_SEVEN:
if (data) drmr->gains[6] = (float*)data;
break;
case DRMR_GAIN_EIGHT:
if (data) drmr->gains[7] = (float*)data;
break;
case DRMR_GAIN_NINE:
if (data) drmr->gains[8] = (float*)data;
break;
case DRMR_GAIN_TEN:
if (data) drmr->gains[9] = (float*)data;
break;
case DRMR_GAIN_ELEVEN:
if (data) drmr->gains[10] = (float*)data;
break;
case DRMR_GAIN_TWELVE:
if (data) drmr->gains[11] = (float*)data;
break;
case DRMR_GAIN_THIRTEEN:
if (data) drmr->gains[12] = (float*)data;
break;
case DRMR_GAIN_FOURTEEN:
if (data) drmr->gains[13] = (float*)data;
break;
case DRMR_GAIN_FIFTEEN:
if (data) drmr->gains[14] = (float*)data;
break;
case DRMR_GAIN_SIXTEEN:
if (data) drmr->gains[15] = (float*)data;
break;
default:
break;
}
if (port_index >= DRMR_GAIN_ONE && port_index <= DRMR_GAIN_THIRTYTWO) {
int goff = port_index - DRMR_GAIN_ONE;
drmr->gains[goff] = (float*)data;
}
}
static void activate(LV2_Handle instance) { }
#define DB3SCALE -0.8317830986718104f
// taken from lv2 example amp plugin
#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f)
@ -230,7 +188,7 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
drmr_sample* cs = drmr->samples+i;
if (cs->active) {
float gain;
if (i < 16)
if (i < 32)
gain = DB_CO(*(drmr->gains[i]));
else
gain = DB_CO(0.0f);
@ -255,6 +213,7 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
pthread_mutex_unlock(&drmr->load_mutex);
}
static void activate (LV2_Handle instance) {}
static void deactivate(LV2_Handle instance) {}
static void cleanup(LV2_Handle instance) {

18
drmr.h
View File

@ -30,6 +30,7 @@ typedef struct {
char* name;
char* desc;
char* path;
int samples;
} scanned_kit;
typedef struct {
@ -72,6 +73,22 @@ typedef enum {
DRMR_GAIN_FOURTEEN,
DRMR_GAIN_FIFTEEN,
DRMR_GAIN_SIXTEEN,
DRMR_GAIN_SEVENTEEN,
DRMR_GAIN_EIGHTEEN,
DRMR_GAIN_NINETEEN,
DRMR_GAIN_TWENTY,
DRMR_GAIN_TWENTYONE,
DRMR_GAIN_TWENTYTWO,
DRMR_GAIN_TWENTYTHREE,
DRMR_GAIN_TWENTYFOUR,
DRMR_GAIN_TWENTYFIVE,
DRMR_GAIN_TWENTYSIX,
DRMR_GAIN_TWENTYSEVEN,
DRMR_GAIN_TWENTYEIGHT,
DRMR_GAIN_TWENTYNINE,
DRMR_GAIN_THIRTY,
DRMR_GAIN_THIRTYONE,
DRMR_GAIN_THIRTYTWO,
DRMR_NUM_PORTS
} DrMrPortIndex;
@ -83,6 +100,7 @@ typedef struct {
// params
float** gains;
float** pans;
float* kitReq;
// URIs

240
drmr.ttl
View File

@ -4,6 +4,7 @@
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ui: <http://lv2plug.in/ns/extensions/ui#>.
<http://github.com/nicklan/drmr>
a lv2:Plugin;
@ -15,6 +16,7 @@
foaf:mbox <nick@afternight.org>
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl>;
ui:ui <http://github.com/nicklan/drmr#ui> ;
lv2:port [
a ev:EventPort, lv2:InputPort;
lv2:index 0;
@ -262,8 +264,240 @@
lv2:index 19;
lv2:symbol "gain_sixteen";
lv2:name "Sample Sixteen Gain";
lv2:minimum 0.0;
lv2:maximum 1.0;
lv2:default 1.0;
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 20;
lv2:symbol "gain_seventeen";
lv2:name "Sample Seventeen Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 21;
lv2:symbol "gain_eighteen";
lv2:name "Sample Eighteen Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 22;
lv2:symbol "gain_nineteen";
lv2:name "Sample Nineteen Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 23;
lv2:symbol "gain_twenty";
lv2:name "Sample Twenty Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 24;
lv2:symbol "gain_twentyone";
lv2:name "Sample Twenty One Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 25;
lv2:symbol "gain_twentytwo";
lv2:name "Sample Twenty Two Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 26;
lv2:symbol "gain_twentythree";
lv2:name "Sample Twenty Three Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 27;
lv2:symbol "gain_twentyfour";
lv2:name "Sample Twenty Four Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 28;
lv2:symbol "gain_twentyfive";
lv2:name "Sample Twenty Five Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 29;
lv2:symbol "gain_twentysix";
lv2:name "Sample Twenty Six Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 30;
lv2:symbol "gain_twentyseven";
lv2:name "Sample Twenty Seven Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 31;
lv2:symbol "gain_twentyeight";
lv2:name "Sample Twenty Eight Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 32;
lv2:symbol "gain_twentynine";
lv2:name "Sample Twenty Nine Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 33;
lv2:symbol "gain_thirty";
lv2:name "Sample Thirty Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 34;
lv2:symbol "gain_thirtyone";
lv2:name "Sample Thirty One Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
],
[
a lv2:ControlPort, lv2:InputPort;
lv2:index 35;
lv2:symbol "gain_thirtytwo";
lv2:name "Sample Thirty Two Gain";
lv2:minimum -90.0;
lv2:maximum 6.0;
lv2:default 0.0;
lv2:scalePoint [
rdfs:label "-inf" ;
rdf:value -90.0
]
].
<http://github.com/nicklan/drmr#ui>
a ui:GtkUI ;
ui:binary <drmr_ui.so> .