From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7B8T-0006zu-Bd for qemu-devel@nongnu.org; Mon, 12 Mar 2012 15:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7B8R-0004Cr-LR for qemu-devel@nongnu.org; Mon, 12 Mar 2012 15:42:24 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:59574 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7B8R-0004Al-EZ for qemu-devel@nongnu.org; Mon, 12 Mar 2012 15:42:23 -0400 Date: Mon, 12 Mar 2012 23:42:14 +0400 (MSK) From: malc In-Reply-To: <1331578211-18232-7-git-send-email-marcandre.lureau@redhat.com> Message-ID: References: <1331578211-18232-1-git-send-email-marcandre.lureau@redhat.com> <1331578211-18232-7-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH 06/11] hw/ac97: add support for volume control List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Marc-Andr=E9_Lureau?= Cc: =?ISO-8859-15?Q?Marc-Andr=E9_Lureau?= , dnb@redhat.com, dlaor@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com On Mon, 12 Mar 2012, Marc-Andr? Lureau wrote: > Combine output volume with Master and PCM registers values. > Use default values in mixer_reset (). > Set volume on post-load to update backend values. > --- > hw/ac97.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 79 insertions(+), 0 deletions(-) > > diff --git a/hw/ac97.c b/hw/ac97.c > index f7866ed..227233c 100644 > --- a/hw/ac97.c > +++ b/hw/ac97.c > @@ -436,6 +436,63 @@ static void reset_voices (AC97LinkState *s, uint8_t active[LAST_INDEX]) > AUD_set_active_in (s->voice_mc, active[MC_INDEX]); > } > > +static void get_volume (uint16_t vol, uint16_t mask, int inverse, > + int *mute, uint8_t *lvol, uint8_t *rvol) > +{ > + *mute = (vol >> MUTE_SHIFT) & 1; > + *rvol = (255 * (vol & mask)) / mask; > + *lvol = (255 * ((vol >> 8) & mask)) / mask; > + if (inverse) { > + *rvol = 255 - *rvol; > + *lvol = 255 - *lvol; > + } > +} Indentation is off here. [..snip..] -- mailto:av1474@comtv.ru