Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/audiocfg Rename some members in adev for clarity. N...
details: https://anonhg.NetBSD.org/src/rev/4f74cf323c6d
branches: trunk
changeset: 453720:4f74cf323c6d
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Aug 24 03:28:37 2019 +0000
description:
Rename some members in adev for clarity. No functional changes intended.
diffstat:
usr.bin/audiocfg/audiodev.c | 32 ++++++++++++++++----------------
usr.bin/audiocfg/audiodev.h | 6 +++---
usr.bin/audiocfg/main.c | 20 ++++++++++++--------
3 files changed, 31 insertions(+), 27 deletions(-)
diffs (178 lines):
diff -r 476ef93c69f8 -r 4f74cf323c6d usr.bin/audiocfg/audiodev.c
--- a/usr.bin/audiocfg/audiodev.c Fri Aug 23 19:26:02 2019 +0000
+++ b/usr.bin/audiocfg/audiodev.c Sat Aug 24 03:28:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.7 2019/05/08 14:36:12 isaki Exp $ */
+/* $NetBSD: audiodev.c,v 1.8 2019/08/24 03:28:37 isaki Exp $ */
/*
* Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -63,26 +63,26 @@
if (stat(_PATH_AUDIOCTL, &st) != -1 && st.st_rdev == adev->dev)
adev->defaultdev = true;
- adev->fd = open(adev->ctlpath, O_RDONLY);
- if (adev->fd == -1) {
+ adev->ctlfd = open(adev->ctlpath, O_RDONLY);
+ if (adev->ctlfd == -1) {
return -1;
}
- if (ioctl(adev->fd, AUDIO_GETDEV, &adev->audio_device) == -1) {
- close(adev->fd);
+ if (ioctl(adev->ctlfd, AUDIO_GETDEV, &adev->audio_device) == -1) {
+ close(adev->ctlfd);
return -1;
}
for (i = 0; ;i++) {
memset(&query, 0, sizeof(query));
query.index = i;
- if (ioctl(adev->fd, AUDIO_QUERYFORMAT, &query) == -1) {
+ if (ioctl(adev->ctlfd, AUDIO_QUERYFORMAT, &query) == -1) {
if (errno == ENODEV) {
/* QUERYFORMAT not supported. */
break;
}
if (errno == EINVAL)
break;
- close(adev->fd);
+ close(adev->ctlfd);
return -1;
}
@@ -91,8 +91,8 @@
TAILQ_INSERT_TAIL(&adev->formats, f, next);
}
- if (ioctl(adev->fd, AUDIO_GETFORMAT, &adev->info) == -1) {
- close(adev->fd);
+ if (ioctl(adev->ctlfd, AUDIO_GETFORMAT, &adev->hwinfo) == -1) {
+ close(adev->ctlfd);
return -1;
}
@@ -158,8 +158,8 @@
while (!TAILQ_EMPTY(&audiodevlist)) {
adev = TAILQ_FIRST(&audiodevlist);
- if (adev->fd != -1)
- close(adev->fd);
+ if (adev->ctlfd != -1)
+ close(adev->ctlfd);
TAILQ_REMOVE(&audiodevlist, adev, next);
free(adev);
}
@@ -250,12 +250,12 @@
audiodev_set_param(struct audiodev *adev, int mode,
const char *encname, unsigned int prec, unsigned int ch, unsigned int freq)
{
- struct audio_info ai;
+ audio_info_t ai;
int setmode;
u_int enc;
setmode = 0;
- ai = adev->info;
+ ai = adev->hwinfo;
for (enc = 0; enc < encoding_max; enc++) {
if (strcmp(encname, encoding_names[enc]) == 0)
@@ -290,7 +290,7 @@
ai.mode = setmode;
printf("setting %s to %s:%u, %uch, %uHz\n",
adev->xname, encname, prec, ch, freq);
- if (ioctl(adev->fd, AUDIO_SETFORMAT, &ai) == -1) {
+ if (ioctl(adev->ctlfd, AUDIO_SETFORMAT, &ai) == -1) {
perror("ioctl AUDIO_SETFORMAT");
return -1;
}
@@ -315,7 +315,7 @@
AUDIO_INITINFO(&info);
info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
- info.play.channels = adev->info.play.channels;
+ info.play.channels = adev->hwinfo.play.channels;
info.play.precision = 16;
info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
info.mode = AUMODE_PLAY;
@@ -329,7 +329,7 @@
}
dtmf_new(&buf, &buflen, info.play.sample_rate, 2,
- adev->info.play.channels, chanmask, 350.0, 440.0);
+ adev->hwinfo.play.channels, chanmask, 350.0, 440.0);
if (buf == NULL) {
goto abort;
}
diff -r 476ef93c69f8 -r 4f74cf323c6d usr.bin/audiocfg/audiodev.h
--- a/usr.bin/audiocfg/audiodev.h Fri Aug 23 19:26:02 2019 +0000
+++ b/usr.bin/audiocfg/audiodev.h Sat Aug 24 03:28:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.h,v 1.5 2019/05/08 14:36:12 isaki Exp $ */
+/* $NetBSD: audiodev.h,v 1.6 2019/08/24 03:28:37 isaki Exp $ */
/*
* Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -46,14 +46,14 @@
uint16_t unit;
char path[PATH_MAX+1];
char ctlpath[PATH_MAX+1];
+ int ctlfd;
- int fd;
dev_t dev;
bool defaultdev;
audio_device_t audio_device;
TAILQ_HEAD(, audiofmt) formats;
- struct audio_info info;
+ audio_info_t hwinfo;
TAILQ_ENTRY(audiodev) next;
};
diff -r 476ef93c69f8 -r 4f74cf323c6d usr.bin/audiocfg/main.c
--- a/usr.bin/audiocfg/main.c Fri Aug 23 19:26:02 2019 +0000
+++ b/usr.bin/audiocfg/main.c Sat Aug 24 03:28:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.9 2019/08/22 14:40:14 isaki Exp $ */
+/* $NetBSD: main.c,v 1.10 2019/08/24 03:28:37 isaki Exp $ */
/*
* Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -87,17 +87,21 @@
printf(" %s", adev->audio_device.version);
printf("\n");
printf(" playback: ");
- if ((adev->info.mode & AUMODE_PLAY))
+ if ((adev->hwinfo.mode & AUMODE_PLAY)) {
printf("%uch, %uHz\n",
- adev->info.play.channels, adev->info.play.sample_rate);
- else
+ adev->hwinfo.play.channels,
+ adev->hwinfo.play.sample_rate);
+ } else {
printf("unavailable\n");
+ }
printf(" record: ");
- if ((adev->info.mode & AUMODE_RECORD))
+ if ((adev->hwinfo.mode & AUMODE_RECORD)) {
printf("%uch, %uHz\n",
- adev->info.record.channels, adev->info.record.sample_rate);
- else
+ adev->hwinfo.record.channels,
+ adev->hwinfo.record.sample_rate);
+ } else {
printf("unavailable\n");
+ }
TAILQ_FOREACH(f, &adev->formats, next) {
printf(" ");
@@ -249,7 +253,7 @@
return EXIT_FAILURE;
}
print_audiodev(adev, i);
- for (i = 0; i < adev->info.play.channels; i++) {
+ for (i = 0; i < adev->hwinfo.play.channels; i++) {
printf(" testing channel %d...", i);
fflush(stdout);
if (audiodev_test(adev, 1 << i) == -1)
Home |
Main Index |
Thread Index |
Old Index