- Add Master output audio ports

- Update .gitignore
This commit is contained in:
Arnaud G. GIBERT 2022-03-07 00:14:48 +01:00
parent f405ce33ad
commit 2debad5744
4 changed files with 52 additions and 12 deletions

10
.gitignore vendored
View File

@ -1,7 +1,9 @@
drmr.so *~
drmr_ui.xml drmr2.so
drmr_ui.so drmr2_ui.xml
drmr.lv2 drmr2_ui.so
drmr2.lv2
drmr2.ttl
build build
/logo.xcf /logo.xcf
/htest /htest

View File

@ -70,7 +70,19 @@ add_port "," " a lv2:InputPort , atom:AtomPort;
lv2:name \"Control\";" lv2:name \"Control\";"
idx=1
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_1\";
lv2:name \"Master - Out 1\";"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_2\";
lv2:name \"Master - Out 2\";"
out_id=0 out_id=0
while [[ "${out_id}" -lt "${outport_nb}" ]] while [[ "${out_id}" -lt "${outport_nb}" ]]

26
drmr2.c
View File

@ -166,7 +166,15 @@ connect_port(LV2_Handle instance,
break; break;
default: default:
if( port_index >= DRMR_LEFT_00 && port_index <= DRMR_RIGHT_31) if( port_index == DRMR_MASTER_LEFT)
{
drmr->master_right = (float*)data;
}
else if( port_index == DRMR_MASTER_RIGHT)
{
drmr->master_left = (float*)data;
}
else if( port_index >= DRMR_LEFT_00 && port_index <= DRMR_RIGHT_31)
{ {
int outoff = (port_index - DRMR_LEFT_00) / 2; int outoff = (port_index - DRMR_LEFT_00) / 2;
@ -357,7 +365,8 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
{ {
case 8: case 8:
{ {
if (!drmr->ignore_note_off) { if (!drmr->ignore_note_off)
{
nn = data[1]; nn = data[1];
nn-=baseNote; nn-=baseNote;
untrigger_sample(drmr,nn,offset); untrigger_sample(drmr,nn,offset);
@ -450,6 +459,12 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
pthread_mutex_lock(&drmr->load_mutex); pthread_mutex_lock(&drmr->load_mutex);
for( j = 0; j<n_samples; j++)
{
drmr->master_left[j] = 0.0f;
drmr->master_right[j] = 0.0f;
}
for (i = 0;i < drmr->num_samples;i++) for (i = 0;i < drmr->num_samples;i++)
{ {
int pos,lim; int pos,lim;
@ -496,8 +511,12 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
for (pos = datastart; pos < lim && pos < dataend; pos++) for (pos = datastart; pos < lim && pos < dataend; pos++)
{ {
drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
drmr->left[i][pos] += cs->data[cs->offset]*coef_left; drmr->left[i][pos] += cs->data[cs->offset]*coef_left;
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
drmr->right[i][pos] += cs->data[cs->offset]*coef_right; drmr->right[i][pos] += cs->data[cs->offset]*coef_right;
cs->offset++; cs->offset++;
} }
} }
@ -508,7 +527,10 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
if (lim > n_samples) lim = n_samples; if (lim > n_samples) lim = n_samples;
for (pos = datastart; pos < lim && pos < dataend; pos++) for (pos = datastart; pos < lim && pos < dataend; pos++)
{ {
drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
drmr->left[i][pos] += cs->data[cs->offset++]*coef_left; drmr->left[i][pos] += cs->data[cs->offset++]*coef_left;
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
drmr->right[i][pos] += cs->data[cs->offset++]*coef_right; drmr->right[i][pos] += cs->data[cs->offset++]*coef_right;
} }
} }

View File

@ -72,6 +72,8 @@ typedef struct {
typedef enum { typedef enum {
DRMR_CONTROL = 0, DRMR_CONTROL = 0,
DRMR_MASTER_LEFT,
DRMR_MASTER_RIGHT,
DRMR_LEFT_00, DRMR_LEFT_00,
DRMR_RIGHT_00, DRMR_RIGHT_00,
DRMR_LEFT_01, DRMR_LEFT_01,
@ -225,6 +227,8 @@ typedef struct {
typedef struct { typedef struct {
// Ports // Ports
float* master_left;
float* master_right;
float** left; float** left;
float** right; float** right;
LV2_Atom_Sequence *control_port; LV2_Atom_Sequence *control_port;