Added an lv2 port for freewheeling

Corrected
This commit is contained in:
Paul Ferrand 2019-12-08 17:45:11 +01:00
parent eb0b84a7a6
commit 6a40d0e778
2 changed files with 19 additions and 1 deletions

View file

@ -82,6 +82,7 @@ typedef struct
const float *polyphony_port;
const float *oversampling_port;
const float *preload_port;
const float *freewheel_port;
// Atom forge
LV2_Atom_Forge forge; ///< Forge for writing atoms in run thread
@ -135,7 +136,8 @@ enum
SFIZZ_VOLUME = 4,
SFIZZ_POLYPHONY = 5,
SFIZZ_OVERSAMPLING = 6,
SFIZZ_PRELOAD = 7
SFIZZ_PRELOAD = 7,
SFIZZ_FREEWHEELING = 8
};
static void
@ -196,6 +198,9 @@ connect_port(LV2_Handle instance,
case SFIZZ_PRELOAD:
self->preload_port = (const float *)data;
break;
case SFIZZ_FREEWHEELING:
self->freewheel_port = (const float *)data;
break;
default:
break;
}
@ -483,6 +488,9 @@ run(LV2_Handle instance, uint32_t sample_count)
if (!self->control_port || !self->notify_port)
return;
if (*(self->freewheel_port) > 0)
lv2_log_note(&self->logger, "[run] Freewheeling set!");
// Set up forge to write directly to notify output port.
const size_t notify_capacity = self->notify_port->atom.size;
lv2_atom_forge_set_buffer(&self->forge, (uint8_t *)self->notify_port, notify_capacity);

View file

@ -152,4 +152,14 @@
lv2:scalePoint [ rdfs:label "64 Ko"; rdf:value 16384 ] ;
lv2:scalePoint [ rdfs:label "128 Ko"; rdf:value 32768 ] ;
lv2:scalePoint [ rdfs:label "256 Ko"; rdf:value 65536 ] ;
], [
a lv2:InputPort, lv2:ControlPort ;
lv2:index 8 ;
lv2:symbol "freewheeling" ;
lv2:name "Freewheeling" ;
lv2:designation lv2:freeWheeling ;
lv2:portProperty lv2:toggled ;
lv2:default 0 ;
lv2:minimum 0 ;
lv2:maximum 1 ;
].