From 4598d10b2e76b22b099ada72a05f4efaab152f66 Mon Sep 17 00:00:00 2001 From: "Agatha V. Lovelace" Date: Thu, 21 Dec 2023 22:42:29 +0100 Subject: [PATCH] Switch to new audio interface --- common/fragments/graphical/audio.nix | 2 +- hosts/tears/hardware-configuration.nix | 65 ++++++++++++-------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/common/fragments/graphical/audio.nix b/common/fragments/graphical/audio.nix index 7b47f84..000a163 100644 --- a/common/fragments/graphical/audio.nix +++ b/common/fragments/graphical/audio.nix @@ -21,7 +21,7 @@ serviceConfig = { ExecStart = "${pkgs.noisetorch}/bin/noisetorch -i -s ${ if config.networking.hostName == "tears" then - "UMC202HD_Left" + "US-4x4HR_ch0" else "alsa_input.pci-0000_00_1f.3.analog-stereo" }"; diff --git a/hosts/tears/hardware-configuration.nix b/hosts/tears/hardware-configuration.nix index da73b56..64c8927 100644 --- a/hosts/tears/hardware-configuration.nix +++ b/hosts/tears/hardware-configuration.nix @@ -54,43 +54,36 @@ hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - # Workaround for UMC202HD only exposing a single stereo input - environment.etc."pipewire/pipewire.conf.d/91-umc202hd.conf".text = '' + # Creating separate mono sources for Tascam US-4x4HR + environment.etc."pipewire/pipewire.conf.d/91-us-4x4hr.conf".text = let + name = "US-4x4HR"; + target = "alsa_input.usb-TASCAM_US-4x4HR_no_serial_number-00.pro-input-0"; + input = ch: '' + { + name = libpipewire-module-loopback + args = { + node.description = "${name} Input ${toString ch} Mono" + capture.props = { + node.name = "capture.${name}_ch${toString ch}" + audio.position = [ AUX${toString ch} ] + stream.dont-remix = true + target.object = "${target}" + node.passive = true + } + playback.props = { + node.name = "${name}_ch${toString ch}" + media.class = "Audio/Source" + audio.position = [ MONO ] + } + } + } + ''; + in '' context.modules = [ - { name = libpipewire-module-loopback - args = { - node.description = "UMC202HD Left Input Mono" - capture.props = { - node.name = "capture.UMC202HD_Left" - audio.position = [ AUX0 ] - stream.dont-remix = true - target.object = "alsa_input.usb-BEHRINGER_UMC202HD_192k-00.analog-stereo" - node.passive = true - } - playback.props = { - node.name = "UMC202HD_Left" - media.class = "Audio/Source" - audio.position = [ MONO ] - } - } - } - { name = libpipewire-module-loopback - args = { - node.description = "UMC202HD Right Input Mono" - capture.props = { - node.name = "capture.UMC_202HD_Right" - audio.position = [ AUX1 ] - stream.dont-remix = true - target.object = "alsa_input.usb-BEHRINGER_UMC202HD_192k-00.analog-stereo" - node.passive = true - } - playback.props = { - node.name = "UMC202HD_Right" - media.class = "Audio/Source" - audio.position = [ MONO ] - } - } - } + ${input 0} + ${input 1} + ${input 2} + ${input 3} ] ''; }