[4254] Let WM8750 users write to audio buffer directly.
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)
Log Message:
-----------
Let WM8750 users write to audio buffer directly.
Modified Paths:
--------------
trunk/hw/i2c.h
trunk/hw/musicpal.c
trunk/hw/wm8750.cModified: trunk/hw/i2c.h
===================================================================
hw/i2c.h +2 -0
@@ -67,6 +67,8 @@ void (*data_req)(void *, int, int), void *opaque);void wm8750_dac_dat (void *opaque,uint32_t sample);uint32_t wm8750_adc_dat (void *opaque); +void *wm8750_dac_buffer (void *opaque,int samples); +void wm8750_dac_commit (void *opaque);/* ssd0303.c */ void ssd0303_init (DisplayState *ds,i2c_bus *bus,int address);
Modified: trunk/hw/musicpal.c
===================================================================
hw/musicpal.c +10 -8
@@ -254,7 +254,7 @@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 @@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;
Modified: trunk/hw/wm8750.c
===================================================================
hw/wm8750.c +18 -0
@@ -627,6 +627,24 @@wm8750_out_flush (s); } +void *wm8750_dac_buffer (void *opaque,int samples) +{ +struct wm8750_s *s = (struct wm8750_s *) opaque; +/* XXX: Should check if there are <i>samples</i> free samples available */ +void *ret = s->data_out + s->idx_out; + + s->idx_out += samples <<2 ; + s->req_out -= samples <<2 ; +return ret; +} + +void wm8750_dac_commit (void *opaque) +{ +struct wm8750_s *s = (struct wm8750_s *) opaque; + +return wm8750_out_flush (s); +} +uint32_t wm8750_adc_dat (void *opaque) {struct wm8750_s *s = (struct wm8750_s *) opaque;
Quoted 8 lines · Andrzej Zaborowski
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)Log Message:
-----------
Let WM8750 users write to audio buffer directly.
Works - but who is now in charge of applying volume and mute settings, the wm8750 on dac_commit or its user? Or do you plan to switch to AUD-level control directly?
Jan
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Andrzej Zaborowski
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)
Quoted 8 lines
Quoted 3 lines
Log Message:
-----------
Let WM8750 users write to audio buffer directly.Works - but who is now in charge of applying volume and mute settings,
the wm8750 ondac_commitor its user? Or do you plan to switch to AUD-level control directly?
The wm8750 for sure, maybe in wm8750_out_flush just before AUD_write(). But I'm not sure that it's a useful feature enough to do it in software. I'd rather wait until there appears a generic mixer api (don't know about any plans).
Regards
Quoted 12 lines · andrzej zaborowski
Quoted 11 lines · Jan Kiszka
Quoted 8 lines · Andrzej Zaborowski
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)Log Message:
-----------
Let WM8750 users write to audio buffer directly.
Quoted 8 lines
Quoted 3 lines
Works - but who is now in charge of applying volume and mute settings,
the wm8750 ondac_commitor its user? Or do you plan to switch to AUD-level control directly?The wm8750 for sure, maybe in
wm8750_out_flushjust beforeAUD_write(). But I'm not sure that it's a useful feature enough to do it in software. I'd rather wait until there appears a generic mixer api (don't know about any plans).
Hmm, unfortunate situation. We currently even have the regression that muting, which worked fine with the wm8750 before, is now broken and causes massive problems with the MusicPal (when switching streams or suspending it).
Jan
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · andrzej zaborowski
Quoted 14 lines · Jan Kiszka
Quoted 8 lines · Andrzej Zaborowski
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)Log Message:
-----------
Let WM8750 users write to audio buffer directly.Works - but who is now in charge of applying volume and mute settings,
the wm8750 ondac_commitor its user? Or do you plan to switch to AUD-level control directly?
Quoted 8 lines
Quoted 4 lines
The wm8750 for sure, maybe in
wm8750_out_flushjust beforeAUD_write(). But I'm not sure that it's a useful feature enough to do it in software. I'd rather wait until there appears a generic mixer api (don't know about any plans).Hmm, unfortunate situation. We currently even have the regression that
muting, which worked fine with the wm8750 before, is now broken and
Yes, my doubt is if there is a use case in which this ever makes a difference (and if it's valid for svn users), i.e. when you can't use the host's mixer (using a mixer app outside qemu). With the VirtualBox style mixer api the guest and host mixers can be the same and that would be best to have.
Regards
Signature · 2 lines
Please do not print this email unless absolutely necessary. Spread environmental awareness.
Quoted 24 lines · andrzej zaborowski
Quoted 23 lines · Jan Kiszka
Quoted 20 lines · andrzej zaborowski
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Andrzej Zaborowski
Revision: 4254
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4254 Author: balrog Date: 2008-04-26 12:00:18 +0000 (Sat, 26 Apr 2008)Quoted 8 lines
Quoted 3 lines
Log Message:
-----------
Let WM8750 users write to audio buffer directly.Works - but who is now in charge of applying volume and mute settings,
the wm8750 ondac_commitor its user? Or do you plan to switch to AUD-level control directly?The wm8750 for sure, maybe in
wm8750_out_flushjust beforeAUD_write(). But I'm not sure that it's a useful feature enough to do it in software. I'd rather wait until there appears a generic mixer api (don't know about any plans).
Quoted 8 lines
Quoted 2 lines
Hmm, unfortunate situation. We currently even have the regression that
muting, which worked fine with the wm8750 before, is now broken andYes, my doubt is if there is a use case in which this ever makes a difference (and if it's valid for svn users), i.e. when you can't use the host's mixer (using a mixer app outside qemu). With the VirtualBox style mixer api the guest and host mixers can be the same and that would be best to have.
[ Digging through VBox's patch chaos... ] Just to ensure I got it right:
You mean dropping vol from SWVoiceOut/In in favor of those global pcm_out/in_volume?
And then it looks like the software volume conversion is already in place, no further patching required? That would indeed be simple.
Jan
Quoted 11 lines · Jan Kiszka
Quoted 5 lines · andrzej zaborowski
Yes, my doubt is if there is a use case in which this ever makes a difference (and if it's valid for svn users), i.e. when you can't use the host's mixer (using a mixer app outside qemu). With the VirtualBox style mixer api the guest and host mixers can be the same and that would be best to have.
[ Digging through VBox's patch chaos... ] Just to ensure I got it right:
You mean dropping vol from SWVoiceOut/In in favor of those global pcm_out/in_volume?
Well, my idea would be to retain volume in SWVoiceOut/In and use always the volume of the voice that is active to set on host (wm8750.c only has one active voice at all times). If more voices are active in one or more QEMUSoundCard's then I don't know what should happen. Maybe that's not so useful, and global volume like in your patches is better.
VBox has this mixing engine which applies volume in software but is still generic (i.e. sits in audio/). I don't know what malc thinks qemu should adapt for mixer control (if anything).
Cheers