diff mbox series

[2/2] hw/audio/hda-codec: reenable the audio mixer

Message ID 20231105172552.8405-2-vr_qemu@t-online.de (mailing list archive)
State New, archived
Headers show
Series hw/audio/hda-codec bug fixes | expand

Commit Message

Volker Rümelin Nov. 5, 2023, 5:25 p.m. UTC
Commit b7639b7dd0 ("hw/audio: Simplify hda audio init") inverted
the sense of hda codec property mixer during initialization.
Change the code so that mixer=on enables the hda mixer emulation
and mixer=off disables the hda mixer emulation.

With this change audio playback and recording streams don't start
muted by default.

Fixes: b7639b7dd0 ("hw/audio: Simplify hda audio init")
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 hw/audio/hda-codec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Marc-André Lureau Nov. 6, 2023, 6:32 a.m. UTC | #1
Hi

On Sun, Nov 5, 2023 at 9:26 PM Volker Rümelin <vr_qemu@t-online.de> wrote:
>
> Commit b7639b7dd0 ("hw/audio: Simplify hda audio init") inverted
> the sense of hda codec property mixer during initialization.
> Change the code so that mixer=on enables the hda mixer emulation
> and mixer=off disables the hda mixer emulation.
>
> With this change audio playback and recording streams don't start
> muted by default.
>
> Fixes: b7639b7dd0 ("hw/audio: Simplify hda audio init")
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  hw/audio/hda-codec.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
> index f756e419bb..0bc20d49f6 100644
> --- a/hw/audio/hda-codec.c
> +++ b/hw/audio/hda-codec.c
> @@ -868,10 +868,10 @@ static Property hda_audio_properties[] = {
>  static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
>  {
>      HDAAudioState *a = HDA_AUDIO(hda);
> -    const struct desc_codec *desc = &output_nomixemu;
> +    const struct desc_codec *desc = &output_mixemu;
>
>      if (!a->mixer) {
> -        desc = &output_mixemu;
> +        desc = &output_nomixemu;
>      }
>
>      hda_audio_init(hda, desc, errp);
> @@ -880,10 +880,10 @@ static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
>  static void hda_audio_init_duplex(HDACodecDevice *hda, Error **errp)
>  {
>      HDAAudioState *a = HDA_AUDIO(hda);
> -    const struct desc_codec *desc = &duplex_nomixemu;
> +    const struct desc_codec *desc = &duplex_mixemu;
>
>      if (!a->mixer) {
> -        desc = &duplex_mixemu;
> +        desc = &duplex_nomixemu;
>      }
>
>      hda_audio_init(hda, desc, errp);

It could be even further simplified:

    hda_audio_init(hda, a->mixer ? &output_mixemu : &output_nomixemu, errp);

> @@ -892,10 +892,10 @@ static void hda_audio_init_duplex(HDACodecDevice *hda, Error **errp)
>  static void hda_audio_init_micro(HDACodecDevice *hda, Error **errp)
>  {
>      HDAAudioState *a = HDA_AUDIO(hda);
> -    const struct desc_codec *desc = &micro_nomixemu;
> +    const struct desc_codec *desc = &micro_mixemu;
>
>      if (!a->mixer) {
> -        desc = &micro_mixemu;
> +        desc = &micro_nomixemu;
>      }
>
>      hda_audio_init(hda, desc, errp);
> --
> 2.35.3
>
>
diff mbox series

Patch

diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index f756e419bb..0bc20d49f6 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -868,10 +868,10 @@  static Property hda_audio_properties[] = {
 static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
 {
     HDAAudioState *a = HDA_AUDIO(hda);
-    const struct desc_codec *desc = &output_nomixemu;
+    const struct desc_codec *desc = &output_mixemu;
 
     if (!a->mixer) {
-        desc = &output_mixemu;
+        desc = &output_nomixemu;
     }
 
     hda_audio_init(hda, desc, errp);
@@ -880,10 +880,10 @@  static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
 static void hda_audio_init_duplex(HDACodecDevice *hda, Error **errp)
 {
     HDAAudioState *a = HDA_AUDIO(hda);
-    const struct desc_codec *desc = &duplex_nomixemu;
+    const struct desc_codec *desc = &duplex_mixemu;
 
     if (!a->mixer) {
-        desc = &duplex_mixemu;
+        desc = &duplex_nomixemu;
     }
 
     hda_audio_init(hda, desc, errp);
@@ -892,10 +892,10 @@  static void hda_audio_init_duplex(HDACodecDevice *hda, Error **errp)
 static void hda_audio_init_micro(HDACodecDevice *hda, Error **errp)
 {
     HDAAudioState *a = HDA_AUDIO(hda);
-    const struct desc_codec *desc = &micro_nomixemu;
+    const struct desc_codec *desc = &micro_mixemu;
 
     if (!a->mixer) {
-        desc = &micro_mixemu;
+        desc = &micro_nomixemu;
     }
 
     hda_audio_init(hda, desc, errp);