Skip to contentSkip to conversation

AC3 passthrough on Audigy

PATCH p z oooo 3 participants 6 messages Aug 26, 2003 – Aug 29, 2003

lore
Share & tools
lore

p z oooo

author
#0 lore raw

Hi,

This is taken from oss driver. It is not tested (I don't own receiver). Can someone try it, maybe this works, I don't know.

Audigy.conf - copy this to /usr/share/alsa/cards/ and overwrite old one (make backup).

emu10k1.h.patch - patch for file alsa-driver/alsa- kernel/include/emu10k1.h

emufx.c.patch - patch for file alsa-driver/alsa-
kernel/pci/emu10k1/emufx.c

If this doesn't work try to comment out lines
A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001);
A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));

And if this doesn't work too, then delete this mail.

Peter Zubaj

====================== REKLAMA ================================= Vyrazne zlavy pocitacov a prislusenstva
Sun Fire V210 server v cenach uz od 125.000,- Sk bez DPH Navstivte nas na adrese http://www.somi.sk/sun/lowend_servery.php
================================================================

emu10k1.h renamed from emu10k1.h.old +2 -0
@@ -1152,6 +1152,8 @@
 #define FXBUS_MIDI_RIGHT	0x05
 #define FXBUS_PCM_CENTER	0x06
 #define FXBUS_PCM_LFE		0x07
+#define FXBUS_PT_LEFT		20
+#define FXBUS_PT_RIGHT		21
 #define FXBUS_MIDI_REVERB	0x0c
 #define FXBUS_MIDI_CHORUS	0x0d
 
emufx.c renamed from emufx.c.old +25 -7
@@ -1235,6 +1235,7 @@
  */
 
 #define A_GPR_ACCU 0xd6
+#define A_GPR_COND 0xd7
 
 static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
 {
@@ -1502,13 +1503,7 @@
 		A_OP(icode, &ptr, iMAC0, A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS), A_C_00000000, A_GPR(gpr+1), A_GPR(playback+1+SND_EMU10K1_PLAYBACK_CHANNELS));
 		snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Master Playback Volume", gpr, 0);
 		gpr += 2;
-	}
-
-	/* digital outputs */
-	A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
-	A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);
-	A_PUT_OUTPUT(A_EXTOUT_CENTER, playback+4 + SND_EMU10K1_PLAYBACK_CHANNELS);
-	A_PUT_OUTPUT(A_EXTOUT_LFE, playback+5 + SND_EMU10K1_PLAYBACK_CHANNELS);
+	}	
 
 	/* analog speakers */
 	if (emu->revision == 4) { /* audigy2 */
@@ -1523,6 +1518,29 @@
 	/* headphone */
 	A_PUT_STEREO_OUTPUT(A_EXTOUT_HEADPHONE_L, A_EXTOUT_HEADPHONE_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
 
+	/* digital outputs */
+//	A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS);
+
+	/* IEC958 Optical Raw Playback Switch */ 
+	icode->gpr_map[gpr++] = 0x1008;
+	icode->gpr_map[gpr++] = 0xffff0000;
+	for (z = 0; z < 2; z++) {
+		A_OP(icode, &ptr, iMAC0, A_GPR(tmp + 2), A_FXBUS(FXBUS_PT_LEFT + z), A_C_00000000, A_C_00000000);
+		A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001);
+		A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));
+		A_OP(icode, &ptr, iANDXOR, A_GPR(tmp + 2), A_GPR(tmp + 2), A_GPR(gpr - 1), A_C_00000000);
+		A_SWITCH(icode, &ptr, tmp + 0, tmp + 2, gpr + z);
+		A_SWITCH_NEG(icode, &ptr, tmp + 1, gpr + z);
+		A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1);
+		A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);
+	}
+	snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "IEC958 Optical Raw Playback Switch", gpr, 0);
+	gpr += 2;
+	
+	A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);
+	A_PUT_OUTPUT(A_EXTOUT_CENTER, playback+4 + SND_EMU10K1_PLAYBACK_CHANNELS);
+	A_PUT_OUTPUT(A_EXTOUT_LFE, playback+5 + SND_EMU10K1_PLAYBACK_CHANNELS);
+
 	/* ADC buffer */
 	A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_L, capture);
 	A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_R, capture+1);
#1 lore raw
Quoted 12 lines · p z oooo

Hi,

This is taken from oss driver. It is not tested (I don't own receiver). Can someone try it, maybe this works, I don't know.

Audigy.conf - copy this to /usr/share/alsa/cards/ and overwrite old one (make backup).

emu10k1.h.patch - patch for file alsa-driver/alsa- kernel/include/emu10k1.h

emufx.c.patch - patch for file alsa-driver/alsa-
kernel/pci/emu10k1/emufx.c

Quoted 8 lines

If this doesn't work try to comment out lines
A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001); A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));

And if this doesn't work too, then delete this mail.

Peter Zubaj

Is this just for the Audigy?
Would it work on the Audigy 2 ?
Is so, I have an Audigy 2 that I could install and do a test with.

Cheers
James

-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0

#2 lore raw
In reply to p z oooo
Quoted 12 lines · p z oooo

Hi,

This is taken from oss driver. It is not tested (I don't own receiver). Can someone try it, maybe this works, I don't know.

Audigy.conf - copy this to /usr/share/alsa/cards/ and overwrite old one (make backup).

emu10k1.h.patch - patch for file alsa-driver/alsa- kernel/include/emu10k1.h

emufx.c.patch - patch for file alsa-driver/alsa-
kernel/pci/emu10k1/emufx.c

Quoted 8 lines

If this doesn't work try to comment out lines
A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001); A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));

And if this doesn't work too, then delete this mail.

Peter Zubaj

I tried this on an Audigy2. It does not work.
The non-audio bits on the SPDIF are set correctly, and Audio data is being sent out from the port, so for PCM data it is fine. For non-audio AC3 data, it fails. Probably due to the samples getting modified in some way as they pass thru the DSP.

Cheers
James

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#3 lore raw
In reply to p z oooo
Quoted 4 lines · p z oooo

Hi,

This is taken from oss driver. It is not tested (I don't own receiver). Can someone try it, maybe this works, I don't know.

Quoted 8 lines

Audigy.conf - copy this to /usr/share/alsa/cards/ and overwrite old one (make backup).

emu10k1.h.patch - patch for file alsa-driver/alsa- kernel/include/emu10k1.h

emufx.c.patch - patch for file alsa-driver/alsa-
kernel/pci/emu10k1/emufx.c

Do NOT comment out the following lines.

Quoted 8 lines

If this doesn't work try to comment out lines
A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001); A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));

And if this doesn't work too, then delete this mail.

Peter Zubaj

Your patch works up to a point. It will only work on the Audigy, and not the Audigy2.
The Audigy and Audigy2 do things slighly differently.
The L and R channels are reversed on the Audigy2, so I have compensated for this by using a different routing in Audigy2.conf.

If you add my patches, this will work with both the Audigy and Audigy2. :-)

emu10k1.c.patch - patch for file alsa-driver/alsa-kernel/pci/emu10k1/emu10k1.c (So that is looks for Audigy2.conf)

Audigy2.conf - copy this to /usr/share/alsa/cards/ (It is a new file)

Summary: -
If one combines pzad's patch with my own, we have AC3 passthru working on all SB cards. SB Live (Worked before), SB Audigy (with pzas's patch) and SB Audigy2 (with my patch).

Please check these into the alsa-kernel cvs.

Cheers
James

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw

Re: AC3 passthrough on Audigy and Audigy2...now Works!!!

In reply to p z oooo
Quoted 4 lines · p z oooo

Hi,

This is taken from oss driver. It is not tested (I don't own receiver). Can someone try it, maybe this works, I don't know.

Quoted 8 lines

Audigy.conf - copy this to /usr/share/alsa/cards/ and overwrite old one (make backup).

emu10k1.h.patch - patch for file alsa-driver/alsa- kernel/include/emu10k1.h

emufx.c.patch - patch for file alsa-driver/alsa-
kernel/pci/emu10k1/emufx.c

Do NOT comment out the following lines.

Quoted 8 lines

If this doesn't work try to comment out lines
A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001); A_OP(icode, &ptr, iACC3, A_GPR(tmp + 2), A_C_00000000, A_C_00010000, A_GPR(tmp + 2));

And if this doesn't work too, then delete this mail.

Peter Zubaj

Your patch works up to a point. It will only work on the Audigy, and not the Audigy2.
The Audigy and Audigy2 do things slighly differently.
The L and R channels are reversed on the Audigy2, so I have compensated for this by using a different routing in Audigy2.conf.

If you add my patches, this will work with both the Audigy and Audigy2. :-)

emu10k1.c.patch - patch for file alsa-driver/alsa-kernel/pci/emu10k1/emu10k1.c (So that is looks for Audigy2.conf)

Audigy2.conf - copy this to /usr/share/alsa/cards/ (It is a new file)

Summary: -
If one combines pzad's patch with my own, we have AC3 passthru working on all SB cards. SB Live (Worked before), SB Audigy (with pzas's patch) and SB Audigy2 (with my patch).

Please check these into the alsa-kernel cvs.

Cheers
James

#
# Configuration for the Audigy2 chip
#

<confdir:pcm/front.conf>

Audigy2.pcm.front.0 {
	@args [ CARD  ]
	@args.CARD {
		type string
	}
	type hw
	card $CARD
	device 0
}	

<confdir:pcm/rear.conf>

Audigy2.pcm.rear.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type hooks
	slave.pcm {
		type hw
		card $CARD
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{
				name "Wave Surround Playback Volume"
				preserve true
				lock true
				value [ 0 0 ]
			}
			{
				name "EMU10K1 PCM Send Volume"
				index { @func private_pcm_subdevice }
				lock true
				value [ 0 0 0 0 0 0 0 0  0 0 255 0 0 0 0 0  0 0 0 255 0 0 0 0 ]
			}
		]
	}
}	

<confdir:pcm/center_lfe.conf>

Audigy2.pcm.center_lfe.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type hooks
	slave.pcm {
		type hw
		card $CARD
		device 0
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{
				name "Wave Center Playback Volume"
				preserve true
				lock true
				value 0
			}
			{
				name "Wave LFE Playback Volume"
				preserve true
				lock true
				value 0
			}
			{
				name "EMU10K1 PCM Send Volume"
				index { @func private_pcm_subdevice }
				lock true
				value [ 0 0 0 0 0 0 0 0  255 0 0 0 0 0 0 0  0 255 0 0 0 0 0 0 ]
			}
			{
				name "EMU10K1 PCM Send Routing"
				index { @func private_pcm_subdevice }
				lock true
				value [ 0 1 2 3 0 0 0 0  6 7 0 1 0 0 0 0  6 7 0 1 0 0 0 0 ]
			}
		]
	}
}	

<confdir:pcm/surround40.conf>

Audigy2.pcm.surround40.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type multi
	slaves [
		{
			pcm {
				@func concat
				strings [
					"cards.Audigy2.pcm.front.0:CARD=" $CARD
				]
			}
			channels 2
		}
		{
			pcm {
				@func concat
				strings [
					"cards.Audigy2.pcm.rear.0:CARD=" $CARD
				]
			}
			channels 2
		}
	]
	bindings [
		{ slave 0 channel 0 }
		{ slave 0 channel 1 }
		{ slave 1 channel 0 }
		{ slave 1 channel 1 }
	]
}

<confdir:pcm/surround51.conf>

Audigy2.pcm.surround51.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type multi
	slaves [
		{
			pcm {
				@func concat
				strings [
					"cards.Audigy2.pcm.front.0:CARD=" $CARD
				]
			}
			channels 2
		}
		{
			pcm {
				@func concat
				strings [
					"cards.Audigy2.pcm.rear.0:CARD=" $CARD
				]
			}
			channels 2
		}
		{
			pcm {
				@func concat
				strings [
					"cards.Audigy2.pcm.center_lfe.0:CARD=" $CARD
				]
			}
			channels 2
		}
	]
	bindings [
		{ slave 0 channel 0 }
		{ slave 0 channel 1 }
		{ slave 1 channel 0 }
		{ slave 1 channel 1 }
		{ slave 2 channel 0 }
		{ slave 2 channel 1 }
	]
}

<confdir:pcm/iec958.conf>

Audigy2.pcm.iec958.0 {
	@args [ CARD AES0 AES1 AES2 AES3 ]
	@args.CARD {
		type string
	}
	@args.AES0 {
		type integer
	}
	@args.AES1 {
		type integer
	}
	@args.AES2 {
		type integer
	}
	@args.AES3 {
		type integer
	}
	type hooks
	slave.pcm {
		type hw
		card $CARD
		device 0
	}

	hooks.0 {
		type ctl_elems
		hook_args [
			{
				name "IEC958 Playback Default"
				lock true
				preserve true
				value [ $AES0 $AES1 $AES2 $AES3 ]
			}
			{
				name "IEC958 Optical Raw Playback Switch"
				lock true
				preserve true
				value [ 1 1 ]
			}
			{
				name "EMU10K1 PCM Send Volume"
				index { @func private_pcm_subdevice }
				lock true
				value [ 0 0 0 0 0 0 0 0  0 255 0 0 0 0 0 0  255 0 0 0 0 0 0 0 ]
			}
			{
				name "EMU10K1 PCM Send Routing"
				index { @func private_pcm_subdevice }
				lock true
				value [ 0 1 2 3 0 0 0 0  20 21 0 1 0 0 0 0   20 21 0 1 0 0 0 0 ]
			}
			{
				name "Audigy Analog/Digital Output Jack"
				lock true
				preserve true
				value 1
			}
		]
	}
}
emu10k1.c renamed from emu10k1.c.org +4 -1
@@ -170,7 +170,10 @@
 	}
 #endif
  
-	if (emu->audigy) {
+	if (emu->audigy && (emu->revision == 4) ) {
+		strcpy(card->driver, "Audigy2");
+		strcpy(card->shortname, "Sound Blaster Audigy2");
+	} else if (emu->audigy) {
 		strcpy(card->driver, "Audigy");
 		strcpy(card->shortname, "Sound Blaster Audigy");
 	} else if (emu->APS) {
#5 lore raw

Re: AC3 passthrough on Audigy and Audigy2...now Works!!!

At Thu, 28 Aug 2003 21:37:22 +0100,

Quoted 8 lines · James Courtier-Dutton

Your patch works up to a point. It will only work on the Audigy, and not the Audigy2.
The Audigy and Audigy2 do things slighly differently.
The L and R channels are reversed on the Audigy2, so I have compensated for this by using a different routing in Audigy2.conf.

If you add my patches, this will work with both the Audigy and Audigy2. :-)

great!
now i applied all patches to cvs.

thanks for nice work!

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf