aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-13 18:09:12 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-12-13 18:09:12 +0100
commit65fee292f3700b15822871e5ec6b5d587d4665f6 (patch)
tree87c187a84d35abb2c6f5a90cb94d869a90794d7a
parent953915358ae8c33b41ce4d98bea7cd58ee25d03f (diff)
downloadsynthpod-65fee292f3700b15822871e5ec6b5d587d4665f6.tar.xz
clear not connected audio/cv buffer only once.
* clear not connected audio/cv buffer onl once * right after last disconnection, that is, instead of each period
-rw-r--r--lib/synthpod_app.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/synthpod_app.c b/lib/synthpod_app.c
index a708ea9d..087c0f88 100644
--- a/lib/synthpod_app.c
+++ b/lib/synthpod_app.c
@@ -1121,12 +1121,12 @@ static inline void
_sp_app_port_disconnect(sp_app_t *app, port_t *src_port, port_t *snk_port)
{
// update sources list
- int connected = 0;
+ bool connected = false;
for(int i=0, j=0; i<snk_port->num_sources; i++)
{
if(snk_port->sources[i].port == src_port)
{
- connected = 1;
+ connected = true;
continue;
}
@@ -1154,6 +1154,16 @@ _sp_app_port_disconnect(sp_app_t *app, port_t *src_port, port_t *snk_port)
snk_port->mod->inst,
snk_port->index,
snk_port->buf);
+
+ // clear audio/cv port buffers without connections
+ if( (snk_port->num_sources + snk_port->num_feedbacks) == 0)
+ {
+ if( (snk_port->type == PORT_TYPE_AUDIO)
+ || (snk_port->type == PORT_TYPE_CV) )
+ {
+ memset(PORT_BUF_ALIGNED(snk_port), 0x0, snk_port->size);
+ }
+ }
}
}
@@ -2589,7 +2599,7 @@ sp_app_run_pre(sp_app_t *app, uint32_t nsamples)
{
mod_t *mod = app->mods[m];
- if(mod->delete_request)
+ if(mod->delete_request && !del_me) // only delete 1 module at once
{
del_me = mod;
mod->delete_request = 0;
@@ -2606,23 +2616,15 @@ sp_app_run_pre(sp_app_t *app, uint32_t nsamples)
{
port_t *port = &mod->ports[p];
- if(port->direction == PORT_DIRECTION_INPUT) // ignore output ports
+ if(port->direction == PORT_DIRECTION_OUTPUT)
+ continue; // ignore output ports
+
+ if( (port->type == PORT_TYPE_ATOM)
+ && (port->buffer_type == PORT_BUFFER_TYPE_SEQUENCE) )
{
- if( (port->type == PORT_TYPE_ATOM)
- && (port->buffer_type == PORT_BUFFER_TYPE_SEQUENCE) )
- {
- LV2_Atom_Sequence *seq = PORT_BUF_ALIGNED(port);
- seq->atom.type = app->regs.port.sequence.urid;
- seq->atom.size = sizeof(LV2_Atom_Sequence_Body); // empty sequence
- }
- else if( (port->num_sources + port->num_feedbacks) == 0) // clear audio/cv ports without connections
- {
- if( (port->type == PORT_TYPE_AUDIO)
- || (port->type == PORT_TYPE_CV) )
- {
- memset(PORT_BUF_ALIGNED(port), 0x0, port->size);
- }
- }
+ LV2_Atom_Sequence *seq = PORT_BUF_ALIGNED(port);
+ seq->atom.type = app->regs.port.sequence.urid;
+ seq->atom.size = sizeof(LV2_Atom_Sequence_Body); // empty sequence
}
}
}