mpv: ship the libmysofa HRTF file via $XDG_CONFIG_DIRS/share/libmysofa/default.sofa
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.sane.programs.mpv;
|
cfg = config.sane.programs.mpv;
|
||||||
myHrtf = "${pkgs.sofacoustics.listen.irc_1052}/share/sofa/listen-irc_1052.sofa";
|
|
||||||
uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: {
|
uosc = pkgs.mpvScripts.uosc.overrideAttrs (upstream: {
|
||||||
version = "5.2.0-unstable-2024-03-13";
|
version = "5.2.0-unstable-2024-03-13";
|
||||||
src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub {
|
src = lib.warnIf (lib.versionOlder "5.2.0" upstream.version) "uosc outdated; remove patch?" pkgs.fetchFromGitHub {
|
||||||
@@ -138,6 +137,11 @@ let
|
|||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
sane.programs.sofa-default = {
|
||||||
|
packageUnwrapped = pkgs.sofacoustics.listen.irc_1052.asDefault;
|
||||||
|
sandbox.enable = false; #< data only
|
||||||
|
};
|
||||||
|
|
||||||
sane.programs.mpv = {
|
sane.programs.mpv = {
|
||||||
packageUnwrapped = pkgs.mpv-unwrapped.wrapper {
|
packageUnwrapped = pkgs.mpv-unwrapped.wrapper {
|
||||||
mpv = pkgs.mpv-unwrapped.override rec {
|
mpv = pkgs.mpv-unwrapped.override rec {
|
||||||
@@ -195,6 +199,7 @@ in
|
|||||||
"sane-cast"
|
"sane-cast"
|
||||||
"sane-die-with-parent"
|
"sane-die-with-parent"
|
||||||
"xdg-terminal-exec"
|
"xdg-terminal-exec"
|
||||||
|
"sofa-default"
|
||||||
];
|
];
|
||||||
|
|
||||||
sandbox.method = "bwrap";
|
sandbox.method = "bwrap";
|
||||||
@@ -227,7 +232,6 @@ in
|
|||||||
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
|
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
|
||||||
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
|
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
|
||||||
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
|
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
|
||||||
fs.".config/mpv/hrtf.sofa".symlink.target = myHrtf;
|
|
||||||
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
|
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
|
||||||
fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf;
|
fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf;
|
||||||
fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf;
|
fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf;
|
||||||
@@ -257,5 +261,9 @@ in
|
|||||||
#v Loupe image viewer can't open URIs, so use mpv instead
|
#v Loupe image viewer can't open URIs, so use mpv instead
|
||||||
mime.urlAssociations."^https?://i\.imgur.com/.+" = "mpv.desktop";
|
mime.urlAssociations."^https?://i\.imgur.com/.+" = "mpv.desktop";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.pathsToLink = lib.mkIf cfg.enabled [
|
||||||
|
"/share/libmysofa"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,4 +32,4 @@ border=no
|
|||||||
# see: <https://ffmpeg.org/ffmpeg-filters.html#sofalizer>
|
# see: <https://ffmpeg.org/ffmpeg-filters.html#sofalizer>
|
||||||
# TODO: this maybe belongs in pipewire instead of mpv.
|
# TODO: this maybe belongs in pipewire instead of mpv.
|
||||||
# at least, provide a way to disable the downmixing, so i can still output 5.1 over HDMI?
|
# at least, provide a way to disable the downmixing, so i can still output 5.1 over HDMI?
|
||||||
af=sofalizer=sofa=/home/colin/.config/mpv/hrtf.sofa
|
af=sofalizer=sofa=/etc/profiles/per-user/colin/share/libmysofa/default.sofa:gain=11
|
||||||
|
@@ -3,11 +3,12 @@
|
|||||||
lib,
|
lib,
|
||||||
newScope,
|
newScope,
|
||||||
nix-update-script,
|
nix-update-script,
|
||||||
|
runCommandLocal,
|
||||||
stdenvNoCC,
|
stdenvNoCC,
|
||||||
symlinkJoin,
|
symlinkJoin,
|
||||||
}:
|
}:
|
||||||
lib.makeScope newScope (self: with self; {
|
lib.makeScope newScope (self: with self; {
|
||||||
downloadSofacoustics = prefix: database: name: hash: stdenvNoCC.mkDerivation {
|
downloadSofacoustics = prefix: database: name: hash: stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
name = "${database}-${name}";
|
name = "${database}-${name}";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "${prefix}${name}.sofa";
|
url = "${prefix}${name}.sofa";
|
||||||
@@ -17,8 +18,8 @@ lib.makeScope newScope (self: with self; {
|
|||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share/sofa
|
mkdir -p $out/share/libmysofa
|
||||||
cp $src $out/share/sofa/${database}-${name}.sofa
|
cp $src $out/share/libmysofa/${database}-${name}.sofa
|
||||||
'';
|
'';
|
||||||
doBuild = false;
|
doBuild = false;
|
||||||
|
|
||||||
@@ -27,7 +28,11 @@ lib.makeScope newScope (self: with self; {
|
|||||||
passthru.updateScript = nix-update-script {
|
passthru.updateScript = nix-update-script {
|
||||||
extraArgs = [ "--version" "skip" ];
|
extraArgs = [ "--version" "skip" ];
|
||||||
};
|
};
|
||||||
};
|
passthru.asDefault = runCommandLocal "${database}-${name}-as-default" {} ''
|
||||||
|
mkdir -p $out/share/libmysofa
|
||||||
|
ln -s "${finalAttrs.finalPackage}/share/libmysofa/${database}-${name}.sofa" $out/share/libmysofa/default.sofa
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
ari = lib.recurseIntoAttrs (lib.mapAttrs (downloadSofacoustics "https://sofacoustics.org/data/database/ari/hrtf%20" "ari") {
|
ari = lib.recurseIntoAttrs (lib.mapAttrs (downloadSofacoustics "https://sofacoustics.org/data/database/ari/hrtf%20" "ari") {
|
||||||
# in-the-ear measurements from real human subjects, complete with detailed anthropometric data.
|
# in-the-ear measurements from real human subjects, complete with detailed anthropometric data.
|
||||||
|
Reference in New Issue
Block a user