# HG changeset patch # User Chris Cannam # Date 1369395701 -3600 # Node ID b432db0b25292a6d46fbc756b6196eb6be1022fb # Parent df0836b48494199e68629fd3bfcd4f7fc89b78c1 Synchronise audio read diff -r df0836b48494 -r b432db0b2529 yetilab/stream/audiofile.yeti --- a/yetilab/stream/audiofile.yeti Thu May 23 21:36:20 2013 +0100 +++ b/yetilab/stream/audiofile.yeti Fri May 24 12:41:41 2013 +0100 @@ -97,14 +97,15 @@ aistream = AudioSystem#getAudioInputStream(f); format = aistream#getFormat(); len = available' { format, aistream }; // at start of stream + syncd = synchronized aistream; { - get position () = len - available' { aistream, format }, + get position () = syncd \(len - available' { aistream, format }), get channels () = if ch == 0 then format#getChannels() else ch fi, get sampleRate () = format#getSampleRate(), - get available () = Known (available' { aistream, format }), - get finished? () = not (aistream#available() > 0), - read = reader { aistream, format }, - close () = close' { aistream }, + get available () = syncd \(Known (available' { aistream, format })), + get finished? () = syncd \(not (aistream#available() > 0)), + read = syncd \(reader { aistream, format }), + close () = syncd \(close' { aistream }), }); open = openWithReader read' 0;