mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
add cmdletbinding to examples for debug, verbose flags
add verbose,debug flags to launch scripts
This commit is contained in:
parent
9b3d9f2250
commit
bc6162cf16
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@ -16,7 +16,9 @@
|
|||||||
"\"!strip[0].mute\",",
|
"\"!strip[0].mute\",",
|
||||||
"\"strip[0].mute\",",
|
"\"strip[0].mute\",",
|
||||||
"\"bus[2].eq.on=1\",",
|
"\"bus[2].eq.on=1\",",
|
||||||
"\"command.lock=1\""
|
"\"command.lock=1\"",
|
||||||
|
"-Verbose",
|
||||||
|
"-Debug"
|
||||||
],
|
],
|
||||||
"createTemporaryIntegratedConsole": true
|
"createTemporaryIntegratedConsole": true
|
||||||
},
|
},
|
||||||
@ -26,7 +28,10 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "${workspaceRoot}/examples/nextbus",
|
"cwd": "${workspaceRoot}/examples/nextbus",
|
||||||
"script": "${workspaceFolder}/examples/nextbus/GoTo-NextBus.ps1",
|
"script": "${workspaceFolder}/examples/nextbus/GoTo-NextBus.ps1",
|
||||||
"args": [],
|
"args": [
|
||||||
|
"-Verbose",
|
||||||
|
"-Debug"
|
||||||
|
],
|
||||||
"createTemporaryIntegratedConsole": true
|
"createTemporaryIntegratedConsole": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -35,7 +40,10 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "${workspaceRoot}/examples/obs",
|
"cwd": "${workspaceRoot}/examples/obs",
|
||||||
"script": "${workspaceFolder}/examples/obs/Vm-Obs-Sync.ps1",
|
"script": "${workspaceFolder}/examples/obs/Vm-Obs-Sync.ps1",
|
||||||
"args": [],
|
"args": [
|
||||||
|
"-Verbose",
|
||||||
|
"-Debug"
|
||||||
|
],
|
||||||
"createTemporaryIntegratedConsole": true
|
"createTemporaryIntegratedConsole": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
[switch]$interactive,
|
[switch]$interactive,
|
||||||
[switch]$output,
|
|
||||||
[String]$kind = "banana",
|
[String]$kind = "banana",
|
||||||
[String[]]$script = @()
|
[String[]]$script = @()
|
||||||
)
|
)
|
||||||
|
|
||||||
Import-Module ..\..\lib\Voicemeeter.psm1
|
Import-Module ..\..\lib\Voicemeeter.psm1
|
||||||
|
|
||||||
$VerbosePreference = "Continue"
|
|
||||||
|
|
||||||
function get-value {
|
function get-value {
|
||||||
param([object]$vmr, [string]$line)
|
param([object]$vmr, [string]$line)
|
||||||
try {
|
try {
|
||||||
@ -24,16 +22,16 @@ function msgHandler {
|
|||||||
param([object]$vmr, [string]$line)
|
param([object]$vmr, [string]$line)
|
||||||
$line + " passed to handler" | Write-Debug
|
$line + " passed to handler" | Write-Debug
|
||||||
if ($line[0] -eq "!") {
|
if ($line[0] -eq "!") {
|
||||||
if ($output) { "Toggling " + $line.substring(1) | Write-Host }
|
"Toggling " + $line.substring(1) | Write-Debug
|
||||||
$retval = get-value -vmr $vmr -line $line.substring(1)
|
$retval = get-value -vmr $vmr -line $line.substring(1)
|
||||||
$vmr.Setter($line.substring(1), 1 - $retval)
|
$vmr.Setter($line.substring(1), 1 - $retval)
|
||||||
}
|
}
|
||||||
elseif ($line.Contains("=")) {
|
elseif ($line.Contains("=")) {
|
||||||
if ($output) { "Setting $line" | Write-Host }
|
"Setting $line" | Write-Debug
|
||||||
$vmr.SendText($line)
|
$vmr.SendText($line)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($output) { "Getting $line" | Write-Host }
|
"Getting $line" | Write-Debug
|
||||||
$retval = get-value -vmr $vmr -line $line
|
$retval = get-value -vmr $vmr -line $line
|
||||||
$line + " = " + $retval | Write-Host
|
$line + " = " + $retval | Write-Host
|
||||||
}
|
}
|
||||||
|
@ -7,27 +7,30 @@
|
|||||||
Credits go to @bobsupercow
|
Credits go to @bobsupercow
|
||||||
#>
|
#>
|
||||||
|
|
||||||
Import-Module ..\..\lib\Voicemeeter.psm1
|
[cmdletbinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
$VerbosePreference = "Continue"
|
Import-Module ..\..\lib\Voicemeeter.psm1
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$vmr = Connect-Voicemeeter -Kind "potato"
|
$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])
|
||||||
|
"Buses in selection: $($buses)"
|
||||||
$unmutedIndex = $null
|
$unmutedIndex = $null
|
||||||
|
|
||||||
# 1)
|
# 1)
|
||||||
|
"Cycling through bus selection to check for first unmuted Bus..." | Write-Host
|
||||||
foreach ($bus in $buses) {
|
foreach ($bus in $buses) {
|
||||||
# 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
|
||||||
}
|
}
|
||||||
@ -37,7 +40,7 @@ try {
|
|||||||
# 4)
|
# 4)
|
||||||
if ($null -eq $unmutedIndex) {
|
if ($null -eq $unmutedIndex) {
|
||||||
$buses[0].mute = $false
|
$buses[0].mute = $false
|
||||||
"unmuting bus $($buses[0].index)" | Write-Host
|
"Unmuting Bus $($buses[0].index)" | Write-Host
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
[cmdletbinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
Import-Module ..\..\lib\Voicemeeter.psm1
|
Import-Module ..\..\lib\Voicemeeter.psm1
|
||||||
Import-Module obs-powershell
|
Import-Module obs-powershell
|
||||||
|
|
||||||
$VerbosePreference = "Continue"
|
|
||||||
|
|
||||||
function CurrentProgramSceneChanged {
|
function CurrentProgramSceneChanged {
|
||||||
param([System.Object]$data)
|
param([System.Object]$data)
|
||||||
Write-Host "Switched to scene", $data.sceneName
|
Write-Host "Switched to scene", $data.sceneName
|
||||||
@ -10,19 +11,15 @@ function CurrentProgramSceneChanged {
|
|||||||
switch ($data.sceneName) {
|
switch ($data.sceneName) {
|
||||||
"START" {
|
"START" {
|
||||||
$vmr.strip[0].mute = !$vmr.strip[0].mute
|
$vmr.strip[0].mute = !$vmr.strip[0].mute
|
||||||
"Toggling Strip 0 mute"
|
|
||||||
}
|
}
|
||||||
"BRB" {
|
"BRB" {
|
||||||
$vmr.strip[0].gain = -8.3
|
$vmr.strip[0].gain = -8.3
|
||||||
"Setting Strip 0 gain to -8.3"
|
|
||||||
}
|
}
|
||||||
"END" {
|
"END" {
|
||||||
$vmr.strip[0].mono = $true
|
$vmr.strip[0].mono = $true
|
||||||
"Setting Strip 0 mono to `$true"
|
|
||||||
}
|
}
|
||||||
"LIVE" {
|
"LIVE" {
|
||||||
$vmr.strip[0].color_x = 0.3
|
$vmr.strip[0].color_x = 0.3
|
||||||
"Setting Strip 0 color_x to 0.3"
|
|
||||||
}
|
}
|
||||||
default { "Expected START, BRB, END or LIVE scene" | Write-Warning; return }
|
default { "Expected START, BRB, END or LIVE scene" | Write-Warning; return }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user