Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147316381
D54038.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D54038.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,28 @@
}
/* 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)
+ warnx("Format: requested=%08x, got=%08x", config->format, tmp);
+ config->format = tmp;
/* 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)
+ warnx("Channels: requested=%d, got=%d", config->audio_info.max_channels, tmp);
+ config->audio_info.max_channels = tmp;
/* 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)
+ warnx("Sample rate: requested=%d, got=%d", config->sample_rate, tmp);
+ config->sample_rate = tmp;
/* Calculate sample size */
switch (config->format) {
@@ -197,10 +209,12 @@
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, sample rate: %d, "
+ "format: %08x\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, config->sample_rate, config->format);
/* Set trigger direction and mmap protection */
switch (config->mode & O_ACCMODE) {
diff --git a/share/examples/sound/simple.c b/share/examples/sound/simple.c
--- a/share/examples/sound/simple.c
+++ b/share/examples/sound/simple.c
@@ -29,6 +29,7 @@
* SUCH DAMAGE.
*/
+#include <sys/soundcard.h>
#include "oss.h"
/*
@@ -115,6 +116,9 @@
int rc, bytes;
oss_init(&config);
+ if (config.format != AFMT_S32_NE)
+ errx(1, "Device doesn't support signed 32bit samples. "
+ "Check with 'sndctl' if it can be configured for 's32le' format.");
bytes = config.buffer_info.bytes;
channels = malloc(bytes);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 10, 10:05 PM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29515245
Default Alt Text
D54038.diff (2 KB)
Attached To
Mode
D54038: sound examples: Check if setting property was successful
Attached
Detach File
Event Timeline
Log In to Comment