SolarisOutputPlugin: Support S8 and S32 encodings.

This commit is contained in:
nia 2020-04-14 14:36:31 +01:00
parent 1f0881eec0
commit 8437b141a4
1 changed files with 14 additions and 5 deletions

View File

@ -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) {