diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-04-26 12:00:18 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-04-26 12:00:18 +0000 |
commit | 662caa6f9197a4e0d5e64743f1078ddc82836852 (patch) | |
tree | 2b3092fd51c86201bfcfc1bbaed7d4cb76711ae5 /hw/musicpal.c | |
parent | c21c583a1de9c1033252ef51929398ddc237a7c0 (diff) |
Let WM8750 users write to audio buffer directly.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4254 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/musicpal.c')
-rw-r--r-- | hw/musicpal.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hw/musicpal.c b/hw/musicpal.c index fb20b31550..e41c9e4171 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -254,7 +254,7 @@ typedef struct musicpal_audio_state { static void audio_callback(void *opaque, int free_out, int free_in) { musicpal_audio_state *s = opaque; - int16_t channel[2]; + int16_t *codec_buffer; int pos, block_size; if (!(s->playback_mode & MP_AUDIO_PLAYBACK_EN)) @@ -270,17 +270,19 @@ static void audio_callback(void *opaque, int free_out, int free_in) return; if (s->playback_mode & MP_AUDIO_16BIT_SAMPLE) - for (pos = 0; pos < block_size; pos += 4) - wm8750_dac_dat(s->wm, - *(uint32_t *)(s->target_buffer + s->play_pos + pos)); - else + memcpy(wm8750_dac_buffer(s->wm, block_size >> 2), + (uint32_t *)(s->target_buffer + s->play_pos), + block_size); + else { + codec_buffer = wm8750_dac_buffer(s->wm, block_size >> 1); for (pos = 0; pos < block_size; pos += 2) { - channel[0] = cpu_to_le16(2 * + *codec_buffer++ = cpu_to_le16(2 * *(int8_t *)(s->target_buffer + s->play_pos + pos)); - channel[1] = cpu_to_le16(2 * + *codec_buffer++ = cpu_to_le16(2 * *(int8_t *)(s->target_buffer + s->play_pos + pos + 1)); - wm8750_dac_dat(s->wm, channel[0] | (channel[1] << 16)); } + } + wm8750_dac_commit(s->wm); s->last_free = free_out - block_size; |