Player
Registers a callback to be called when an OSC message is received.
The callback
is called with an array of OscMessage received between the previous frame and the current frame.
If called multiple times, only the last registration is valid.
However, the callback is not called if any of the following conditions are met:
false
/cluster/
(reserved by the system)// Log the received OSC messages
_.oscHandle.onReceive(messages => {
const lines = [];
messages.forEach((message, i) => {
const { address, timestamp, values } = message;
lines.push(`== message [${i + 1}/${messages.length}]`);
lines.push(`address: ${address}`);
lines.push(`timestamp: ${new Date(timestamp).toLocaleString()}`);
values.forEach((value, j) => {
lines.push(`= value [${j + 1}/${values.length}]`);
lines.push(`getInt(): ${value.getInt()}`);
lines.push(`getFloat(): ${value.getFloat()}`);
lines.push(`getAsciiString(): ${value.getAsciiString()}`);
lines.push(`getBlobAsUint8Array(): ${value.getBlobAsUint8Array()}`);
lines.push(`getBlobAsUtf8String(): ${value.getBlobAsUtf8String()}`);
lines.push(`getBool(): ${value.getBool()}`);
});
});
_.log(lines.join("\n"));
});
messages: The array of received OSC messages.
Generated using TypeDoc
The handle to receive Open Sound Control (OSC) messages. This handle can be obtained by PlayerScript.oscHandle.
For more information about OSC, refer to the OpenSoundControl Specification 1.0.