31cf1ff4ee
Without those data files HRTF will silently fail to initialize. It searches /usr and /usr/local by default but we don't have those paths. It also searches XDG_DATA_DIRS but using that requires configuration by the user. This patch makes makes it just work. How to play with it: - Build `mpv` with `openalSoft` support. - cat << EOF > ~/.alsoftrc [general] hrtf = true EOF - Wear stereo headphones. - Play a file with 6 or more channels with `mpv -ao openal $file`, e.g. https://archive.org/download/5.1SurroundSoundTestFilesVariousFormatsAACAC3MP4DTSWAV/5.1%20Surround%20Sound%20AAC%20Test.mp4 - Try `hrtf = false` to hear the difference.
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{ stdenv, fetchFromGitHub, cmake
|
|
, alsaSupport ? !stdenv.isDarwin, alsaLib ? null
|
|
, pulseSupport ? !stdenv.isDarwin, libpulseaudio ? null
|
|
, CoreServices, AudioUnit, AudioToolbox
|
|
}:
|
|
|
|
with stdenv.lib;
|
|
|
|
assert alsaSupport -> alsaLib != null;
|
|
assert pulseSupport -> libpulseaudio != null;
|
|
|
|
stdenv.mkDerivation rec {
|
|
version = "1.19.1";
|
|
pname = "openal-soft";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "kcat";
|
|
repo = "openal-soft";
|
|
rev = "${pname}-${version}";
|
|
sha256 = "0b0g0q1c36nfb289xcaaj3cmyfpiswvvgky3qyalsf9n4dj7vnzi";
|
|
};
|
|
|
|
# this will make it find its own data files (e.g. HRTF profiles)
|
|
# without any other configuration
|
|
patches = [ ./search-out.patch ];
|
|
postPatch = ''
|
|
substituteInPlace Alc/helpers.c \
|
|
--replace "@OUT@" $out
|
|
'';
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = []
|
|
++ optional alsaSupport alsaLib
|
|
++ optional pulseSupport libpulseaudio
|
|
++ optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
|
|
|
|
NIX_LDFLAGS = []
|
|
++ optional alsaSupport "-lasound"
|
|
++ optional pulseSupport "-lpulse";
|
|
|
|
meta = {
|
|
description = "OpenAL alternative";
|
|
homepage = https://kcat.strangesoft.net/openal.html;
|
|
license = licenses.lgpl2;
|
|
maintainers = with maintainers; [ftrvxmtrx];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|