[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] OSCFunc oneShot is breakable because of careless FunctionList implementation
- To: sc-dev <sc-dev@xxxxxxxxxxxxxxxx>
- Subject: [sc-dev] OSCFunc oneShot is breakable because of careless FunctionList implementation
- From: James Harkins <jamshark70@xxxxxxxxx>
- Date: Mon, 09 Dec 2013 15:54:59 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:mime-version:message-id :content-type:content-transfer-encoding; bh=D9Aj+fUr5l6D/ZZSbqnr34CFQgBmZ9t6P/SbuTpWB9A=; b=i/6O0exoSDP4ssXNAANsIdp0qbKwS2EIGU6T+8Hd9/b2Xrq0CDE5pNKKrlJa4m07af Yi3n5IOYxrI6ZgVFNTdJ1C6WLtOMIZ3VGFe30gNoMc8syiibXkxW6eh3LTZTeDdQZRmz dD8WK31ba4LmsepPS5u4gWsM4y4Xxx/5aPWH8P2joBlGKotXdnHLp/haQCXMbk/Qle5Q BxMfCgwWtu6QFwHVOoEPFYlOPKYzKqJKzF1KU1XoLWrjXz8iLZY2i2Uy7dvSLrIJHVFk YEZ8dQZ+ODp88N52EL/nWBSc8xScCfnTiHI9cFvL8ljPH0cu7MqIen1alxlXcROQ8hNg RbHw==
- List-id: SuperCollider developers mailing list <sc-devel.create.ucsb.edu>
- Reply-to: sc-dev@xxxxxxxxxxxxxxxx
- Sender: owner-sc-dev@xxxxxxxxxxxxxxxx
- User-agent: Trojita/v0.3.96-git; Qt/4.8.1; X11; Linux; Ubuntu 12.04.3 LTS
(
fork {
a = { |gate = 1| (SinOsc.ar(440) * Linen.kr(gate, 0.1, 1, 0.2, doneAction:
2)) ! 2 }.play;
o.free;
o = OSCFunc({ |msg| msg.postln; o.free }, '/n_end', s.addr);
0.1.wait;
OSCFunc.allFuncProxies.debug("while playing");
// a.release;
};
)
"o" never fires. It doesn't, because the dispatcher for '/n_end' contains a
FunctionList of two entries. One of them is a oneShot OSCFunc, created by
Function:play.
"oneShot" removes the OSCFunc after it fires.* This modifies FunctionList's
array while iterating over it. And we all know what happens when we do
that...
* The same would occur if Function:play stored its OSCFunc in a variable,
and did "oscfunc.free" inside the OSCFunc. That is, this bug isn't to say
that oneShot is a bad idea -- rather, that OSCFunc relies on FunctionList
to do its job properly, but it doesn't.
"array.copy.do" would add some overhead to every FunctionList invocation.
That's the safest fix, but I suppose it's worth considering the performance
impact.
Apologies if there's a slightly cranky tone here. I was just trying to make
a plot of some amplitude curves for a class presentation, and... 30 minutes
gone to chase down a random problem. I'm getting tired of /debugging/ when
I should be /using/. Let's get moving on SC4, and clean up this kind of
nonsense?
hjh
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/