view yetilab/stream/stream.yeti @ 138:f68c92bd2adb

Slightly better text placement
author Chris Cannam
date Tue, 23 Apr 2013 17:01:19 +0100
parents d0abc9afe608
children
line wrap: on
line source

module yetilab.stream.stream;

monoStream box =
   (readAll' box = box.read (box.len - box.position);
    {
        get position () = box.position,
        get channels () = 1,
        get sampleRate () = box.rate,
        get available () = box.len - box.position,
        get finished? () = not (box.len > box.position),
        read = box.read,
        readInterleaved = box.read,
        readMono = box.read,
        readAll () = readAll' box,
        readAllInterleaved () = readAll' box,
        readAllMono () = readAll' box,
        close = box.close,
    });

stream box = 
   ({
        get position () = box.position,
        get channels () = box.channels,
        get sampleRate () = box.rate,
        get available () = box.len - box.position,
        get finished? () = not (box.len > box.position),
        read = box.read,
        readInterleaved = box.readInterleaved,
        readMono = box.readMono,
        readAll () = box.read (box.len - box.position),
        readAllInterleaved () = box.readInterleaved (box.len - box.position),
        readAllMono () = box.readMono (box.len - box.position),
        close = box.close,
    });

{ monoStream, stream }