mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 13:20:47 +00:00
minor rework
This commit is contained in:
parent
6468270fd0
commit
cd7508b823
@ -12,23 +12,22 @@ Import-Module ..\..\lib\Voicemeeter.psm1
|
|||||||
$VerbosePreference = "Continue"
|
$VerbosePreference = "Continue"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$vmr = Get-RemotePotato
|
$vmr = Connect-Voicemeeter -Kind "potato"
|
||||||
|
|
||||||
$buses = @($vmr.bus[1], $vmr.bus[2], $vmr.bus[4], $vmr.bus[6])
|
$buses = @($vmr.bus[1], $vmr.bus[2], $vmr.bus[4], $vmr.bus[6])
|
||||||
$unmutedIndex = $null
|
$unmutedIndex = $null
|
||||||
|
|
||||||
# 1)
|
# 1)
|
||||||
$buses | ForEach-Object {
|
foreach ($bus in $buses) {
|
||||||
$bus = $_
|
|
||||||
# 2)
|
# 2)
|
||||||
if (-not $bus.mute) {
|
if (-not $bus.mute) {
|
||||||
"bus " + $bus.index + " is unmuted... muting it" | Write-Host
|
"bus $($bus.index) is unmuted... muting it" | Write-Host
|
||||||
$unmutedIndex = $buses.IndexOf($bus)
|
$unmutedIndex = $buses.IndexOf($bus)
|
||||||
$bus.mute = $true
|
$bus.mute = $true
|
||||||
|
|
||||||
# 3)
|
# 3)
|
||||||
if ($buses[++$unmutedIndex]) {
|
if ($buses[++$unmutedIndex]) {
|
||||||
"unmuting bus " + $buses[$unmutedIndex].index | Write-Host
|
"unmuting bus $($buses[$unmutedIndex].index)" | Write-Host
|
||||||
$buses[$unmutedIndex].mute = $false
|
$buses[$unmutedIndex].mute = $false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -36,7 +35,10 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# 4)
|
# 4)
|
||||||
if ($null -eq $unmutedIndex) { $buses[0].mute = $false }
|
if ($null -eq $unmutedIndex) {
|
||||||
"unmuting bus " + $buses[0].index | Write-Host
|
$buses[0].mute = $false
|
||||||
|
"unmuting bus $($buses[0].index)" | Write-Host
|
||||||
}
|
}
|
||||||
finally { $vmr.Logout() }
|
|
||||||
|
}
|
||||||
|
finally { Disconnect-Voicemeeter }
|
||||||
|
Loading…
Reference in New Issue
Block a user