]> git.alsa-project.org Git - alsa-tools.git/commitdiff
envy24control: fix spdif output settings
authorAndreas Persson <andreasp56@outlook.com>
Sun, 23 Mar 2025 09:00:10 +0000 (10:00 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Apr 2025 13:22:20 +0000 (15:22 +0200)
The S/PDIF Output Settings in envy24control had some bugs: wrong bits
were set when user changed "Stream" under "Professional" or any of the
settings under "Consumer".

Closes: https://github.com/alsa-project/alsa-tools/pull/28
Signed-off-by: Andreas Persson <andreasp56@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
envy24control/hardware.c

index 7e0094e226641d56728f6476b1a6ddf7c5c16930..b15df5601c67324015e4b4295e776a2a2087faaf 100644 (file)
@@ -455,9 +455,9 @@ void profi_stream_toggled(GtkWidget *togglebutton, gpointer data)
                return;
        iec958.status[1] &= ~IEC958_AES1_PRO_MODE;
        if (!strcmp(str, "NOTID")) {
-               iec958.status[0] |= IEC958_AES1_PRO_MODE_STEREOPHONIC;
+               iec958.status[1] |= IEC958_AES1_PRO_MODE_NOTID;
        } else if (!strcmp(str, "Stereo")) {
-               iec958.status[0] |= IEC958_AES1_PRO_MODE_NOTID;
+               iec958.status[1] |= IEC958_AES1_PRO_MODE_STEREOPHONIC;
        }
        snd_ctl_elem_value_set_iec958(spdif_output, &iec958);
        spdif_output_write();
@@ -500,7 +500,7 @@ void consumer_copyright_toggled(GtkWidget *togglebutton, gpointer data)
        if (!strcmp(str, "Copyright")) {
                iec958.status[0] &= ~IEC958_AES0_CON_NOT_COPYRIGHT;
        } else if (!strcmp(str, "Permitted")) {
-               iec958.status[1] |= IEC958_AES0_CON_NOT_COPYRIGHT;
+               iec958.status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
        }
        snd_ctl_elem_value_set_iec958(spdif_output, &iec958);
        spdif_output_write();
@@ -517,9 +517,9 @@ void consumer_copy_toggled(GtkWidget *togglebutton, gpointer data)
        if (iec958.status[0] & IEC958_AES0_PROFESSIONAL)
                return;
        if (!strcmp(str, "1st")) {
-               iec958.status[0] |= IEC958_AES1_CON_ORIGINAL;
-       } else if (!strcmp(str, "Original")) {
                iec958.status[1] &= ~IEC958_AES1_CON_ORIGINAL;
+       } else if (!strcmp(str, "Original")) {
+               iec958.status[1] |= IEC958_AES1_CON_ORIGINAL;
        }
        snd_ctl_elem_value_set_iec958(spdif_output, &iec958);
        spdif_output_write();
@@ -539,7 +539,7 @@ void consumer_emphasis_toggled(GtkWidget *togglebutton, gpointer data)
        if (!strcmp(str, "No")) {
                iec958.status[0] |= IEC958_AES0_CON_EMPHASIS_NONE;
        } else if (!strcmp(str, "5015")) {
-               iec958.status[1] |= ~IEC958_AES0_CON_EMPHASIS_5015;
+               iec958.status[0] |= IEC958_AES0_CON_EMPHASIS_5015;
        }
        snd_ctl_elem_value_set_iec958(spdif_output, &iec958);
        spdif_output_write();
@@ -555,15 +555,15 @@ void consumer_category_toggled(GtkWidget *togglebutton, gpointer data)
                return;
        if (iec958.status[0] & IEC958_AES0_PROFESSIONAL)
                return;
-       iec958.status[0] &= ~IEC958_AES1_CON_CATEGORY;
+       iec958.status[1] &= ~IEC958_AES1_CON_CATEGORY;
        if (!strcmp(str, "DAT")) {
-               iec958.status[0] |= IEC958_AES1_CON_DAT;
+               iec958.status[1] |= IEC958_AES1_CON_DAT;
        } else if (!strcmp(str, "PCM")) {
-               iec958.status[0] |= IEC958_AES1_CON_PCM_CODER;
+               iec958.status[1] |= IEC958_AES1_CON_PCM_CODER;
        } else if (!strcmp(str, "CD")) {
-               iec958.status[0] |= IEC958_AES1_CON_IEC908_CD;
+               iec958.status[1] |= IEC958_AES1_CON_IEC908_CD;
        } else if (!strcmp(str, "General")) {
-               iec958.status[0] |= IEC958_AES1_CON_GENERAL;
+               iec958.status[1] |= IEC958_AES1_CON_GENERAL;
        }
        snd_ctl_elem_value_set_iec958(spdif_output, &iec958);
        spdif_output_write();