pcm.device{
	format S16_LE
	rate 48000
	type hw
	card 0
	device 0
}


#playback  channel  ############################################################

pcm_slave.play {
	pcm "device"
	rate 48000
	channels 2
	period_size 1024
	buffer_size 8192
}

pcm.play_ch1 {
	type plug
	slave.pcm {
		type dmix
		ipc_key 234881
		slave play
		bindings.0 0
	}
}

pcm.play_ch2 {
	type plug
	slave.pcm {
		type dmix
		ipc_key 234881
		slave play
		bindings.0 1
	}
}

#record channel  ############################################################

pcm_slave.record {
	pcm "device"
	rate 48000
	channels 2
	period_size 1024
	buffer_size 8192
}


pcm.record_ch1 {
	type plug
	slave.pcm {
		type dsnoop
		ipc_key 12342
		slave record
		bindings.0 1
	}
}

pcm.record_ch2 {
	type plug
	slave.pcm {
		type dsnoop
		ipc_key 12342
		slave record
		bindings.0 0
	}
}

#loopback channel  ############################################################

pcm.loopplay1 {
    type hw
    card "Loopback"
    device 0
    subdevice 0
}

pcm.loopplay2 {
    type hw
    card "Loopback"
    device 0
    subdevice 1
}

pcm_slave.loop1 {
    pcm loopplay1
    rate 48000
    channels 1	
    period_size 1024 # must be power of 2
    buffer_size 8192
}

pcm_slave.loop2 {
    pcm loopplay2
    rate 48000
    channels 1	
    period_size 1024 # must be power of 2
    buffer_size 8192
}

pcm.loopch1 {
	type plug
	slave.pcm {
		type dmix
		ipc_key 1234
		slave loop1
		bindings.0 0
	}
}

pcm.loopch2 {
	type plug
	slave.pcm {
		type dmix
		ipc_key 1234
		slave loop2
		bindings.0 0
	}
}


pcm.multi1 {
  type multi
  slaves.a.pcm pcm.play_ch1
  slaves.a.channels 1
  slaves.b.pcm pcm.loopch1
  slaves.b.channels 1
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave b
  bindings.1.channel 0
}


pcm.mplay_ch1 {
  type plug
  slave
  {
	pcm multi1
	rate 48000	
  }
  route_policy "duplicate"
}


pcm.multi2 {
  type multi
  slaves.a.pcm pcm.play_ch2
  slaves.a.channels 1
  slaves.b.pcm pcm.loopch2
  slaves.b.channels 1
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave b
  bindings.1.channel 0
}

pcm.mplay_ch2{
  type plug
  slave
  {
	pcm multi2
	rate 48000
  }
  route_policy "duplicate"
}




#loopback record  ############################################################

pcm.looprec1 {
    type hw
    card "Loopback"
    device 1
    subdevice 0
}

pcm.looprec2 {
    type hw
    card "Loopback"
    device 1
    subdevice 1
}

pcm_slave.loop_record1 {
	pcm looprec1
	rate 48000
	channels 1
	period_size 1024
	buffer_size 8192
}

pcm_slave.loop_record2 {
	pcm looprec2
	rate 48000
	channels 1
	period_size 1024
	buffer_size 8192
}


pcm.loop_record_ch1 {
	type plug
	slave.pcm {
		type dsnoop
		ipc_key 1235
		slave loop_record1
		bindings.0 0
	}
}

pcm.loop_record_ch2 {
	type plug
	slave.pcm {
		type dsnoop
		ipc_key 1235
		slave loop_record2
		bindings.0 0
	}
}


#bidirectional channel  ############################################################

#and this is the real magic
pcm.asymed_ch1 {
   type asym
   playback.pcm "mplay_ch1"
   capture.pcm "record_ch1"
}

pcm.asymed_ch2 {
   type asym
   playback.pcm "mplay_ch2"
   capture.pcm "record_ch2"
}


