kern/156433: [sound] [patch] OSS4/VPC is broken on 64-bit
platforms
Test Rat
ttsestt at gmail.com
Fri Jul 29 01:00:20 UTC 2011
The following reply was made to PR kern/156433; it has been noted by GNATS.
From: Test Rat <ttsestt at gmail.com>
To: bug-followup at FreeBSD.org
Cc:
Subject: Re: kern/156433: [sound] [patch] OSS4/VPC is broken on 64-bit platforms
Date: Fri, 29 Jul 2011 04:25:37 +0400
--=-=-=
Content-Type: text/plain
Any chance the fix will be committed before 9.0-RELEASE? The ioctl is
used by more apps than just mplayer2, see
http://google.com/codesearch?q=SNDCTL_DSP_SETPLAYVOL
(gst-plugins-good, wine, xmms2, moc, qmmp, etc)
I've tried to change volume with attached test program but it stays the same.
This is also reflected in /dev/sndstat, try
http://people.freebsd.org/~ariff/utils/appsmixer
--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=test_vol.c
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int audio_fd;
int lvol, rvol;
void
setplayvol(void)
{
int mask = lvol | rvol << 8;
if(ioctl(audio_fd, SNDCTL_DSP_SETPLAYVOL, &mask) < 0)
err(errno, "SNDCTL_DSP_SETPLAYVOL failed");
}
void
getplayvol(void)
{
int mask;
if(ioctl(audio_fd, SNDCTL_DSP_GETPLAYVOL, &mask) < 0)
err(errno, "SNDCTL_DSP_GETPLAYVOL failed");
lvol = mask & 0x00ff;
rvol = (mask & 0xff00) >> 8;
printf("\rvol is %d:%d ", lvol, rvol);
}
int
main(void)
{
char ch, buf[] = "noise";
struct termios t;
if((audio_fd = open("/dev/dsp", O_WRONLY, 0)) < 0)
err(errno, "open failed");
printf("hit ^C to abort\n");
getplayvol();
tcgetattr(0, &t);
t.c_lflag &= ~(ECHO|ICANON);
tcsetattr(0, TCSANOW, &t);
while ((ch = getchar()) != EOF) {
switch(ch) {
case '+':
if(lvol < 100 && rvol < 100) {
lvol++;
rvol++;
}
break;
case '-':
if(lvol > 0 && rvol > 0) {
lvol--;
rvol--;
}
break;
case 'L':
case 'l':
if(lvol < 100)
lvol++;
break;
case 'R':
case 'r':
if(rvol < 100)
rvol++;
break;
case '\014': /* ^L */
if(lvol > 0)
lvol--;
break;
case '\022': /* ^R */
if(rvol > 0)
rvol--;
break;
case '\007': /* ^G */
close(audio_fd);
if((audio_fd = open("/dev/dsp", O_WRONLY, 0)) < 0)
err(errno, "open failed");
getplayvol();
continue;
default: /* any other key produces noise */
write(audio_fd, buf, sizeof(buf));
continue;
}
setplayvol();
getplayvol();
}
close(audio_fd);
return 0;
}
--=-=-=--
More information about the freebsd-multimedia
mailing list