From owner-freebsd-stable Mon Mar 19 1:27:40 2001 Delivered-To: freebsd-stable@freebsd.org Received: from pikachu.bsp.bc.niigata-u.ac.jp (pikachu.bsp.bc.niigata-u.ac.jp [133.35.85.2]) by hub.freebsd.org (Postfix) with SMTP id D4A5F37B71B for ; Mon, 19 Mar 2001 01:27:35 -0800 (PST) (envelope-from iwaki@bc.niigata-u.ac.jp) Received: (qmail 5642 invoked by alias); 19 Mar 2001 18:27:28 +0900 Message-ID: <20010319092728.5637.qmail@pikachu.bsp.bc.niigata-u.ac.jp> To: freebsd-stable@FreeBSD.ORG Subject: how to use sound device in full-duplex ? In-Reply-To: <20010224181126K.iwaki@bc.niigata-u.ac.jp> References: <20010224181126K.iwaki@bc.niigata-u.ac.jp> X-Mailer: Mew version 1.94.1 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 19 Mar 2001 18:27:26 +0900 From: Mamoru Iwaki X-Dispatcher: imput version 20000228(IM140) Lines: 70 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I'd like to know the way how I can use sound device in full-duplex. I want to input sound stream with audio device and immediately output the stream into the same audio device for playback, without waiting for the end of input stream. I mean, it should simply make echoback of input, as fast as possible. For the purpose, I wrote the following program. From: Mamoru Iwaki Subject: sound driver kills kernel silently Date: Sat, 24 Feb 2001 18:11:26 +0900 > [PROGRAM] > #include > #include > #include > #include > #include > > #define DEV_IN "/dev/dsp" > #define DEV_OUT DEV_IN > #define BUFLEN 1 > > int main(void) { > int fdi, fdo; > char x[BUFLEN]; > > if ((fdi = open(DEV_IN, O_RDONLY)) == -1) { > perror("File open failure for read: " DEV_IN); > exit(1); > } > > if ((fdo = open(DEV_IN, O_WRONLY)) == -1) { > perror("File open failure for write: " DEV_IN); > exit(1); > } > > while (read(fdi, &x, sizeof(x)) > 0) write(fdo, &x, sizeof(x)); > > return 0; > } It has worked the last December, but not for now. It causes the following messages and no sound: pcm0: record overrun, dumping 8128 bytes pcm0: record overrun, dumping 8100 bytes pcm0: record overrun, dumping 8076 bytes When audio device is opened in read-write mode, it still not works. Are there any ideas to make the above simple echoback audio program with full-duplex property. Thanks. [ENVIRONMENT] % uname -a FreeBSD mi000.merlin.gs.niigata-u.ac.jp 4.3-BETA FreeBSD 4.3-BETA #0: Mon Mar 19 16:32:24 JST 2001 root@mi000.merlin.gs.niigata-u.ac.jp:/usr/obj/amd/mi004/home2/FreeBSD-src/stable4/src/sys/MI i386 % cat /dev/sndstat FreeBSD Audio Driver (newpcm) Mar 19 2001 16:30:59 Installed devices: pcm0: at io 0x220 irq 5 drq 1:5 (1p/1r channels duplex) --- ----- Mamoru IWAKI (iwaki@bc.niigata-u.ac.jp) Graduate School of Science and Technology, Niigata University To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message