# Copyright 2026 Sverse contributors. Licensed under the Apache License, Version 2.0. [CmdletBinding()] param() $ErrorActionPreference = 'Stop' $hrtfRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..')) $hrtfRuntime = Join-Path $hrtfRoot '.spatial-runtime' $hrtfZip = Join-Path $hrtfRuntime 'steamaudio_4.8.1.zip' $hrtfSDK = Join-Path $hrtfRuntime 'steam-audio\steamaudio' New-Item -ItemType Directory -Path $hrtfRuntime -Force | Out-Null if (!(Test-Path -LiteralPath $hrtfZip)) { Invoke-WebRequest 'https://github.com/ValveSoftware/steam-audio/releases/download/v4.8.1/steamaudio_4.8.1.zip' -OutFile $hrtfZip } if ((Get-FileHash -LiteralPath $hrtfZip -Algorithm SHA256).Hash -ne '4A0AA5EC1176F38F0B0993A37C2259D9E86F27E22D5E24F83EC4C3CB9A1D5449') { throw 'Steam Audio archive checksum mismatch' } if (!(Test-Path -LiteralPath (Join-Path $hrtfSDK 'include\phonon.h'))) { Expand-Archive -LiteralPath $hrtfZip -DestinationPath (Join-Path $hrtfRuntime 'steam-audio') -Force } $hrtfBuild = Join-Path $hrtfRuntime 'hrtf-build' & cmake -S (Join-Path $hrtfRoot 'native\hrtf') -B $hrtfBuild -G 'Visual Studio 17 2022' -A x64 "-DSTEAMAUDIO_ROOT=$hrtfSDK" if ($LASTEXITCODE -ne 0) { throw 'HRTF configuration failed' } & cmake --build $hrtfBuild --config Release --parallel if ($LASTEXITCODE -ne 0) { throw 'HRTF build failed' } Copy-Item -LiteralPath (Join-Path $hrtfSDK 'THIRDPARTY.md') -Destination (Join-Path $hrtfBuild 'Release\STEAMAUDIO-THIRDPARTY.md') Copy-Item -LiteralPath (Join-Path $hrtfRoot 'docs\third-party\steam-audio-LICENSE.md') -Destination (Join-Path $hrtfBuild 'Release\STEAMAUDIO-LICENSE.md') Write-Host "HRTF bridge: $hrtfBuild\Release\sverse_hrtf.dll"