summaryrefslogtreecommitdiff
path: root/lib/libossaudio
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-01-25 21:32:24 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-01-25 21:32:24 +0000
commit7f1b83b8597203014ba5ac1fa5048d42da45a0a3 (patch)
tree539d79b491fcf6de5c42223fd21eb7ffbf033bfb /lib/libossaudio
parentd920cd3a447f05ca9bf8bbc13c2d5db914f65aa0 (diff)
Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone". Adapted to the userland library from a similar change in the kernel code. ok jakemsr@
Diffstat (limited to 'lib/libossaudio')
-rw-r--r--lib/libossaudio/ossaudio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libossaudio/ossaudio.c b/lib/libossaudio/ossaudio.c
index 6b7e709fb58..94222dac503 100644
--- a/lib/libossaudio/ossaudio.c
+++ b/lib/libossaudio/ossaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ossaudio.c,v 1.7 2005/01/19 18:35:04 jason Exp $ */
+/* $OpenBSD: ossaudio.c,v 1.8 2006/01/25 21:32:23 brad Exp $ */
/* $NetBSD: ossaudio.c,v 1.14 2001/05/10 01:53:48 augustss Exp $ */
/*-
@@ -116,7 +116,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
/* This call is merely advisory, and may be a nop. */
break;
case SNDCTL_DSP_SPEED:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
tmpinfo.play.sample_rate =
tmpinfo.record.sample_rate = INTARG;
(void) ioctl(fd, AUDIO_SETINFO, &tmpinfo);
@@ -128,7 +128,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
INTARG = tmpinfo.play.sample_rate;
break;
case SNDCTL_DSP_STEREO:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
tmpinfo.play.channels =
tmpinfo.record.channels = INTARG ? 2 : 1;
(void) ioctl(fd, AUDIO_SETINFO, &tmpinfo);
@@ -145,7 +145,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
INTARG = tmpinfo.blocksize;
break;
case SNDCTL_DSP_SETFMT:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
switch (INTARG) {
case AFMT_MU_LAW:
tmpinfo.play.precision =
@@ -242,7 +242,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
INTARG = idat;
break;
case SNDCTL_DSP_CHANNELS:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
tmpinfo.play.channels =
tmpinfo.record.channels = INTARG;
(void) ioctl(fd, AUDIO_SETINFO, &tmpinfo);
@@ -266,7 +266,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
if (idat == 0)
idat = tmpinfo.play.buffer_size / tmpinfo.blocksize;
idat = (tmpinfo.play.buffer_size / idat) & -4;
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
tmpinfo.blocksize = idat;
retval = ioctl(fd, AUDIO_SETINFO, &tmpinfo);
if (retval < 0)
@@ -274,7 +274,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
INTARG = tmpinfo.play.buffer_size / tmpinfo.blocksize;
break;
case SNDCTL_DSP_SETFRAGMENT:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
idat = INTARG;
if ((idat & 0xffff) < 4 || (idat & 0xffff) > 17)
return EINVAL;
@@ -395,7 +395,7 @@ audio_ioctl(int fd, unsigned long com, void *argp)
return retval;
break;
case SNDCTL_DSP_SETTRIGGER:
- AUDIO_INITINFO(&tmpinfo);
+ (void) ioctl(fd, AUDIO_GETINFO, &tmpinfo);
retval = copyin(SCARG(uap, data), &idat, sizeof idat);
if (retval < 0)
return retval;
@@ -793,7 +793,7 @@ setblocksize(int fd, struct audio_info *info)
if (info->blocksize & (info->blocksize-1)) {
for(s = 32; s < info->blocksize; s <<= 1)
;
- AUDIO_INITINFO(&set);
+ ioctl(fd, AUDIO_GETINFO, &set);
set.blocksize = s;
ioctl(fd, AUDIO_SETINFO, &set);
ioctl(fd, AUDIO_GETINFO, info);