Add blackhole audiodevice for macOS Big sur, add sox and Switchaudio-osx versions to the docs (#3542)

This commit is contained in:
Mikhail Timofeev
2021-06-08 10:44:31 +03:00
committed by GitHub
parent 2ae7ebddab
commit 4da3c8eef9
6 changed files with 52 additions and 8 deletions

View File

@@ -49,3 +49,14 @@ function Get-PathWithLink {
$link = Get-LinkTarget($inputPath) $link = Get-LinkTarget($inputPath)
return "${inputPath}${link}" return "${inputPath}${link}"
} }
function Get-BrewPackageVersion {
param (
[string] $CommandName
)
(Get-LinkTarget (Get-Command $CommandName).Source | Out-String) -match "(?<version>(\d+.){2}\d+)" | Out-Null
$packageVersion = $Matches.Version
return $packageVersion
}

View File

@@ -1,17 +1,28 @@
#!/bin/bash -e -o pipefail #!/bin/bash -e -o pipefail
source ~/utils/utils.sh source ~/utils/utils.sh
echo "install soundflower"
brew install --cask soundflower
echo "install switchaudio-osx" echo "install switchaudio-osx"
brew_smart_install "switchaudio-osx" brew_smart_install "switchaudio-osx"
echo "install sox" echo "install sox"
brew_smart_install "sox" brew_smart_install "sox"
echo "set Soundflower (2ch) as input/output device" # Big Sur doesn't support soundflower installation without user interaction https://github.com/mattingalls/Soundflower/releases/tag/2.0b2
SwitchAudioSource -s "Soundflower (2ch)" -t input # Install blackhole-2ch for Big Sur instead
SwitchAudioSource -s "Soundflower (2ch)" -t output if is_Less_BigSur; then
echo "install soundflower"
brew install --cask soundflower
echo "set Soundflower (2ch) as input/output device"
SwitchAudioSource -s "Soundflower (2ch)" -t input
SwitchAudioSource -s "Soundflower (2ch)" -t output
else
echo "install blackhole-2ch"
brew_smart_install "blackhole-2ch"
echo "set BlackHole 2ch as input/output device"
SwitchAudioSource -s "BlackHole 2ch" -t input
SwitchAudioSource -s "BlackHole 2ch" -t output
fi
invoke_tests "System" "Audio Device" invoke_tests "System" "Audio Device"

View File

@@ -462,6 +462,16 @@ function Get-CabalVersion {
return "Cabal $cabalVersion" return "Cabal $cabalVersion"
} }
function Get-SwitchAudioOsxVersion {
$switchAudioVersion = Get-BrewPackageVersion -CommandName "SwitchAudioSource"
return "Switchaudio-osx $switchAudioVersion"
}
function Get-SoxVersion {
$soxVersion = Get-BrewPackageVersion -CommandName "sox"
return "Sox $soxVersion"
}
function Get-StackVersion { function Get-StackVersion {
$stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object {$_.replace(",","")} $stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object {$_.replace(",","")}
return "Stack $stackVersion" return "Stack $stackVersion"

View File

@@ -145,6 +145,13 @@ if ($os.IsLessThanBigSur) {
) )
} }
if (-not $os.IsHighSierra) {
$utilitiesList += @(
(Get-SwitchAudioOsxVersion),
(Get-SoxVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($utilitiesList | Sort-Object) $markdown += New-MDList -Style Unordered -Lines ($utilitiesList | Sort-Object)
$markdown += New-MDNewLine $markdown += New-MDNewLine

View File

@@ -182,6 +182,7 @@
"./provision/core/nginx.sh", "./provision/core/nginx.sh",
"./provision/core/postgresql.sh", "./provision/core/postgresql.sh",
"./provision/core/mongodb.sh", "./provision/core/mongodb.sh",
"./provision/core/audiodevice.sh",
"./provision/core/vcpkg.sh", "./provision/core/vcpkg.sh",
"./provision/core/miniconda.sh", "./provision/core/miniconda.sh",
"./provision/core/chrome.sh", "./provision/core/chrome.sh",

View File

@@ -17,7 +17,7 @@ Describe "Certificate" {
} }
} }
Describe "Audio device" -Skip:($os.IsHighSierra -or $os.IsBigSur) { Describe "Audio device" -Skip:($os.IsHighSierra) {
It "Sox is installed" { It "Sox is installed" {
"sox --version" | Should -ReturnZeroExitCode "sox --version" | Should -ReturnZeroExitCode
} }
@@ -26,9 +26,13 @@ Describe "Audio device" -Skip:($os.IsHighSierra -or $os.IsBigSur) {
"SwitchAudioSource -c" | Should -ReturnZeroExitCode "SwitchAudioSource -c" | Should -ReturnZeroExitCode
} }
It "Audio channel Soundflower (2ch)" { It "Audio channel Soundflower (2ch)" -Skip:($os.IsBigSur) {
SwitchAudioSource -c | Should -BeLikeExactly "Soundflower (2ch)" SwitchAudioSource -c | Should -BeLikeExactly "Soundflower (2ch)"
} }
It "Audio channel BlackHole 2ch" -Skip:($os.IsLessThanBigSur) {
SwitchAudioSource -c | Should -BeLikeExactly "BlackHole 2ch"
}
} }
Describe "Screen Resolution" -Skip:($os.IsHighSierra) { Describe "Screen Resolution" -Skip:($os.IsHighSierra) {