return audio_pcm_sw_write (sw, buf, len);
}
-static int aud_to_ossfmt (audfmt_e fmt)
+static int aud_to_ossfmt (audfmt_e fmt, int endianness)
{
switch (fmt) {
case AUD_FMT_S8:
return AFMT_U8;
case AUD_FMT_S16:
- return AFMT_S16_LE;
+ if (endianness) {
+ return AFMT_S16_BE;
+ }
+ else {
+ return AFMT_S16_LE;
+ }
case AUD_FMT_U16:
- return AFMT_U16_LE;
+ if (endianness) {
+ return AFMT_U16_BE;
+ }
+ else {
+ return AFMT_U16_LE;
+ }
default:
dolog ("Internal logic error: Bad audio format %d\n", fmt);
oss->fd = -1;
- req.fmt = aud_to_ossfmt (as->fmt);
+ req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;
oss->fd = -1;
- req.fmt = aud_to_ossfmt (as->fmt);
+ req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;