ftp.nice.ch/pub/next/connectivity/news/NewsBase.3.02.s.tar.gz#/NewsBase302.source/MMEdit/ITimedSound.m

This is ITimedSound.m in view mode; [Download] [Up]

#import "ITimedSound.h"
#import <libc.h>

@implementation ITimedSound

- (double)time
{
    return(time);
}

- setTime:(double)theTime
{
    time = theTime;
}

- writeStream:(NXStream *)stream
{
    char tempFile[64];
    NXStream *tempStream;
    const char *buffer;
    int len;
    int maxLen;

    sprintf(tempFile, "/tmp/VDR%d.snd", getpid());
    [self writeSoundfile:tempFile];
    tempStream = NXMapFile(tempFile, NX_READONLY);
    NXGetMemoryBuffer(tempStream, &buffer, &len, &maxLen);
    NXWrite(stream, buffer, len);
    NXCloseMemory(tempStream, NX_FREEBUFFER);
    unlink(tempFile);
    return(self);
}

- readStream:(NXStream *)stream
{
    char tempFile[64];

    sprintf(tempFile, "/tmp/VDR%d.snd", getpid());
    NXSaveToFile(stream, tempFile);
    [self readSoundfile:tempFile];
    unlink(tempFile);
    return(self);
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.