Page MenuHomeFreeBSD

D54038.id167526.diff
No OneTemporary

D54038.id167526.diff

diff --git a/share/examples/sound/oss.h b/share/examples/sound/oss.h
--- a/share/examples/sound/oss.h
+++ b/share/examples/sound/oss.h
@@ -112,16 +112,27 @@
}
/* Set sample format */
- if (ioctl(config->fd, SNDCTL_DSP_SETFMT, &config->format) < 0)
+ tmp = config->format;
+ if (ioctl(config->fd, SNDCTL_DSP_SETFMT, &tmp) < 0)
err(1, "Unable to set sample format");
+ if (tmp != config->format)
+ errx(1, "Unable to set sample format to %d."
+ "Check if you can set format to s32le with sndctl.\n",
+ config->format);
/* Set sample channels */
- if (ioctl(config->fd, SNDCTL_DSP_CHANNELS, &config->audio_info.max_channels) < 0)
+ tmp = config->audio_info.max_channels;
+ if (ioctl(config->fd, SNDCTL_DSP_CHANNELS, &tmp) < 0)
err(1, "Unable to set channels");
+ if (tmp != config->audio_info.max_channels)
+ errx(1, "Unable to set sample rate to %d.", config->audio_info.max_channels);
/* Set sample rate */
+ tmp = config->sample_rate;
if (ioctl(config->fd, SNDCTL_DSP_SPEED, &config->sample_rate) < 0)
err(1, "Unable to set sample rate");
+ if (tmp != config->sample_rate)
+ errx(1, "Unable to set sample rate to %d.", config->sample_rate);
/* Calculate sample size */
switch (config->format) {
@@ -197,10 +208,11 @@
config->chsamples = config->sample_count / config->audio_info.max_channels;
printf("bytes: %d, fragments: %d, fragsize: %d, fragstotal: %d, "
- "samples: %d\n",
+ "samples: %d, channels: %d, sample size: %d\n",
config->buffer_info.bytes, config->buffer_info.fragments,
config->buffer_info.fragsize, config->buffer_info.fragstotal,
- config->sample_count);
+ config->sample_count, config->audio_info.max_channels,
+ config->sample_size);
/* Set trigger direction and mmap protection */
switch (config->mode & O_ACCMODE) {

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 21, 5:08 PM (6 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26662496
Default Alt Text
D54038.id167526.diff (1 KB)

Event Timeline