From owner-freebsd-multimedia Fri Sep 15 8: 2:44 2000 Delivered-To: freebsd-multimedia@freebsd.org Received: from bells.cs.ucl.ac.uk (bells.cs.ucl.ac.uk [128.16.5.31]) by hub.freebsd.org (Postfix) with SMTP id B20C737B42C for ; Fri, 15 Sep 2000 08:02:41 -0700 (PDT) Received: from scary.cs.ucl.ac.uk by bells.cs.ucl.ac.uk with local SMTP id ; Fri, 15 Sep 2000 16:02:37 +0100 From: Orion Hodson X-Organisation: University College London, CS Dept. X-Phone: +44 (0)20 7679 3704 To: multimedia@freebsd.org Cc: rat-trap@cs.ucl.ac.uk Subject: Re: pcm & full-duplex In-reply-to: Your message of "Fri, 15 Sep 2000 20:13:42 +0600." <39C22E96.C4469170@urc.ac.ru> Date: Fri, 15 Sep 2000 16:02:35 +0100 Message-ID: <16633.969030155@cs.ucl.ac.uk> Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org <39C22E96.C4469170@urc.ac.ru>Anton Voronin writes: > Orion Hodson wrote: > > <39C2165F.28CBAFBE@urc.ac.ru>Anton Voronin writes: > > > > I'm not sure if other applications open O_RDONLY and check for full > > duplex with SNDCTL_DSP_GETCAPS, but AFAIK rat on FreeBSD never has in > > the "full duplex only" versions (3.2 onwards). > > At least 4.0.4 seems to do so: > > int vox_audio_duplex(int audio_fd) > { > /* Find out if the device supports full-duplex operation. The device mu > * be open to do this, so if we're passed -1 as a file-descriptor we op > * the device, do the ioctl, and then close it again... > */ > int options; > if (audio_fd == -1) { > audio_fd = vox_audio_open_rw(O_RDONLY); > if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &options) == -1) { > vox_audio_close(audio_fd); > return FALSE; > } > vox_audio_close(audio_fd); > return (options & DSP_CAP_DUPLEX); > } > /* Audio device already open */ > if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &options) == -1 ) { > return FALSE; > } > return (options & DSP_CAP_DUPLEX); > } The code above is from the file for Voxware/OSS (confusingly called auddev_freebsd.c - a throwback to when there was only one sound driver interface). With Voxware/OSS the correct way to detect full duplex is to open the card half-duplex first and probe for full duplex. The device can then be made full duplex using ioctl SNDCTL_DSP_SETDUPLEX or by re-opening it. The file used on FreeBSD since rat-3.2 is auddev_luigi.c for pcm/newpcm, and unless you hack the configure script you'll be using this file. cheers - Orion. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message