From 8437b141a4c053741f1d346599da659de0e529ac Mon Sep 17 00:00:00 2001 From: nia Date: Tue, 14 Apr 2020 14:36:31 +0100 Subject: [PATCH] SolarisOutputPlugin: Support S8 and S32 encodings. --- src/output/plugins/SolarisOutputPlugin.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/output/plugins/SolarisOutputPlugin.cxx b/src/output/plugins/SolarisOutputPlugin.cxx index 1e41d708a..3f0390e87 100644 --- a/src/output/plugins/SolarisOutputPlugin.cxx +++ b/src/output/plugins/SolarisOutputPlugin.cxx @@ -97,10 +97,6 @@ SolarisOutput::Open(AudioFormat &audio_format) AUDIO_INITINFO(&info); - /* support only 16 bit mono/stereo for now; nothing else has - been tested */ - audio_format.format = SampleFormat::S16; - /* open the device in non-blocking mode */ if (!fd.Open(device, O_WRONLY|O_NONBLOCK)) @@ -111,10 +107,23 @@ SolarisOutput::Open(AudioFormat &audio_format) fd.SetBlocking(); + /* configure the audio device */ + info.play.sample_rate = audio_format.sample_rate; info.play.channels = audio_format.channels; - info.play.precision = 16; info.play.encoding = AUDIO_ENCODING_LINEAR; + switch (audio_format.format) { + case SampleFormat::S8: + info.play.precision = 8; + break; + case SampleFormat::S16: + info.play.precision = 16; + break; + default: + info.play.precision = 32; + audio_format.format = SampleFormat::S32; + break; + } ret = ioctl(fd.Get(), AUDIO_SETINFO, &info); if (ret < 0) {