SolarisOutputPlugin: Support S8 and S32 encodings.
This commit is contained in:
parent
1f0881eec0
commit
8437b141a4
@ -97,10 +97,6 @@ SolarisOutput::Open(AudioFormat &audio_format)
|
|||||||
|
|
||||||
AUDIO_INITINFO(&info);
|
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 */
|
/* open the device in non-blocking mode */
|
||||||
|
|
||||||
if (!fd.Open(device, O_WRONLY|O_NONBLOCK))
|
if (!fd.Open(device, O_WRONLY|O_NONBLOCK))
|
||||||
@ -111,10 +107,23 @@ SolarisOutput::Open(AudioFormat &audio_format)
|
|||||||
|
|
||||||
fd.SetBlocking();
|
fd.SetBlocking();
|
||||||
|
|
||||||
|
/* configure the audio device */
|
||||||
|
|
||||||
info.play.sample_rate = audio_format.sample_rate;
|
info.play.sample_rate = audio_format.sample_rate;
|
||||||
info.play.channels = audio_format.channels;
|
info.play.channels = audio_format.channels;
|
||||||
info.play.precision = 16;
|
|
||||||
info.play.encoding = AUDIO_ENCODING_LINEAR;
|
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);
|
ret = ioctl(fd.Get(), AUDIO_SETINFO, &info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user