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

Re: [sc-users] Hello & an archive problem




writeBinaryArchive should not be used, and should probably be removed from the distro.
at the very least there should be a warning comment on the methods.


On Sep 5, 2005, at 3:38 PM, Thorsten Stocksmeier wrote:


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)

as soon as you change any one of these instance variables the entire application will be corrupted. james has declared it unsafe (in an email on the list a year ago or something).


  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
}



have a look at ZArchive, it may or may not do what you want.
read the help file.


alternatively you could implement storeArgs to return

storeArgs {
    ^[ mixture, span, position, scores, duration ]
}
or whatever
in the same order as your constructor will require for SonOptParMap

then you can just save it as a compile string

thing.asCompileString.write(path)

thing = path.load;

since its probably small.
ZArchive is good at large datasets as it implements compression.

-cx