d289a6c0ddbc — Chris Cannam 29 days ago
Add an explicit mechanism to call finish (if we aren't reading to the end)
1 files changed, 6 insertions(+), 0 deletions(-)

M audiofile.sml
M audiofile.sml +6 -0
@@ 27,6 27,7 @@ structure AudioFileReadStream : sig
               } * BqAudioReadStream.t -> stream
 
               val error : stream -> string option
+              val finish : stream -> unit
                           
           end = struct
 

          
@@ 63,6 64,11 @@ structure AudioFileReadStream : sig
                            
     fun error ({ error, ... } : stream) = error
 
+    fun finish ( { finish, ... } : stream) =
+        case ! finish of
+            NONE => ()
+          | SOME f => (finish := NONE; f ())
+                                              
     fun read ({ upstream = ref NONE, ... } : stream, _) = NONE
       | read ({ upstream, rate, channels, position,
                 filename, finish, error } : stream,