From owner-freebsd-multimedia Mon Jul 15 9:53: 1 2002 Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5CA4F37B401 for ; Mon, 15 Jul 2002 09:52:57 -0700 (PDT) Received: from puma.icir.org (puma.icir.org [192.150.187.73]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47CBD43E6E for ; Mon, 15 Jul 2002 09:52:49 -0700 (PDT) (envelope-from hodson@puma.icir.org) Received: from puma.icir.org (localhost [127.0.0.1]) by puma.icir.org (8.11.6/8.11.3) with ESMTP id g6FGqbb18219; Mon, 15 Jul 2002 09:52:37 -0700 (PDT) (envelope-from hodson@puma.icir.org) Message-Id: <200207151652.g6FGqbb18219@puma.icir.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.3 To: "Jose M. Alcaide" Cc: multimedia@FreeBSD.org From: Orion Hodson Subject: Re: interrupts from pcm(4) while no sound is being played In-Reply-To: Your message of "Mon, 15 Jul 2002 00:45:31 +0200." <20020714224531.GA784@v-ger.we.lc.ehu.es> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 15 Jul 2002 09:52:37 -0700 Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org /-- "Jose M. Alcaide" wrote: | I have just found something strange: there are interrupts accounted to the | pcm(4) device while a process keeps it open just after playing a sound. | For example: | | cat flush.au - > /dev/audio | | That command sends "flush.au" to /dev/audio followed by stdin. Using | "systat -vm 1", I can see about 62-64 interrupts per second while playing | the sound and also *after* playing is finished and cat(1) is waiting for | input. I also noticed the same effect with esd, but with different | interrupt rates (depending on the sample format and rate of the last sound | played). | | I can reproduce the effect with an ESS Maestro/2E, a CMedia CMI8738, and a | Creative CT-5880 (I have no other sound hardware available for testing). | All systems are running FreeBSD 4.6-RELEASE. | | Is that the expected pcm(4) behaviour? Yes. Your application is holding the device open after writing data. By writing data it starts the dma engine on the card, and as a result interrupts start being generated by the audio device. With each interrupt, an attempt to pull data from the s/w buffers is made. Your sound plays out, but then the application does nothing anything to stop the dma engine (ie close the device or use trigger ioctl) and so interrupts keep getting generated, the device underflows, silence is written out. There are quite a few applications where this behaviour is useful, ie games that want to write sounds periodically and not continuously. And in general it helps avoid weirdness when audio apps are struggling to get cpu cycles on heavily loaded systems. - Orion To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message