int fragsize;
const char *devpath_out;
const char *devpath_in;
+ int debug;
} conf = {
.try_mmap = 0,
.nfrags = 4,
.fragsize = 4096,
.devpath_out = "/dev/dsp",
- .devpath_in = "/dev/dsp"
+ .devpath_in = "/dev/dsp",
+ .debug = 0
};
struct oss_params {
{
va_list ap;
+ va_start (ap, fmt);
AUD_vlog (AUDIO_CAP, fmt, ap);
+ va_end (ap);
- va_start (ap, fmt);
AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err));
- va_end (ap);
}
static void GCC_FMT_ATTR (3, 4) oss_logerr2 (
return 0;
}
- if (abinfo.bytes < 0 || abinfo.bytes > bufsize) {
- ldebug ("warning: Invalid available size, size=%d bufsize=%d\n",
- abinfo.bytes, bufsize);
+ if (abinfo.bytes > bufsize) {
+ if (conf.debug) {
+ dolog ("warning: Invalid available size, size=%d bufsize=%d\n"
+ abinfo.bytes, bufsize);
+ }
+ abinfo.bytes = bufsize;
+ }
+
+ if (abinfo.bytes < 0) {
+ if (conf.debug) {
+ dolog ("warning: Invalid available size, size=%d bufsize=%d\n",
+ abinfo.bytes, bufsize);
+ }
return 0;
}
"alignment %d\n",
wbytes, written, hw->info.align + 1);
}
- mixeng_clear (src, wsamples);
decr -= wsamples;
rpos = (rpos + wsamples) % hw->samples;
break;
}
}
- mixeng_clear (src, convert_samples);
-
rpos = (rpos + convert_samples) % hw->samples;
samples -= convert_samples;
}
audfmt_e effective_fmt;
audsettings_t obt_as;
+ oss->fd = -1;
+
req.fmt = aud_to_ossfmt (as->fmt);
req.freq = as->freq;
req.nchannels = as->nchannels;
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
+ obt_as.endianness = endianness;
- audio_pcm_init_info (
- &hw->info,
- &obt_as,
- audio_need_to_swap_endian (endianness)
- );
+ audio_pcm_init_info (&hw->info, &obt_as);
oss->nfrags = obt.nfrags;
oss->fragsize = obt.fragsize;
1 << hw->info.shift
);
if (!oss->pcm_buf) {
- dolog ("Could not allocate DAC buffer (%d bytes)\n",
- hw->samples << hw->info.shift);
+ dolog (
+ "Could not allocate DAC buffer (%d samples, each %d bytes)\n",
+ hw->samples,
+ 1 << hw->info.shift
+ );
oss_anal_close (&fd);
return -1;
}
audfmt_e effective_fmt;
audsettings_t obt_as;
+ oss->fd = -1;
+
req.fmt = aud_to_ossfmt (as->fmt);
req.freq = as->freq;
req.nchannels = as->nchannels;
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
+ obt_as.endianness = endianness;
- audio_pcm_init_info (
- &hw->info,
- &obt_as,
- audio_need_to_swap_endian (endianness)
- );
+ audio_pcm_init_info (&hw->info, &obt_as);
oss->nfrags = obt.nfrags;
oss->fragsize = obt.fragsize;
hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!oss->pcm_buf) {
- dolog ("Could not allocate ADC buffer (%d bytes)\n",
- hw->samples << hw->info.shift);
+ dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
+ hw->samples, 1 << hw->info.shift);
oss_anal_close (&fd);
return -1;
}
if (nread > 0) {
if (nread & hw->info.align) {
- dolog ("warning: Misaligned read %d (requested %d), "
+ dolog ("warning: Misaligned read %zd (requested %d), "
"alignment %d\n", nread, bufs[i].add << hwshift,
hw->info.align + 1);
}
"Path to DAC device", NULL, 0},
{"ADC_DEV", AUD_OPT_STR, &conf.devpath_in,
"Path to ADC device", NULL, 0},
+ {"DEBUG", AUD_OPT_BOOL, &conf.debug,
+ "Turn on some debugging messages", NULL, 0},
{NULL, 0, NULL, NULL, NULL, 0}
};