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

[sc-users] Hello & an archive problem



Hi!

This is my first posting to sc-users. I'm very glad this list exists.

At the moment I'm having a problem archiving objects and I don't
really understand what's going wrong.

I would like to archive an object that looks like this:

Instance of SonOptParMap {    (04F1A7A0, gc=D4, fmt=00, flg=80, set=04)
  instance variables [9]
    mixture : instance of Array (04F70110, size=5, set=3)
    span : instance of Array (04F5DDA0, size=5, set=3)
    position : instance of Array (04F54310, size=5, set=3)
    scores : instance of Array (055839D0, size=3, set=2)
    duration : Integer 2
    synth : nil
    dsets : instance of Array (04F32D60, size=3, set=2)
    timeBetween : Float 0.7   3FE66666 66666666
    totalDuration : Float 7.3999999999999995   401D9999 99999999
}

I'm using writeBinaryArchive in a CocoaDialog action. The file
created is only 17 bytes long.

Contents are:

00000000  21 53 43 61 00 00 00 02  00 00 00 00 6f 00 00 00  |!SCa........o...|
00000010  00                                                |.|

When I load this object shortly afterwards with loadBinaryArchive,
the following error (understandably) appears:

ERROR: Primitive '_ReadArchive' failed.
Wrong type.
RECEIVER:
class SonOptParMap (04A5EDC0) {
  instance variables [17]
    name : Symbol 'SonOptParMap'
    nextclass : class SortedList (04E8E3F0)
    superclass : Symbol 'Object'
    subclasses : nil
    methods : instance of Array (04A5EE70, size=35, set=6)
    instVarNames : instance of SymbolArray (04A5F0A0, size=9, set=3)
    classVarNames : nil
    iprototype : instance of Array (04A5F110, size=9, set=4)
    cprototype : nil
    instanceFormat : Integer 0
    instanceFlags : Integer 0
    classIndex : Integer 203
    classFlags : Integer 0
    maxSubclassIndex : Integer 203
    filenameSymbol : Symbol '/Users/flavour/Library/Application Support/SuperCollider/Extensions/pgsonopt/SonOptParMap.sc'
    charPos : Integer 1
    classVarIndex : Integer 57
}
CALL STACK:
    MethodError-reportError   05765E50
        arg this = <instance of PrimitiveFailedError>
    Nil-handleError   05765DF0
        arg this = nil
        arg error = <instance of PrimitiveFailedError>
    Object-throw   05765CD0
        arg this = <instance of PrimitiveFailedError>
    Object-primitiveFailed   05765C10
        arg this = class SonOptParMap
    < FunctionDef in Method SonControl-init >   05765BB0
        arg path = [*1]
    Meta_CocoaDialog-ok   05765B50
        arg this = class CocoaDialog
        var res = [*1]

I tried using the *TextArchive functions, but they didn't do what I
thought they did either (not mentioning the system crashes where sc
hogged the whole OS)

When I use the *BinaryArchive functions on something easier like a
Point object, it is correctly serialized and unserialized later.

So at the moment I'm pretty confused how I can load and save my
object with its contents to and from disk. Any ideas what's going
wrong here?

Thanks in advance,
Thorsten