Hey Scott (and whoever else might be working on this!),
I've been experimenting with NML/Utopia and want to share a closed function using an OSCObjectSpace, but I have problems when I execute the following code.
(
~aFunc = {\test.postln};
~peer1 = Peer(\me1, NetAddr.localAddr);
~addrBook1 = AddrBook().addMe(~peer1);
~objSpace1 = OSCObjectSpace(~addrBook1, oscPath:'/objSpace'); // me1's local copy
~objSpace1.put(\me1, ~aFunc); // me1 adds her Server addr
)
Here's the error I get:
ERROR: cannot archive Frames.
ERROR: Primitive '_AsArchive' failed.
Failed.
RECEIVER:
Instance of Function { (0x11479a5d8, gc=88, fmt=00, flg=80, set=02)
instance variables [2]
def : instance of FunctionDef - closed
context : Frame (0x10b903658) of Interpreter:functionCompileContext
}
PATH: /Users/grahambooth/Library/Application Support/SuperCollider/Extensions/Utopia-master/classes/NMLRelays.sc
CALL STACK:
MethodError:reportError 0x1134465d8
arg this =
Nil:handleError 0x113446aa8
arg this = nil
arg error =
Thread:handleError 0x113449a18
arg this =
arg error =
Object:throw 0x1134477b8
arg this =
Object:primitiveFailed 0x11344c408
arg this =
OSCObjectSpace:updatePeers 0x113451ec8
arg this =
arg key = 'me1'
arg value =
AbstractOSCDataSpace:put 0x10b796818
arg this =
arg key = 'me1'
arg value =
OSCObjectSpace:put 0x1134bba68
arg this =
arg key = 'me1'
arg value =
Interpreter:interpretPrintCmdLine 0x114b22218
arg this =
var res = nil
var func =
var code = "(
~aFunc = {\test.postln};
~..."
var doc =
var ideClass =
Process:interpretPrintCmdLine 0x10b741f38
arg this =
^^ The preceding error dump is for ERROR: Primitive '_AsArchive' failed.
Failed.
RECEIVER: a Function
Here's my own attempt to archive the function:
~aFunc.asBinaryArchive
This doesn't throw an error, and return (correctly I think) an Int8Array.
However when the same thing is done in the OSCObjectSpace source (value.asBinaryArchive, where value is apparently the self-same function), the frame error occurs.
updatePeers {|key, value|
addrBook.sendExcluding(addrBook.me.name, oscPath, key, encryptor.encryptBytes(value.asBinaryArchive));
}
Everything seems okay here:
OSCObjectSpace:updatePeers 0x113451ec8
arg this = <instance of OSCObjectSpace>
arg key = 'me1'
arg value = <instance of Function>
Any ideas? I guess the other way to do it would be archive the function as a compile string and share that using an OSCDataSpace, but that seems clunky.
Any help appreciated.
Regards,
Graham