Open
Description
Not really an issue, but while trying to add support for utf8 encoded string arguments to my application, I found out osc's reader / writer functions could not be overridden easily due to the module's structure that uses a scoped copy of the osc
variable (if I understood correctly).
Anyway, I ended up with the following workaround:
// require this file in node instead of 'osc'
var osc = require('osc/src/osc.js'),
transports = require('osc/src/platforms/osc-node.js'),
utf8 = require('utf8')
// import needed transport modules
osc.UDPPort = transports.UDPPort
osc.TCPSocketPort = transports.TCPSocketPort
osc.writeUtfString = (str)=>{
return osc.writeString(utf8.encode(str))
}
osc.readUtfString = (dv, offsetState)=>{
return utf8.decode(osc.readString(dv, offsetState))
}
osc.argumentTypes.s = osc.argumentTypes.S = {
reader: 'readUtfString',
writer: 'writeUtfString'
}
module.exports = osc
Metadata
Metadata
Assignees
Labels
No labels