qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [RFC][PATCH 4/4] Add support for Marvell 88w8618 / Musi


From: Jan Kiszka
Subject: [Qemu-devel] Re: [RFC][PATCH 4/4] Add support for Marvell 88w8618 / MusicPal
Date: Mon, 14 Apr 2008 23:34:44 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080226)

Jan Kiszka wrote:
> +static void audio_fill_mixer_buffer(mv88w8618_audio_state *s, unsigned int 
> length)
> +{
> +     unsigned int pos;
> +     double val;
> +
> +     if (s->mute) {
> +             memset(s->mixer_buffer, 0, length);
> +             return;
> +     }
> +
> +     if (s->playback_mode & 1)
> +             for (pos = 0; pos < length; pos += 2) {
> +                     val = *(int16_t *)(s->target_buffer + s->play_pos + 
> pos);
> +                     val = le16_to_cpu(val) * pow(10.0, s->volume/20.0);
> +                     *(int16_t *)(s->mixer_buffer + pos) = val;
> +             }

This variant "sounds" better:

                for (pos = 0; pos < length; pos += 2) {
                        uint16_t tmp = *(uint16_t *)
                                (s->target_buffer + s->play_pos + pos);
                        val = (int16_t)le16_to_cpu(tmp);
                        val = val * pow(10.0, s->volume/20.0);
                        *(int16_t *)(s->mixer_buffer + pos) = val;
                }

Find latest patches at http://home.arcor.de/jan.kiszka/patches/QEMU/

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]