chiark / gitweb /
The command backend now supports the old (suspending) and new
[disorder] / lib / uaudio-command.c
index 5e4531ee03589c5c2a6e5c891538ecd13f5fe382..812a3f26a2c2678220ccccb48178549c4f54497b 100644 (file)
@@ -44,6 +44,7 @@ static pid_t command_pid;
 
 static const char *const command_options[] = {
   "command",
+  "pause-mode",
   NULL
 };
 
@@ -115,13 +116,23 @@ static size_t command_play(void *buffer, size_t nsamples) {
 
 static void command_start(uaudio_callback *callback,
                       void *userdata) {
+  const char *pausemode = uaudio_get("pause-mode", "silence");
+  unsigned flags = 0;
+
+  if(!strcmp(pausemode, "silence"))
+    flags |= UAUDIO_THREAD_FAKE_PAUSE;
+  else if(!strcmp(pausemode, "suspend"))
+    ;
+  else
+    fatal(0, "unknown pause mode '%s'", pausemode);
   command_open();
   uaudio_schedule_init();
   uaudio_thread_start(callback,
                       userdata,
                       command_play,
                       uaudio_channels,
-                     4096 / uaudio_sample_size);
+                     4096 / uaudio_sample_size,
+                      flags);
 }
 
 static void command_stop(void) {