2022-01-06 18:01:28 +00:00
|
|
|
<#
|
|
|
|
The following script was written with the intention of being used with a .vbs helper script, to create
|
|
|
|
a hotkey to "Go to Next Bus" in a subset of buses with a visual indicator on your primary display.
|
|
|
|
|
|
|
|
Credits go to @bobsupercow
|
|
|
|
#>
|
|
|
|
|
2022-01-09 14:23:20 +00:00
|
|
|
# 1) Loop through an array of buses.
|
|
|
|
# 2) Mute first unmuted bus
|
|
|
|
# 3) If next bus in array exists, unmute it
|
|
|
|
# 4) else unmute the first bus specified in array.
|
|
|
|
# 5) If every bus in array is muted, unmute the first bus specified in array.
|
2022-01-06 18:01:28 +00:00
|
|
|
|
|
|
|
Import-Module Voicemeeter
|
|
|
|
|
|
|
|
try {
|
|
|
|
# Run the factory function for required Voicemeeter type
|
|
|
|
$vmr = Get-RemotePotato
|
|
|
|
|
|
|
|
$unmutedIndex = $null
|
|
|
|
[int32[]]$buses = @(1,2,4,6)
|
|
|
|
|
2022-01-09 14:23:20 +00:00
|
|
|
# 1)
|
2022-01-06 18:01:28 +00:00
|
|
|
0..($buses.Length -1) | ForEach-Object {
|
2022-01-09 14:23:20 +00:00
|
|
|
# 2)
|
|
|
|
if ( -not $vmr.bus[$buses[$_]].mute ){
|
2022-01-06 18:01:28 +00:00
|
|
|
$unmutedIndex = $_
|
|
|
|
$vmr.bus[$buses[$unmutedIndex]].mute = $true
|
|
|
|
|
|
|
|
# 3)
|
2022-01-09 14:23:20 +00:00
|
|
|
if ( $buses[++$unmutedIndex] ){
|
|
|
|
$vmr.bus[$buses[$unmutedIndex]].mute = $false
|
|
|
|
break
|
2022-01-06 18:01:28 +00:00
|
|
|
}
|
2022-01-09 14:23:20 +00:00
|
|
|
# 4)
|
|
|
|
else { $vmr.bus[$buses[0]].mute = $false }
|
2022-01-06 18:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-09 14:23:20 +00:00
|
|
|
# 5)
|
|
|
|
if ( $null -eq $unmutedIndex ) { $vmr.bus[$buses[0]].mute = $false }
|
2022-01-06 18:01:28 +00:00
|
|
|
|
|
|
|
} finally { $vmr.Logout() }
|