Skip to contentSkip to conversation

Soundblaster Live! 24 bit (snd-ca0106) and the oss emulation

PATCH Dorin Lazar 1 participant 1 message Aug 24, 2005

lore
Share & tools
lore
#0 lore raw

Hello,
There is a problem regarding the ca0106 used through the oss-emulation. The
volume doesn't work (since the only controls that the card is offering are "Analog Front/Center_LFE/Rear/Unknown" and "SPDIF Front/etc."
The solution I found, and perhaps other people might find useful is to
create a control named "PCM" that will adjust the proper controls. I find the following patch useful but incorrect at best. Perhaps there should be a legitimate version of this patch included in the distribution.
Patch is attached.
Dorin

pci/ca0106/ca0106_mixer.c renamed from pci/ca0106/ca0106_mixer.c.orig +25 -0
@@ -393,6 +393,11 @@
 	int reg = PLAYBACK_VOLUME2;
         return snd_ca0106_volume_get(kcontrol, ucontrol, reg, channel_id);
 }
+static int snd_ca0106_volume_get_pcm(snd_kcontrol_t * kcontrol,
+                                       snd_ctl_elem_value_t * ucontrol)
+{
+	return snd_ca0106_volume_get_analog_front(kcontrol, ucontrol);
+}
 
 static int snd_ca0106_volume_get_feedback(snd_kcontrol_t * kcontrol,
                                        snd_ctl_elem_value_t * ucontrol)
@@ -463,6 +468,14 @@
 	int reg = PLAYBACK_VOLUME2;
         return snd_ca0106_volume_put(kcontrol, ucontrol, reg, channel_id);
 }
+static int snd_ca0106_volume_put_pcm(snd_kcontrol_t * kcontrol,
+                                       snd_ctl_elem_value_t * ucontrol)
+{
+	snd_ca0106_volume_put_analog_unknown(kcontrol, ucontrol);
+	snd_ca0106_volume_put_analog_rear(kcontrol, ucontrol);
+	snd_ca0106_volume_put_analog_center_lfe(kcontrol, ucontrol);
+	return snd_ca0106_volume_put_analog_front(kcontrol, ucontrol);
+}
 static int snd_ca0106_volume_put_analog_rear(snd_kcontrol_t * kcontrol,
                                        snd_ctl_elem_value_t * ucontrol)
 {
@@ -511,6 +524,14 @@
         .get =          snd_ca0106_volume_get_analog_rear,
         .put =          snd_ca0106_volume_put_analog_rear
 };
+static snd_kcontrol_new_t snd_ca0106_volume_control_pcm =
+{
+        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+        .name =         "PCM",
+        .info =         snd_ca0106_volume_info,
+        .get =          snd_ca0106_volume_get_pcm,
+        .put =          snd_ca0106_volume_put_pcm
+};
 static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -633,6 +654,10 @@
 		rename_ctl(card, c[0], c[1]);
 #endif
 
+        if ((kctl = snd_ctl_new1(&snd_ca0106_volume_control_pcm, emu)) == NULL)
+                return -ENOMEM;
+        if ((err = snd_ctl_add(card, kctl)))
+                return err;
         if ((kctl = snd_ctl_new1(&snd_ca0106_volume_control_analog_front, emu)) == NULL)
                 return -ENOMEM;
         if ((err = snd_ctl_add(card, kctl)))