784a166b2ab4 — Chris Cannam 3 months ago
Provide a friendlier representation with times converted
1 files changed, 9 insertions(+), 0 deletions(-)

M samplestream-types.sml
M samplestream-types.sml +9 -0
@@ 106,6 106,15 @@ structure SampleStreamTypes = struct
            | SEEK_NONBLOCKING => "non-blocking"
            | SEEK_WITH_DEADLINE t => "with-deadline " ^ Time.toString t
            | SEEK_WITH_BUDGET t => "with-budget " ^ Time.toString t
+                
+    fun seekModeToFriendlyString (m : seek_mode) =
+        case m of
+             SEEK_COMPLETE => "complete"
+           | SEEK_NONBLOCKING => "non-blocking"
+           | SEEK_WITH_DEADLINE t => "with-deadline " ^ Time.toString t ^
+                                     " [remaining budget " ^
+                                     Time.toString (Time.- (t, Time.now ())) ^ "]"
+           | SEEK_WITH_BUDGET t => "with-budget " ^ Time.toString t
 
     (** Return a seek mode that is effectively the given seek mode
         divided by the given divisor, for use when dispatching