From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtlZB-0005PV-CR for qemu-devel@nongnu.org; Fri, 02 Oct 2009 13:05:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtlZ6-0005NZ-Go for qemu-devel@nongnu.org; Fri, 02 Oct 2009 13:05:12 -0400 Received: from [199.232.76.173] (port=37579 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtlZ6-0005NW-E3 for qemu-devel@nongnu.org; Fri, 02 Oct 2009 13:05:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5919) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtlZ5-00035N-P5 for qemu-devel@nongnu.org; Fri, 02 Oct 2009 13:05:08 -0400 Subject: Re: [Qemu-devel] Questions on audio_atexit(), possibly bugs References: <87y6nw9koq.fsf@pike.pond.sub.org> <871vlo9gz5.fsf@pike.pond.sub.org> From: Markus Armbruster Date: Fri, 02 Oct 2009 19:04:42 +0200 In-Reply-To: (malc's message of "Thu\, 1 Oct 2009 03\:22\:04 +0400 \(MSD\)") Message-ID: <87tyyhhglx.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org malc writes: > On Thu, 1 Oct 2009, Markus Armbruster wrote: > >> malc writes: >> >> > On Wed, 30 Sep 2009, Markus Armbruster wrote: >> > >> >> Excuse my ignorance on all things audio, but I stumbled over something >> >> that could be wrong. >> >> >> >> audio_vm_change_state_handler() stops voices when the VM stops, and >> >> starts them when it continues. >> >> >> >> audio_atexit() unconditionally stops them. When a stopped VM exits, >> >> this stops voices that are already stopped. >> >> >> >> Does the audio driver contract allow stopping a stopped voice? If yes, >> >> I figured starting a running voice is fine, too. If no, we have a bug >> >> in audio_atexit(). >> > >> > This should answer the question audio_atexit existed long before vm >> > change state handlers. Those were actually added to stop the host from >> > looping the same audio fragment over and over again (can/will happen >> > with DirectSound, mmapped OSS, fmod too if i'm not mistaken). >> >> Just to make sure: Does this mean implementations of audio_pcm_ops need >> to cope with stopping a stopped voice? > > Yes. > > [..snip..] Thanks. Next question: I'm having difficulties understanding how HWVoiceIn / HWVoiceOut member enabled works. AUD_set_active_out(), AUD_set_active_in() and audio_run_out() take care to maintain hw->enabled reflecting the state of the voice. They also use it to avoid changing the state uselessly. audio_vm_change_state_handler() uses hw->enabled the same way. But it doesn't update it. Why? Same for audio_atexit().