59 lines
1.6 KiB
Nix
59 lines
1.6 KiB
Nix
{pkgs, ...}: let
|
|
pipewire = "pipewire.service";
|
|
device = "dev-scarlett_solo.device";
|
|
alsa-input = "alsa_input.usb-Focusrite_Scarlett_Solo_USB_Y7ENM550A6399B-00.pro-input-0";
|
|
|
|
channelMapService = {
|
|
dev,
|
|
name,
|
|
desc,
|
|
from,
|
|
to,
|
|
}: {
|
|
Unit = {
|
|
Description = desc;
|
|
Requires = pipewire;
|
|
BindsTo = device;
|
|
After = [pipewire device];
|
|
};
|
|
Service = {
|
|
Type = "simple";
|
|
ExecStart = ''
|
|
${pkgs.pipewire}/bin/pw-loopback \
|
|
--capture-props="audio.position=[ ${from} ] \
|
|
stream.dont-remix=true" \
|
|
--playback-props='media.class=Audio/Source \
|
|
node.name="${dev}" \
|
|
node.description="${name}" \
|
|
audio.position=[ ${to} ]' \
|
|
-C ${alsa-input}
|
|
'';
|
|
};
|
|
Install.WantedBy = ["default.target" device];
|
|
};
|
|
in {
|
|
systemd.user.services = {
|
|
scarlett-voice = channelMapService {
|
|
dev = "scarlett-voice";
|
|
name = "Scarlett Voice";
|
|
desc = "Remap the left channel of the Scarlett Solo to mono";
|
|
from = "AUX0";
|
|
to = "MONO";
|
|
};
|
|
scarlett-instrument = channelMapService {
|
|
dev = "scarlett-instrument";
|
|
name = "Scarlett Instrument";
|
|
desc = "Remap the right channel of the Scarlett Solo to mono";
|
|
from = "AUX1";
|
|
to = "MONO";
|
|
};
|
|
scarlett-stereo = channelMapService {
|
|
dev = "scarlett-both";
|
|
name = "Scarlett Voice + Instrument";
|
|
desc = "Remix the channels of the Scarlett Solo";
|
|
from = "AUX0 AUX1";
|
|
to = "MONO";
|
|
};
|
|
};
|
|
}
|