Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142533439
D54038.id167526.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54038.id167526.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D54038: sound examples: Check if setting property was successful
Attached
Detach File
Event Timeline
Log In to Comment