« Return to Thread: [approve] Dionysos's Env:test bug

[approve] Dionysos's Env:test bug

by James Harkins-2 :: Rate this Message:

Reply to Author | View in Thread

The problem is in the use of s.bind instead of fork to handle the server sync. Bind collects all the messages into one bundle, but for sustaining envelopes, the release message must be sent separately.

Even though we are post-RC, is it uncontroversial enough to correct this? It would avoid some new user confusion.

I also prefer cleaning up temporary synthdefs when they're not needed. OSCpathResponder added to do this (but only if server notifications are on).

test { arg releaseTime = 3.0;
var id, def, s;
s = Server.default;
if(s.serverRunning.not) { "Server not running.".warn; ^this };
id = s.nextNodeID;
fork {
def = { arg gate=1;
Out.ar(0,
SinOsc.ar(800, pi/2, 0.3) * EnvGen.ar(this, gate, doneAction:2)
)
}.asSynthDef;
def.send(s);
s.sync;
s.sendBundle(s.latency, [9, def.name, id]);
if(s.notified) {
OSCpathResponder(s.addr, ['/n_end', id], { |time, responder, message|
s.sendMsg(\d_free, def.name);
responder.remove;
}).add;
};
if(this.isSustained) { s.sendBundle(s.latency + releaseTime, [15, id, \gate, 0]) };
};
}


hjh


: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

 « Return to Thread: [approve] Dionysos's Env:test bug