Date: Tue, 7 Nov 2000 01:36:00 +0000 (GMT) From: Andrew Gordon <arg@arg1.demon.co.uk> To: j mckitrick <jcm@FreeBSD-uk.eu.org> Cc: stable@freebsd.org, multimedia@freebsd.org Subject: Re: continuing sound problems with 4.2-beta Message-ID: <Pine.BSF.4.21.0011070130070.26891-100000@server.arg.sj.co.uk> In-Reply-To: <20001104234358.A48459@dogma.freebsd-uk.eu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 4 Nov 2000, j mckitrick wrote:
> I continue to get 'invalid argument' when using 'play' to play a .wav file.
> Maybe I am doing something wrong, but I can't figure out what it is.
>
> open("/dev/dsp",1,027757774234) = 4 (0x4)
> ioctl(4,SNDCTL_DSP_GETBLKSIZE,0xbfbff7d4) = 0 (0x0)
> ioctl(4,SNDCTL_DSP_SETFMT,0x804bc80) ERR#22 'Invalid argument'
I ran into this the other day; it appears that there has been a change in
the sound API recently such that you need to do SNDCTL_DSP_SPEED before
SNDCTL_DSP_SETFMT. I haven't had time to dig into CVS to see when this
happened or why.
This code used to work in 3.x and in 4.x up until a week or two ago:
audio_fd = open("/dev/audio", O_RDWR);
if (audio_fd < 0)
{
perror("/dev/audio");
exit(1);
}
i = AFMT_S16_LE;
if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &i) == -1)
{
perror("Setting audio format");
exit(1);
}
i = 1;
if (ioctl(audio_fd, SNDCTL_DSP_STEREO, &i) == -1)
{
perror("Setting stereo mode");
exit(1);
}
i = SAMPLE_HZ;
if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &i) == -1)
{
perror("Setting audio rate");
exit(1);
}
if (i != SAMPLE_HZ)
{
fprintf(stderr, "Soundcard doesn't support %dHz (offers %d)\n",
SAMPLE_HZ, i);
exit(1);
}
Now, it fails at the SNDCTL_DSP_SETFMT call (invalid argument), but if I
move the SNDCTL_DSP_SETSPEED immediately after the open, normal working is
restored.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0011070130070.26891-100000>
