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: Tue, 15 Apr 2008 23:03:08 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080226)

malc wrote:
> So just leave the callback until free get's big enough, you will get
> dropouts either way, it's just that. I guess you might also use the
> AUD_init_time_stamp_out/AUD_get_elapsed_usec_out mechanism (implemenation
> is right at the end of audio/audio_template.h), but i still think that
> just going with free is saner approach.

Well, took some iterations to switch my mind completely to the new
model, but now this timestamp-free version runs as smooth as the
previous one:

static void audio_callback(void *opaque, int free)
{
        mv88w8618_audio_state *s = opaque;
        unsigned int block_size, written;

        block_size = s->threshold/2 - s->block_written;
        if (free - s->last_free < block_size)
                return;

        audio_fill_mixer_buffer(s, block_size);
        written = AUD_write(s->voice, s->mixer_buffer, block_size);

        s->last_free = free - written;

        if (written < block_size) {
                s->block_written += written;
                return;
        }
        s->block_written = 0;

        if (s->play_pos == 0) {
                s->status |= MP_AUDIO_TX_HALF;
                s->play_pos = s->threshold/2;
        } else {
                s->status |= MP_AUDIO_TX_FULL;
                s->play_pos = 0;
        }

        if (s->status & s->irq_enable)
                qemu_irq_raise(s->irq);
}

[ This would be even simpler if I could assume written == block_size ||
  written == 0. But who knows... ]

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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