# ~/.asoundrc
# Try starting ardopc with 
# "ardopc --leaderlength 200 8515 ARDOP ARDOP"
#
# Two independent PCM alsamixer volume controls should be present--
# one control for playback and one control for capture.
#
# If "vestigial" controls from past ALSA configurations appear in
# alsamixer, then the ALSA state may need to be reset:
#
# After editing /var/lib/alsa/asound.state, run:
# $ alsactl restore
# Which will read that file. Also need to "close" the soundcard, which means:
# $ cat /proc/asound/card0/pcm0p/sub0/hw_params
# closed
# See https://bbs.archlinux.org/viewtopic.php?id=172940 for the above simple
# method or search the web for other more complex soutions, if necessary.
#
pcm.dsnooped0 {
   type dsnoop
   ipc_key 50000
   ipc_key_add_uid false   # let multiple users share
   ipc_perm 0666           # IPC permissions for multi-user sharing (octal, default 0600)
   slave {
       pcm "hw:1,0"
       channels 1
   }
}

pcm.dmix0 {
   type dmix
   ipc_key 60000
   ipc_key_add_uid false   # let multiple users share
   ipc_perm 0666           # IPC permissions for multi-user sharing (octal, default 0600)
   slave {
       pcm "hw:1,0"
       rate 44000
   }
}

pcm.preARDOP2IN {type rate slave {pcm "plug:dsnooped0" rate 48000}}
pcm.ARDOP2OUT {type rate slave {pcm "plug:dmix0" rate 48000}}

# this is the rate adjustment suggested by John Wiseman
# Point ARDOP to ARDOP2IN and ARDOP2OUT for rate conversion
pcm.ARDOP {type rate slave {pcm "split_vol" rate 48000}}

# this creates a split volume control, with control on just the input to ARDOP
pcm.split_vol {
     type asym
       playback.pcm {type plug slave.pcm  "ARDOP2OUT"}
       capture.pcm {type plug slave.pcm   "capture_mixer"}
     }

# this is the actual mixer control
pcm.capture_mixer {
     type softvol
       slave.pcm "preARDOP2IN" control {name "PCM Capture Volume"}
       min_dB -20.0
       max_dB  30.0
     }
