I've got a very similar situation here! 2 PCs, one Linux machine (my primary) plus one Windows machine. I set something nice up to automate TWO-WAY audio connection, using my headset with the Linux machine and Pulseaudio, I'm both hearing the Windows machine, AND am able to talk into the mic, through Linux, back into the Windows machine mic in.
Obviously, this is going to require not 1, but 2 AUX cables to be hooked between the machines. But works like a charm ever since I figured it out once. To make it easy on anyone interested in doing the same, I'll share my script here. All you should need to do to get it to work, is find two specific audio sink names for your machine and put them inside the script's variables for them, if they're different from mine.
#!/usr/bin/env bash
# 2-way audio connection - Slaves 2nd device audio through this device:
# - Directs AUX in to default speakers (connect 2nd device -> AUX).
# - Directs Mic to AUX out (connect AUX out -> 2nd device AUX in).
#
# Then sleeps forever. Stops audio redirection when killed.
#
# Requires:
# sudo apt-get install pactl
#
# Manual Process:
# 1) pavucontrol > Configuration > Built-in Audio > Analog Stereo Duplex
# 2) Find - look for "analog-stereo" (no frills) in both commands:
# pacmd list-sources | grep name:
# pacmd list-sinks | grep name:
# 3) Select - enter found name or ID in this command:
# pactl load-module module-loopback source=$auxinsource source_dont_move=1 sink=$defaultsink
# 4) pavucontrol > Input > Built-in Analog Stereo > Line in (plugged in)
# 5) pavucontrol > Playback > Loopback from Built-in Analog Stereo > SELECT_SPEAKERS
# 6) pavucontrol > Output > Built-in Analog Stereo > Line Out (plugged in)
# 7) pavucontrol > Recording > Loopback to Built-in Analog Stereo > SELECT_HEADSET_MIC
#
# BREAKPOINT:
# read -n 1 -s -r -p 'BREAKPOINT'
auxinsource='alsa_input.pci-0000_00_1f.3.analog-stereo' # Get name of AUX in (Replace these with yours!)
micsink='alsa_output.pci-0000_00_1f.3.analog-stereo' # Get name of AUX out (Replace these with yours!)
set -e
printf '\n 1) Connect Audio IN (Win->)...'
defaultsink=$(pactl get-default-sink) # Get name of currently selected speakers
modulein=$(pactl load-module module-loopback source=$auxinsource source_dont_move=1 sink=$defaultsink) # Locked from manual selection in GUI, will not jump around
#modulein=$(pactl load-module module-loopback source=$auxinsource sink=$defaultsink) # Unlocked for manual selection in GUI, but may jump around
#echo ' ' $defaultsink ' connected!' # Debug output
echo ' connected!'
printf '\n 2) Connect Audio OUT (<-Mic)...'
modulemic=$(pactl load-module module-loopback latency_msec=10 source_dont_move=1 sink=$micsink) # Locked from manual selection in GUI, will not jump around
#modulemic=$(pactl load-module module-loopback latency_msec=10 sink=$micsink) # Unlocked for manual selection in GUI, but may jump around
#echo ' ' $micsink ' connected!' # Debug output
echo ' connected!'
printf '\n CTRL+C to stop' # Flavor text.
function cleanup
{
pactl unload-module $modulemic
if [ ! -z ${modulein+x} ]; then
pactl unload-module $modulein
else
echo
fi
}
trap cleanup EXIT
sleep infinity
And for guided step by step troubleshooting of this setup (optional),
#!/usr/bin/env bash
# Troubleshooting steps for audioconnect
#
# Requires:
# sudo apt-get install pactl
#
# BREAKPOINT:
# read -n 1 -s -r -p 'BREAKPOINT'
printf ' 1) pavucontrol > Configuration > Built-in Audio > Analog Stereo Duplex'
read -n 1 -s -r -p ''
echo ': OK'
printf ' 2) pavucontrol > Input > Built-in Analog Stereo > Line in (plugged in)'
read -n 1 -s -r -p ''
echo ': OK'
printf ' 3) pavucontrol > Playback > Loopback from Built-in Analog Stereo > SELECT_SPEAKERS'
read -n 1 -s -r -p ''
echo ': OK'
printf ' 4) pavucontrol > Output > Built-in Analog Stereo > Line Out (plugged in)'
read -n 1 -s -r -p ''
echo ': OK'
printf ' 5) pavucontrol > Recording > Loopback to Built-in Analog Stereo > SELECT_MIC'
read -n 1 -s -r -p ''
echo ': OK'