From ca7d9573117df90ff47cfcbb7e8e8297198a4584 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 7 Dec 2020 23:45:01 +0100 Subject: [PATCH] :bug: Fix UGen->trig connection --- src/lib/ugen.c | 144 ++++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/src/lib/ugen.c b/src/lib/ugen.c index c6834403..b34d1b39 100644 --- a/src/lib/ugen.c +++ b/src/lib/ugen.c @@ -189,78 +189,78 @@ if(!UGEN(rhs)->module.gen.trig) { \ release_connect(shred); \ Except(shred, "NonTriggerException"); \ } -#define describe_connect_instr(name, func, opt) \ -static INSTR(name##func) { \ - M_Object lhs, rhs; \ - connect_init(shred, &lhs, &rhs); \ - opt \ - _do_(func, UGEN(lhs), UGEN(rhs)); \ - release_connect(shred); \ -} -describe_connect_instr(Ugen, Connect,) -describe_connect_instr(Ugen, Disconnect,) -describe_connect_instr(Trig, Connect, TRIG_EX) -describe_connect_instr(Trig, Disconnect, TRIG_EX) - -#define describe_connectaa_instr(name, func, opt) \ -static INSTR(name##func) { \ - M_Object lhs, rhs; \ - connect_init(shred, &lhs, &rhs); \ - const m_uint lsz = m_vector_size(ARRAY(lhs)); \ - const m_uint rsz = m_vector_size(ARRAY(rhs)); \ - const m_uint min = lsz < rsz ? lsz : rsz; \ - for(m_uint i = 0; i < min; ++i) { \ - M_Object ulhs, urhs; \ - m_vector_get(ARRAY(lhs), i, &ulhs); \ - m_vector_get(ARRAY(rhs), i, &urhs); \ - opt \ - if(ulhs && urhs) \ - _do_(func, UGEN(ulhs), UGEN(urhs)); \ - } \ - release_connect(shred); \ -} -describe_connectaa_instr(UgenAA, Connect,) -describe_connectaa_instr(UgenAA, Disconnect,) -describe_connectaa_instr(TrigAA, Connect, TRIG_EX) -describe_connectaa_instr(TrigAA, Disconnect, TRIG_EX) - -#define describe_connectua_instr(name, func, opt) \ -static INSTR(name##func) { \ - M_Object lhs, rhs; \ - connect_init(shred, &lhs, &rhs); \ - const m_uint rsz = m_vector_size(ARRAY(rhs)); \ - for(m_uint i = 0; i < rsz; ++i) { \ - M_Object urhs; \ - m_vector_get(ARRAY(rhs), i, &urhs); \ - opt \ - if(urhs) \ - _do_(func, UGEN(lhs), UGEN(urhs)); \ - } \ - release_connect(shred); \ -} -describe_connectua_instr(UgenUA, Connect,) -describe_connectua_instr(UgenUA, Disconnect,) -describe_connectua_instr(TrigUA, Connect, TRIG_EX) -describe_connectua_instr(TrigUA, Disconnect, TRIG_EX) - -#define describe_connectau_instr(name, func, opt) \ -static INSTR(name##func) { \ - M_Object lhs, rhs; \ - connect_init(shred, &lhs, &rhs); \ - const m_uint lsz = m_vector_size(ARRAY(lhs)); \ - for(m_uint i = 0; i < lsz; ++i) { \ - M_Object ulhs; \ - m_vector_get(ARRAY(lhs), i, &ulhs); \ - opt \ - if(ulhs) \ - _do_(func, UGEN(ulhs), UGEN(rhs)); \ - } \ - release_connect(shred); \ -} -describe_connectau_instr(UgenAU, Connect,) -describe_connectau_instr(UgenAU, Disconnect,) -describe_connectau_instr(TrigAU, Connect, TRIG_EX) -describe_connectau_instr(TrigAU, Disconnect, TRIG_EX) +#define describe_connect_instr(name, func, tgt, opt) \ +static INSTR(name##func) { \ + M_Object lhs, rhs; \ + connect_init(shred, &lhs, &rhs); \ + opt \ + _do_(func, UGEN(lhs), tgt); \ + release_connect(shred); \ +} +describe_connect_instr(Ugen, Connect, UGEN(rhs),) +describe_connect_instr(Ugen, Disconnect, UGEN(rhs),) +describe_connect_instr(Trig, Connect, UGEN(rhs)->module.gen.trig, TRIG_EX) +describe_connect_instr(Trig, Disconnect, UGEN(rhs)->module.gen.trig, TRIG_EX) + +#define describe_connectaa_instr(name, func, tgt, opt) \ +static INSTR(name##func) { \ + M_Object lhs, rhs; \ + connect_init(shred, &lhs, &rhs); \ + const m_uint lsz = m_vector_size(ARRAY(lhs)); \ + const m_uint rsz = m_vector_size(ARRAY(rhs)); \ + const m_uint min = lsz < rsz ? lsz : rsz; \ + for(m_uint i = 0; i < min; ++i) { \ + M_Object ulhs, urhs; \ + m_vector_get(ARRAY(lhs), i, &ulhs); \ + m_vector_get(ARRAY(rhs), i, &urhs); \ + opt \ + if(ulhs && urhs) \ + _do_(func, UGEN(ulhs), tgt); \ + } \ + release_connect(shred); \ +} +describe_connectaa_instr(UgenAA, Connect, UGEN(urhs),) +describe_connectaa_instr(UgenAA, Disconnect,UGEN(urhs),) +describe_connectaa_instr(TrigAA, Connect, UGEN(urhs)->module.gen.trig, TRIG_EX) +describe_connectaa_instr(TrigAA, Disconnect, UGEN(urhs)->module.gen.trig, TRIG_EX) + +#define describe_connectua_instr(name, func, tgt, opt) \ +static INSTR(name##func) { \ + M_Object lhs, rhs; \ + connect_init(shred, &lhs, &rhs); \ + const m_uint rsz = m_vector_size(ARRAY(rhs)); \ + for(m_uint i = 0; i < rsz; ++i) { \ + M_Object urhs; \ + m_vector_get(ARRAY(rhs), i, &urhs); \ + opt \ + if(urhs) \ + _do_(func, UGEN(lhs), tgt); \ + } \ + release_connect(shred); \ +} +describe_connectua_instr(UgenUA, Connect, UGEN(urhs),) +describe_connectua_instr(UgenUA, Disconnect, UGEN(urhs),) +describe_connectua_instr(TrigUA, Connect, UGEN(urhs)->module.gen.trig, TRIG_EX) +describe_connectua_instr(TrigUA, Disconnect, UGEN(urhs)->module.gen.trig, TRIG_EX) + +#define describe_connectau_instr(name, func, tgt, opt) \ +static INSTR(name##func) { \ + M_Object lhs, rhs; \ + connect_init(shred, &lhs, &rhs); \ + const m_uint lsz = m_vector_size(ARRAY(lhs)); \ + for(m_uint i = 0; i < lsz; ++i) { \ + M_Object ulhs; \ + m_vector_get(ARRAY(lhs), i, &ulhs); \ + opt \ + if(ulhs) \ + _do_(func, UGEN(ulhs), tgt); \ + } \ + release_connect(shred); \ +} +describe_connectau_instr(UgenAU, Connect, UGEN(rhs),) +describe_connectau_instr(UgenAU, Disconnect, UGEN(rhs),) +describe_connectau_instr(TrigAU, Connect, UGEN(rhs)->module.gen.trig, TRIG_EX) +describe_connectau_instr(TrigAU, Disconnect, UGEN(rhs)->module.gen.trig, TRIG_EX) static CTOR(ugen_ctor) { UGEN(o) = new_UGen(shred->info->mp); -- 2.43.0