[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] Servers with nil latency?



Hi James, Julian, Alberto,

Right now, OSC commands are scheduled both by the language and by the timestamp received by the server. The note ons are all scheduled directly via the timestamp while the note offs use the clock of thisThread. Seems like it would be simpler to schedule everything on the language clock up to the server latency.

yes, please, and better too for tempo changes.

I also would love to have an ~offset key that offsets the start of the event relative to tempo (unlike ~lag)



Then we can reserve any reference to server.latency to scheduling the bundle.

Then James can use latency as a field in the Event (where it would default to 0)

wouldn't latency of 0 result in late messages?


So, here are two functions to take care of the basic OSC commands. (Factoring it into functions will make the implementation of Pattern:asScore simpler and make it possible to write Event:asBundle.)

~schedBundle { | time, server, bundle |
	if (time == 0) {
		server.sendBundle(server.latency, bundle)
	} {
thisThread.sched ( time, { server.sendBundle(server.latency, bundle) })
	}
}

~schedSustainedBundle { |time, server, bundle, sustain, releaseBundle |
	if (time == 0) {
		server.sendBundle(server.latency, bundle)
	} {
thisThread.sched ( time, { server.sendBundle(server.latency, bundle) })
	};
thisThread.sched ( time + sustain, { server.sendBundle(server.latency, releaseBundle) });
}

In the default note routine there would be no reference to Server.latency.
Instead you would have:

		lag = ~lag + ~latency;


with ~latency = 0 by default and altered when using James' priority scheme.

And, down where the note plays:
	if (hasGate) {
		bndl.do {|msgArgs, i|
			var id, dt;



			dt = i * strum + lag;
			id = server.nextNodeID;
~schedSustainedBundle.value(dt, server, [\s_new, instrumentName, id, addAction, group] ++ msgArgs, sustain, [\n_set, id, \gate, 0])
		}
	} {
		bndl.do {|msgArgs, i|
			var id, dt;



			dt = i * strum + lag;
			id = server.nextNodeID;
~schedBundle.value(dt, server, [\s_new, instrumentName, id, addAction, group] ++ msgArgs)
		}
	}





_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel


--





.