* [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
@ 2008-04-26 12:00 Andrzej Zaborowski
2008-04-26 13:29 ` Jan Kiszka
0 siblings, 1 reply; 7+ messages in thread
From: Andrzej Zaborowski @ 2008-04-26 12:00 UTC (permalink / raw)
To: qemu-devel
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.c
Modified: trunk/hw/i2c.h
===================================================================
--- trunk/hw/i2c.h 2008-04-26 01:43:07 UTC (rev 4253)
+++ trunk/hw/i2c.h 2008-04-26 12:00:18 UTC (rev 4254)
@@ -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
===================================================================
--- trunk/hw/musicpal.c 2008-04-26 01:43:07 UTC (rev 4253)
+++ trunk/hw/musicpal.c 2008-04-26 12:00:18 UTC (rev 4254)
@@ -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
===================================================================
--- trunk/hw/wm8750.c 2008-04-26 01:43:07 UTC (rev 4253)
+++ trunk/hw/wm8750.c 2008-04-26 12:00:18 UTC (rev 4254)
@@ -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;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 12:00 [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly Andrzej Zaborowski
@ 2008-04-26 13:29 ` Jan Kiszka
2008-04-26 13:50 ` andrzej zaborowski
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-04-26 13:29 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
Andrzej Zaborowski wrote:
> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 13:29 ` Jan Kiszka
@ 2008-04-26 13:50 ` andrzej zaborowski
2008-04-26 14:11 ` Jan Kiszka
0 siblings, 1 reply; 7+ messages in thread
From: andrzej zaborowski @ 2008-04-26 13:50 UTC (permalink / raw)
To: qemu-devel
On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
> Andrzej Zaborowski wrote:
> > 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?
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 13:50 ` andrzej zaborowski
@ 2008-04-26 14:11 ` Jan Kiszka
2008-04-26 20:10 ` andrzej zaborowski
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-04-26 14:11 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
andrzej zaborowski wrote:
> On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
>> Andrzej Zaborowski wrote:
>> > 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?
>
> 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).
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 14:11 ` Jan Kiszka
@ 2008-04-26 20:10 ` andrzej zaborowski
2008-04-26 23:31 ` Jan Kiszka
0 siblings, 1 reply; 7+ messages in thread
From: andrzej zaborowski @ 2008-04-26 20:10 UTC (permalink / raw)
To: qemu-devel
On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
> andrzej zaborowski wrote:
> > On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
> >> Andrzej Zaborowski wrote:
> >> > 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?
> >
> > 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).
>
>
> 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
--
Please do not print this email unless absolutely necessary. Spread
environmental awareness.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 20:10 ` andrzej zaborowski
@ 2008-04-26 23:31 ` Jan Kiszka
2008-04-27 23:29 ` andrzej zaborowski
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2008-04-26 23:31 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
andrzej zaborowski wrote:
> On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
>> andrzej zaborowski wrote:
>> > On 26/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
>> >> Andrzej Zaborowski wrote:
>> >> > 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?
>> >
>> > 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).
>>
>>
>> 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.
[ 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly.
2008-04-26 23:31 ` Jan Kiszka
@ 2008-04-27 23:29 ` andrzej zaborowski
0 siblings, 0 replies; 7+ messages in thread
From: andrzej zaborowski @ 2008-04-27 23:29 UTC (permalink / raw)
To: qemu-devel
On 27/04/2008, Jan Kiszka <jan.kiszka@web.de> wrote:
> andrzej zaborowski wrote:
> > 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-04-27 23:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 12:00 [Qemu-devel] [4254] Let WM8750 users write to audio buffer directly Andrzej Zaborowski
2008-04-26 13:29 ` Jan Kiszka
2008-04-26 13:50 ` andrzej zaborowski
2008-04-26 14:11 ` Jan Kiszka
2008-04-26 20:10 ` andrzej zaborowski
2008-04-26 23:31 ` Jan Kiszka
2008-04-27 23:29 ` andrzej zaborowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).