[comp.sys.next] unarchiving sounds

cfcgf@ux1.cts.eiu.edu (Chuck Fleming) (04/30/91)

I'm having some trouble unarchiving a list of objects which
contain sounds.  More specifically, I have a subclass of Text,
called SoundText, which has an instance variable for an 
associated sound.  I store a collection of SoundText objects  
in a List object.  The list is then archived using
   NXWriteRootObject(typedStream, soundTextList);
   
The write: method for SoundText is
- write:(NXTypedStream *)stream
{
   [super write:stream];
   NXWriteObject(stream, aSound);
   return self;
}

If [aSound play] is inserted before the return, the sounds
sound just fine (just before they are written to the disk).

The list is unarchived using
    soundTextList = NXReadObject(typedStream);
    
The read method for SoundText is
- read:(NXTypedStream *)stream
{
   [super read:stream];
   aSound = NXReadObject(stream);
   return self;
}

If [aSound play] is inserted just before the return, the sounds
can be heard, but they all end with a large crack.  When
displayed in a sound view, there is a big drop in the waveform at
the end of the data.

The sound data seems to be getting corrupted.
Can anyone tell me what's going on here, and how to get rid of
the drop off.
Thanks

chuck
cfcgf@eiu.edu