sndio: Add option to select output device
This commit is contained in:
parent
2c7bda8a3b
commit
8aa61e230c
@ -40,13 +40,14 @@
|
|||||||
class SndioOutput {
|
class SndioOutput {
|
||||||
friend struct AudioOutputWrapper<SndioOutput>;
|
friend struct AudioOutputWrapper<SndioOutput>;
|
||||||
AudioOutput base;
|
AudioOutput base;
|
||||||
|
const char *device;
|
||||||
struct sio_hdl *sio_hdl;
|
struct sio_hdl *sio_hdl;
|
||||||
Timer *timer;
|
Timer *timer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SndioOutput()
|
SndioOutput()
|
||||||
:base(sndio_output_plugin),
|
:base(sndio_output_plugin),
|
||||||
sio_hdl(nullptr) {}
|
device(nullptr), sio_hdl(nullptr) {}
|
||||||
~SndioOutput() {}
|
~SndioOutput() {}
|
||||||
|
|
||||||
bool Configure(const ConfigBlock &block, Error &error);
|
bool Configure(const ConfigBlock &block, Error &error);
|
||||||
@ -67,6 +68,7 @@ SndioOutput::Configure(const ConfigBlock &block, Error &error)
|
|||||||
{
|
{
|
||||||
if (!base.Configure(block, error))
|
if (!base.Configure(block, error))
|
||||||
return false;
|
return false;
|
||||||
|
device = block.GetBlockValue("device", SIO_DEVANY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ SndioOutput::Open(AudioFormat &audio_format, gcc_unused Error &error)
|
|||||||
struct sio_par par;
|
struct sio_par par;
|
||||||
unsigned bits, rate, chans;
|
unsigned bits, rate, chans;
|
||||||
|
|
||||||
sio_hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
|
sio_hdl = sio_open(device, SIO_PLAY, 0);
|
||||||
if (!sio_hdl) {
|
if (!sio_hdl) {
|
||||||
error.Format(sndio_output_domain, -1,
|
error.Format(sndio_output_domain, -1,
|
||||||
"Failed to open default sndio device");
|
"Failed to open default sndio device");
|
||||||
|
Loading…
Reference in New Issue
Block a user