Hi,

This option allows one to select the output device if they have more
than one audio device.

From 1c512d1302969155af94d478fcf0ce25098a07c2 Mon Sep 17 00:00:00 2001
From: sin <[email protected]>
Date: Wed, 22 Jun 2016 09:41:54 +0100
Subject: [PATCH 1/2] sndio: Add option to select output device

---
 src/output/plugins/SndioOutputPlugin.cxx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/output/plugins/SndioOutputPlugin.cxx 
b/src/output/plugins/SndioOutputPlugin.cxx
index b3b990a..12a161e 100644
--- a/src/output/plugins/SndioOutputPlugin.cxx
+++ b/src/output/plugins/SndioOutputPlugin.cxx
@@ -35,13 +35,14 @@
 class SndioOutput {
        friend struct AudioOutputWrapper<SndioOutput>;
        AudioOutput base;
+       const char *device;
        struct sio_hdl *sio_hdl;
        Timer *timer;
 
 public:
        SndioOutput()
                :base(sndio_output_plugin),
-                sio_hdl(nullptr) {}
+                device(nullptr), sio_hdl(nullptr) {}
        ~SndioOutput() {}
 
        bool Configure(const ConfigBlock &block, Error &error);
@@ -62,6 +63,11 @@ SndioOutput::Configure(const ConfigBlock &block, Error 
&error)
 {
        if (!base.Configure(block, error))
                return false;
+
+       device = block.GetBlockValue("device", nullptr);
+       if (!device)
+               device = SIO_DEVANY;
+
        return true;
 }
 
@@ -84,7 +90,7 @@ SndioOutput::Open(AudioFormat &audio_format, gcc_unused Error 
&error)
        struct sio_par par;
        unsigned bits, rate, chans;
 
-       sio_hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
+       sio_hdl = sio_open(device, SIO_PLAY, 0);
        if (!sio_hdl) {
                error.Format(sndio_output_domain, -1,
                             "Failed to open default sndio device");
-- 
2.8.4


_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to