#
# openmamba system default configuration for the Advanced Linux Sound Architecture (ALSA)
#

# hardware devices -> dmix for output
pcm.dmixed {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"        # you cannot use a "plug" device here, darn.
        period_time 0
        period_size 1024    # must be power of 2
        #buffer_time 0
        #buffer_size 4096
        #format "S32_LE"
        #periods 128
        #rate 48000
    }                                                                                                                                    
    bindings { 
        0 0 
        1 1 
    } 
}

pcm.dmixed1 {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:2,0"        # you cannot use a "plug" device here, darn.
        period_time 0
        period_size 1024    # must be power of 2
        #buffer_time 0
        #buffer_size 4096
        #format "S32_LE"
        #periods 128
        #rate 48000
    }                                                                                                                                    
    bindings { 
        0 0 
        1 1 
    } 
}

# hardware devices -> dsnoop for input
pcm.dsnooped {
    ipc_key 1025
    type dsnoop
    slave {
        pcm "hw:0,0"        # you cannot use a "plug" device here, darn.
	period_time 0
        period_size 1024    # must be power of 2
	#buffer_time 0
        #buffer_size 4096
	#format "S32_LE"
	#periods 128
        #rate 48000
    }                                                                                                                                    
    bindings { 
        0 0 
        1 1 
    } 
}

pcm.dsnooped1 {
    ipc_key 1025
    type dsnoop
    slave {
        pcm "hw:2,0"        # you cannot use a "plug" device here, darn.
	period_time 0
        period_size 1024    # must be power of 2
	#buffer_time 0
        #buffer_size 4096
	#format "S32_LE"
	#periods 128
        #rate 48000
    }                                                                                                                                    
    bindings { 
        0 0 
        1 1 
    } 
}

# hardware devices -> dmix -> softvol
pcm.softvol_out {
    type            softvol
    slave {
        pcm         "dmixed"      #redirect the output to dmix (instead of "hw:0,0")
    }
    control {
        name        "Output Gain"       #override the PCM slider to set the softvol volume level globally
        card        0
    }
    max_dB 20.0
}

pcm.softvol_in {
    type            softvol
    slave {
        pcm         "dsnooped"      #redirect the output to dmix (instead of "hw:0,0")
    }
    control {
        name        "Capture Gain"       #override the PCM slider to set the softvol volume level globally
        card        0
    }
    max_dB 50.0
}

pcm.softvol_out1 {
    type            softvol
    slave {
        pcm         "dmixed1"      #redirect the output to dmix (instead of "hw:0,0")
    }
    control {
        name        "Output Gain"       #override the PCM slider to set the softvol volume level globally
        card        0
    }
    max_dB 20.0
}

pcm.softvol_in1 {
    type            softvol
    slave {
        pcm         "dsnooped1"      #redirect the output to dmix (instead of "hw:0,0")
    }
    control {
        name        "Capture Gain"       #override the PCM slider to set the softvol volume level globally
        card        0
    }
    max_dB 50.0
}
   
# softvol_in + softvol_out -> asym
pcm.asymed {
    type asym
    playback.pcm "softvol_out"
    capture.pcm "softvol_in"
}

pcm.pasymed {
    type plug
    slave.pcm "asymed"
}
   
pcm.asymed1 {
    type asym
    playback.pcm "softvol_out1"
    capture.pcm "softvol_in1"
}

pcm.pasymed1 {
    type plug
    slave.pcm "asymed1"
}

pcm.!default {
    type plug
    slave.pcm "asymed"
    hint {
        show on
        description "System default (recommended)"
    }
}

pcm.!default1 {
    type plug
    slave.pcm "asymed1"
    hint {
        show on
        description "External device"
    }
}

ctl.!default {
    type hw
    card 0
}


# Other special pcms
pcm.skype {
    type route
    slave.pcm "dsnooped"
    ttable.0.1 1
    ttable.1.0 1
}
   
#for aoss:
pcm.dsp0 {
    type plug
    slave.pcm "asymed"
}
   
ctl.mixer0 {
    type hw
    card 0
}

##a quick plug plugin for above device to do the converting magic
#pcm.pasymed {
#    type plug
#    slave.pcm "asymed"
#}

##a ctl device to keep xmms happy
#ctl.pasymed {
#    type hw
#    card 0
#}
   

# Jack Loop 1

############ ALSA Side ############

######################################
# Playback Device for Alsa Programs. #
######################################

pcm.jack_playback_1 {
  type plug
  slave.pcm "hw:Loopback,0,0"
}

#####################################
# Capture Device for Alsa Programs. #
#####################################

pcm.jack_capture_1 {
  type plug
  slave.pcm "hw:Loopback,0,1"
}

#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################

pcm.jack_link_1 {
  type asym
  playback.pcm "jack_playback_1"
  capture.pcm "jack_capture_1"
  hint {
	show on
	description "ALSA Jack Interface 1"
  }
}


############ JACK Side ############

####################################
# ALSA Input for Jack Connections. #
####################################

pcm.alsa_input_1 {
  type plug
  slave.pcm "hw:Loopback,1,0"
}

#####################################
# ALSA Output for Jack Connections. #
#####################################

pcm.alsa_output_1 {
  type plug
  slave.pcm "hw:Loopback,1,1"
}

# Jack Loop 2

############ ALSA Side ############

######################################
# Playback Device for Alsa Programs. #
######################################

pcm.jack_playback_2 {
  type plug
  slave.pcm "hw:Loopback,0,2"
}

#####################################
# Capture Device for Alsa Programs. #
#####################################

pcm.jack_capture_2 {
  type plug
  slave.pcm "hw:Loopback,0,3"
}

#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################

pcm.jack_link_2 {
  type asym
  playback.pcm "jack_playback_2"
  capture.pcm "jack_capture_2"
  hint {
	show on
	description "ALSA Jack Interface 2"
  }
}


############ JACK Side ############

####################################
# ALSA Input for Jack Connections. #
####################################

pcm.alsa_input_2 {
  type plug
  slave.pcm "hw:Loopback,1,2"
}

#####################################
# ALSA Output for Jack Connections. #
#####################################

pcm.alsa_output_2 {
  type plug
  slave.pcm "hw:Loopback,1,3"
}




###############
# Jack Loop 3 ##############################################
###############

############ ALSA Side ############

######################################
# Playback Device for Alsa Programs. #
######################################

pcm.jack_playback_3 {
  type plug
  slave.pcm "hw:Loopback,0,4"
}

#####################################
# Capture Device for Alsa Programs. #
#####################################

pcm.jack_capture_3 {
  type plug
  slave.pcm "hw:Loopback,0,5"
}

#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################

pcm.jack_link_3 {
  type asym
  playback.pcm "jack_playback_3"
  capture.pcm "jack_capture_3"
  hint {
	show on
	description "ALSA Jack Interface 3"
  }
}


############ JACK Side ############

####################################
# ALSA Input for Jack Connections. #
####################################

pcm.alsa_input_3 {
  type plug
  slave.pcm "hw:Loopback,1,4"
}

#####################################
# ALSA Output for Jack Connections. #
#####################################

pcm.alsa_output_3 {
  type plug
  slave.pcm "hw:Loopback,1,5"
}




###############
# Jack Loop 4 ##############################################
###############

############ ALSA Side ############

######################################
# Playback Device for Alsa Programs. #
######################################

pcm.jack_playback_4 {
  type plug
  slave.pcm "hw:Loopback,0,6"
}

#####################################
# Capture Device for Alsa Programs. #
#####################################

pcm.jack_capture_4 {
  type plug
  slave.pcm "hw:Loopback,0,7"
}

#########################################
# Full-Duplex Device for Alsa Programs. #
#########################################

pcm.jack_link_4 {
  type asym
  playback.pcm "jack_playback_4"
  capture.pcm "jack_capture_4"
  hint {
	show on
	description "ALSA Jack Interface 4"
  }
}


############ JACK Side ############

####################################
# ALSA Input for Jack Connections. #
####################################

pcm.alsa_input_4 {
  type plug
  slave.pcm "hw:Loopback,1,6"
}

#####################################
# ALSA Output for Jack Connections. #
#####################################

pcm.alsa_output_4 {
  type plug
  slave.pcm "hw:Loopback,1,7"
}


