Date: Mon, 15 Jul 2002 09:52:37 -0700 From: Orion Hodson <orion@FreeBSD.org> To: "Jose M. Alcaide" <jose@we.lc.ehu.es> Cc: multimedia@FreeBSD.org Subject: Re: interrupts from pcm(4) while no sound is being played Message-ID: <200207151652.g6FGqbb18219@puma.icir.org> In-Reply-To: Your message of "Mon, 15 Jul 2002 00:45:31 %2B0200." <20020714224531.GA784@v-ger.we.lc.ehu.es>
next in thread | previous in thread | raw e-mail | index | archive | help
/-- "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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207151652.g6FGqbb18219>