diff --git a/.gitignore b/.gitignore index 1ac2a8c..d8064f8 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,11 @@ bld/ ## sqlite *.db +## libs +*.so +*.dll +*.dylib + # Visual Studio 2015/2017 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot diff --git a/Console/Console.csproj b/Console/Console.csproj index 46b35a3..19fca67 100644 --- a/Console/Console.csproj +++ b/Console/Console.csproj @@ -1,7 +1,8 @@  Exe - false + true + full net8.0 enable enable @@ -18,7 +19,7 @@ - + @@ -27,4 +28,35 @@ + + + + + + + + $(RuntimeIdentifier) + win-arm64 + win-x86 + win-x64 + linux-arm64 + linux-x86 + linux-x64 + osx-arm64 + osx-x64 + portaudio.dll + libportaudio.so + libportaudio.dylib + + + + + + + + + + + + \ No newline at end of file diff --git a/Console/DownloadPortAudioBin.ps1 b/Console/DownloadPortAudioBin.ps1 new file mode 100644 index 0000000..62d9106 --- /dev/null +++ b/Console/DownloadPortAudioBin.ps1 @@ -0,0 +1,42 @@ +param ( + [string]$platform, + [string]$outputPath +) + +$ErrorActionPreference = "Stop" + +# Normalize platform identifier +$platform = $platform.ToLower().Replace("win-", "windows-") + +# Check if already exists +if (Test-Path $outputPath) { + Write-Host "Skipped downloading Portaudio, file already exists." + exit +} + +# Download the archive +Write-Host "Downloading Portaudio..." +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$http = New-Object System.Net.WebClient +try { + $http.DownloadFile("https://github.com/xBaank/PortAudioBin/releases/download/19.7/portaudio-$platform.zip", "$outputPath.zip") +} finally { + $http.Dispose() +} + +try { + # Extract FFmpeg + Add-Type -Assembly System.IO.Compression.FileSystem + $zip = [IO.Compression.ZipFile]::OpenRead("$outputPath.zip") + try { + $fileName = If ($platform.Contains("windows-")) { "bin/portaudio.dll" } ElseIf ($platform.Contains("linux-")) { "lib/libportaudio.so" } Else { "lib/libportaudio.dylib" } + [IO.Compression.ZipFileExtensions]::ExtractToFile($zip.GetEntry($fileName), $outputPath) + } finally { + $zip.Dispose() + } + + Write-Host "Done downloading Portaudio." +} finally { + # Clean up + Remove-Item "$outputPath.zip" -Force +} \ No newline at end of file