13
0

ace-fluidsynth: add bypass (ignore notes, but retain reverb)

This commit is contained in:
Robin Gareus 2021-05-21 18:30:35 +02:00
parent ecbd8732de
commit d703079f10
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 20 additions and 1 deletions

View File

@ -72,6 +72,7 @@ enum {
FS_CHR_DEPTH, FS_CHR_DEPTH,
FS_CHR_LEVEL, FS_CHR_LEVEL,
FS_CHR_TYPE, FS_CHR_TYPE,
FS_PORT_ENABLE,
FS_PORT_LAST FS_PORT_LAST
}; };
@ -524,6 +525,13 @@ run (LV2_Handle instance, uint32_t n_samples)
lv2_atom_forge_set_buffer (&self->forge, (uint8_t*)self->notify, capacity); lv2_atom_forge_set_buffer (&self->forge, (uint8_t*)self->notify, capacity);
lv2_atom_forge_sequence_head (&self->forge, &self->frame, 0); lv2_atom_forge_sequence_head (&self->forge, &self->frame, 0);
const bool enabled = *self->p_ports[FS_PORT_ENABLE] > 0;
if (self->v_ports[FS_PORT_ENABLE] != *self->p_ports[FS_PORT_ENABLE]) {
if (self->initialized && !self->reinit_in_progress) {
fluid_synth_all_notes_off (self->synth, -1);
}
}
if (!self->initialized || self->reinit_in_progress) { if (!self->initialized || self->reinit_in_progress) {
memset (self->p_ports[FS_PORT_OUT_L], 0, n_samples * sizeof (float)); memset (self->p_ports[FS_PORT_OUT_L], 0, n_samples * sizeof (float));
memset (self->p_ports[FS_PORT_OUT_R], 0, n_samples * sizeof (float)); memset (self->p_ports[FS_PORT_OUT_R], 0, n_samples * sizeof (float));
@ -602,7 +610,7 @@ run (LV2_Handle instance, uint32_t n_samples)
} }
} }
} else if (ev->body.type == self->midi_MidiEvent) { } else if (ev->body.type == self->midi_MidiEvent) {
if (ev->time.frames >= n_samples || self->reinit_in_progress) { if (ev->time.frames >= n_samples || self->reinit_in_progress || !enabled) {
continue; continue;
} }
if (ev->body.size > 3) { if (ev->body.size > 3) {

View File

@ -172,4 +172,15 @@
lv2:portProperty lv2:integer, lv2:enumeration; lv2:portProperty lv2:integer, lv2:enumeration;
lv2:scalePoint [ rdfs:label "Sine"; rdf:value 0.0 ; ] ; lv2:scalePoint [ rdfs:label "Sine"; rdf:value 0.0 ; ] ;
lv2:scalePoint [ rdfs:label "Triangle"; rdf:value 1.0 ; ] ; lv2:scalePoint [ rdfs:label "Triangle"; rdf:value 1.0 ; ] ;
] ,
[
a lv2:InputPort, lv2:ControlPort ;
lv2:index 16 ;
lv2:name "Enable" ;
lv2:symbol "enable" ;
lv2:default 1 ;
lv2:minimum 0 ;
lv2:maximum 1 ;
lv2:portProperty lv2:integer, lv2:toggled ;
lv2:designation lv2:enabled;
] . ] .