[MPlayer-users] 2 audio streams (with Alsa)

Mikael Magnusson mikaelmagnusson at tjohoo.se
Wed Jul 7 14:20:29 CEST 2004


On Wed, Jul 07, 2004 at 11:19:45AM +0800, Mick wrote:
> To make this work for 2 sounds devices, i would need to output to a pcm
> fifo, read the fifo to some kind of ring buffer, the have 2 such mplayer
> daemons playing off the buffer..
> 
> Alls this, and i'd even say i pretty poor at bash scripting.. So it
> sounds out of my reach..
> 

I you are using Alsa I think you can use a combination of the PCM
multi and route plugins. PCM multi is used to create a four channel
PCM device from your two sound cards. PCM route sends a stereo channel
to both cards. I haven't tested the configuration, but it should work.

You can read more about .asoundrc at AlsaOpensrcOrg [1].

[1] http://alsa.opensrc.org/index.php?page=.asoundrc

Regards,
Mikael Magnusson

Add to your ~/.asoundrc :

pcm.multi {
	type multi;
	slaves {
		a {
			pcm "hw:0,0"
			channels 2
		}
		b {
			pcm "hw:1,0"
			channels 2
		}
	}

	bindings {
		0 {
			slave a
			channel 0
		}
		1 {
			slave a
			channel 1
		}
		2 {
			slave b
			channel 0
		}
		3 {
			slave b
			channel 1
		}
	}
}

ctl.multi {
        type hw;
        card 0;
}

pcm.ttable {
        type route;
	slave {
	      pcm "multi"
	      channels 4
	}
        ttable {
	       0.0 1
	       1.1 1
	       0.2 1
	       1.3 1
	}
}

ctl.ttable {
        type hw;
        card 0;
}




More information about the MPlayer-users mailing list