diff --git a/.vscode/launch.json b/.vscode/launch.json index 4ab1ee4..34f7679 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,7 +16,9 @@ "\"!strip[0].mute\",", "\"strip[0].mute\",", "\"bus[2].eq.on=1\",", - "\"command.lock=1\"" + "\"command.lock=1\"", + "-Verbose", + "-Debug" ], "createTemporaryIntegratedConsole": true }, @@ -26,7 +28,10 @@ "request": "launch", "cwd": "${workspaceRoot}/examples/nextbus", "script": "${workspaceFolder}/examples/nextbus/GoTo-NextBus.ps1", - "args": [], + "args": [ + "-Verbose", + "-Debug" + ], "createTemporaryIntegratedConsole": true }, { @@ -35,7 +40,10 @@ "request": "launch", "cwd": "${workspaceRoot}/examples/obs", "script": "${workspaceFolder}/examples/obs/Vm-Obs-Sync.ps1", - "args": [], + "args": [ + "-Verbose", + "-Debug" + ], "createTemporaryIntegratedConsole": true }, { diff --git a/examples/cli/CLI.ps1 b/examples/cli/CLI.ps1 index 8ff793d..f67fb83 100644 --- a/examples/cli/CLI.ps1 +++ b/examples/cli/CLI.ps1 @@ -1,14 +1,12 @@ +[cmdletbinding()] param( [switch]$interactive, - [switch]$output, [String]$kind = "banana", [String[]]$script = @() ) Import-Module ..\..\lib\Voicemeeter.psm1 -$VerbosePreference = "Continue" - function get-value { param([object]$vmr, [string]$line) try { @@ -24,16 +22,16 @@ function msgHandler { param([object]$vmr, [string]$line) $line + " passed to handler" | Write-Debug 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) $vmr.Setter($line.substring(1), 1 - $retval) } elseif ($line.Contains("=")) { - if ($output) { "Setting $line" | Write-Host } + "Setting $line" | Write-Debug $vmr.SendText($line) } else { - if ($output) { "Getting $line" | Write-Host } + "Getting $line" | Write-Debug $retval = get-value -vmr $vmr -line $line $line + " = " + $retval | Write-Host } diff --git a/examples/nextbus/GoTo-NextBus.ps1 b/examples/nextbus/GoTo-NextBus.ps1 index bd340ac..a6ebd3c 100644 --- a/examples/nextbus/GoTo-NextBus.ps1 +++ b/examples/nextbus/GoTo-NextBus.ps1 @@ -7,27 +7,30 @@ Credits go to @bobsupercow #> -Import-Module ..\..\lib\Voicemeeter.psm1 +[cmdletbinding()] +param() -$VerbosePreference = "Continue" +Import-Module ..\..\lib\Voicemeeter.psm1 try { $vmr = Connect-Voicemeeter -Kind "potato" $buses = @($vmr.bus[1], $vmr.bus[2], $vmr.bus[4], $vmr.bus[6]) + "Buses in selection: $($buses)" $unmutedIndex = $null # 1) + "Cycling through bus selection to check for first unmuted Bus..." | Write-Host foreach ($bus in $buses) { # 2) 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) $bus.mute = $true # 3) if ($buses[++$unmutedIndex]) { - "unmuting bus $($buses[$unmutedIndex].index)" | Write-Host + "Unmuting Bus $($buses[$unmutedIndex].index)" | Write-Host $buses[$unmutedIndex].mute = $false break } @@ -37,7 +40,7 @@ try { # 4) if ($null -eq $unmutedIndex) { $buses[0].mute = $false - "unmuting bus $($buses[0].index)" | Write-Host + "Unmuting Bus $($buses[0].index)" | Write-Host } } diff --git a/examples/obs/Vm-Obs-Sync.ps1 b/examples/obs/Vm-Obs-Sync.ps1 index 839045d..44d7f76 100644 --- a/examples/obs/Vm-Obs-Sync.ps1 +++ b/examples/obs/Vm-Obs-Sync.ps1 @@ -1,8 +1,9 @@ +[cmdletbinding()] +param() + Import-Module ..\..\lib\Voicemeeter.psm1 Import-Module obs-powershell -$VerbosePreference = "Continue" - function CurrentProgramSceneChanged { param([System.Object]$data) Write-Host "Switched to scene", $data.sceneName @@ -10,19 +11,15 @@ function CurrentProgramSceneChanged { switch ($data.sceneName) { "START" { $vmr.strip[0].mute = !$vmr.strip[0].mute - "Toggling Strip 0 mute" } "BRB" { $vmr.strip[0].gain = -8.3 - "Setting Strip 0 gain to -8.3" } "END" { $vmr.strip[0].mono = $true - "Setting Strip 0 mono to `$true" } "LIVE" { $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 } }