[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-dev] [commit] Still More OSCresponder issues
On 21 Nov 2004, at 12:42, Julian Rohrhuber wrote:
I think there are no errors due to this. There is a bad OSCresponder problem, but I believe it is not due to this.
Not copying the array saves calculation in this time critical place.
Here is an error due to this problem. Try this with the old version of OSCMultiResponder-value:
<x-tad-smaller>(
s = </x-tad-smaller><x-tad-smaller>Server</x-tad-smaller><x-tad-smaller>.local;
s.boot;
)
(
</x-tad-smaller><x-tad-smaller>"help-SendTrig"</x-tad-smaller><x-tad-smaller>,{
</x-tad-smaller><x-tad-smaller>Dust</x-tad-smaller><x-tad-smaller>.kr(0.1), 0, 0.9);
}).send(s);
</x-tad-smaller><x-tad-smaller>// register to receive this message</x-tad-smaller><x-tad-smaller>
</x-tad-smaller><x-tad-smaller>a = OSCresponderNode</x-tad-smaller><x-tad-smaller>(s.addr, </x-tad-smaller><x-tad-smaller>'/tr'</x-tad-smaller><x-tad-smaller>, { </x-tad-smaller><x-tad-smaller>arg</x-tad-smaller><x-tad-smaller> time, responder, msg;
[time, responder, msg].postln; responder.remove;
}).add;
</x-tad-smaller><x-tad-smaller>b = OSCresponderNode</x-tad-smaller><x-tad-smaller>(s.addr, </x-tad-smaller><x-tad-smaller>'/tr'</x-tad-smaller><x-tad-smaller>, { </x-tad-smaller><x-tad-smaller>arg</x-tad-smaller><x-tad-smaller> time, responder, msg;
[time, responder, msg].post; "this is another call".postln; responder.remove;
}).add;
)
</x-tad-smaller><x-tad-smaller>x = Synth</x-tad-smaller><x-tad-smaller>.new(</x-tad-smaller><x-tad-smaller>"help-SendTrig"</x-tad-smaller><x-tad-smaller>);
a.remove;
b.remove;
x.free;
</x-tad-smaller>
The first responder executes and removes itself. Since the Set 'all' is now one smaller, Set-do thinks it's reached the end of its array, and the second responder will not respond until the next trigger. This defeats the whole purpose of having OSCresponderNode, i.e. multiple responses to the same cmd.
Since removing a responder when it responds is a pretty basic and obvious thing to do, I don't see any other way around this. You need to copy the Set. But if you have a better way...?
S.