Hi, I think I was not very clear. You’re of course right that system clock VS server clock is irrelevant for OSC bundles, e.g. the following two lines should be equivalent:
SystemClock.sched(0.1, { s.sendBundle(0.1, ['/foo', 1, 2, 3]) }); // total latency of 0.2 s
s.sendBundle(0.2, ['/foo', 1, 2, 3]) ; // total latency of 0.2 s
But even the following doesn’t really work:
SystemClock.sched(0.2, { s.sendBundle(0, ['/foo', 1, 2, 3]) }); // total latency of 0.2 s + some delay
because the message is scheduled with 0 latency. When the OSC bundle arrives at the Server, it will already be too late (the timestamp is in the past).
Another problem is that Pbind \midi
- unlike other Pbind types - directly calls instance methods instead of scheduling OSC messages as bundles, so this is what actually happens under the hood with lag: 0.2
:
SystemClock.sched(0.2, { ~midiout.noteOn(0, 60, 127) }); // noteOn internally calls s.sendMsg!
The message is only delayed in the language, but not scheduled on the Server. Also, the actual delay will be more than 0.2 s because it takes some indeterminate amount of time for the message to arrive at the Server (where it is executed immediately). This is what I meant with “imprecise”.
This is the behavior I want for Pbind + VSTPluginController:
server.sendBundle(server.latency, ~midiout.noteOnMsg(0, 60, 127));
My plan is now to write custom Event types, e.g. \vstmidi
for MIDI messages and \vstset
for setting parameters, which do the right thing under the hood. Does this sound alright?