mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-20 14:33:32 +00:00
Compare commits
12 Commits
add-more-l
...
0cdd71600f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cdd71600f | |||
| 41529c0d58 | |||
| b1a6ac68c1 | |||
| fbfab5b4aa | |||
| 4d371a7582 | |||
| 15b3b375bd | |||
| c8abc6964a | |||
| 907ee3e63b | |||
| f3ed9c28c7 | |||
| d305a4048d | |||
| 108731b4cf | |||
| e7c648f1d0 |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -9,7 +9,19 @@ Before any major/minor/patch is released all test units will be run to verify th
|
|||||||
|
|
||||||
## [Unreleased] These changes have not been added to PSGallery yet
|
## [Unreleased] These changes have not been added to PSGallery yet
|
||||||
|
|
||||||
## [3.2.0]
|
- [ ]
|
||||||
|
|
||||||
|
## [3.3.0] - 2024-06-29
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add a timeout (2s) to the login function. If timeout exceeded a VMRemoteError is thrown.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Launch x64 bit GUIs for all kinds if on 64 bit system.
|
||||||
|
|
||||||
|
## [3.2.0] - 2023-08-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
@@ -21,10 +33,10 @@ Before any major/minor/patch is released all test units will be run to verify th
|
|||||||
|
|
||||||
- All CAPIErrors are now exposed to the consumer.
|
- All CAPIErrors are now exposed to the consumer.
|
||||||
- The function name and error code can be retrieved using [CAPIError].function and [CAPIError].code
|
- The function name and error code can be retrieved using [CAPIError].function and [CAPIError].code
|
||||||
- Set_By_Script now throws [VMError] if script length exceeds 48kB.
|
- Set_By_Script now throws [VMRemoteError] if script length exceeds 48kB.
|
||||||
- parameter range checks in Vban class.
|
- parameter range checks in Vban class.
|
||||||
|
|
||||||
## [3.1.0]
|
## [3.1.0] - 2023-08-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
@@ -33,7 +45,7 @@ Before any major/minor/patch is released all test units will be run to verify th
|
|||||||
- More Recorder commands implemented. See Recorder section in README.
|
- More Recorder commands implemented. See Recorder section in README.
|
||||||
- RunMacrobuttons, CloseMacrobuttons added to Special class
|
- RunMacrobuttons, CloseMacrobuttons added to Special class
|
||||||
|
|
||||||
## [3.0.0]
|
## [3.0.0] - 2023-08-09
|
||||||
|
|
||||||
v3 introduces some breaking changes. They are as follows:
|
v3 introduces some breaking changes. They are as follows:
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -8,9 +8,9 @@ For past/future changes to this project refer to: [CHANGELOG](CHANGELOG.md)
|
|||||||
|
|
||||||
## Tested against
|
## Tested against
|
||||||
|
|
||||||
- Basic 1.0.8.8
|
- Basic 1.1.1.1
|
||||||
- Banana 2.0.6.8
|
- Banana 2.1.1.1
|
||||||
- Potato 3.0.2.8
|
- Potato 3.1.1.1
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -402,6 +402,8 @@ The following commands are available:
|
|||||||
The following methods are available:
|
The following methods are available:
|
||||||
|
|
||||||
- Load($filepath): string
|
- Load($filepath): string
|
||||||
|
- RunMacrobuttons(): Launches the macrobuttons app
|
||||||
|
- CloseMacrobuttons(): Closes the macrobuttons app
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
@@ -411,6 +413,8 @@ $vmr.command.show
|
|||||||
$vmr.command.lock = $true
|
$vmr.command.lock = $true
|
||||||
|
|
||||||
$vmr.command.Load("path/to/filename.xml")
|
$vmr.command.Load("path/to/filename.xml")
|
||||||
|
|
||||||
|
$vmr.command.RunMacrobuttons()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Recorder
|
### Recorder
|
||||||
@@ -566,4 +570,4 @@ Run tests from repository root in a subshell and write logs, like so:
|
|||||||
|
|
||||||
### Official Documentation
|
### Official Documentation
|
||||||
|
|
||||||
- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/update-docs/VoicemeeterRemoteAPI.pdf)
|
- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf)
|
||||||
|
|||||||
79
examples/streamdeck/README.md
Normal file
79
examples/streamdeck/README.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# About
|
||||||
|
|
||||||
|
Thanks to the guys at [Start Automating](https://startautomating.com/) it's possible to use this module straight from your Stream Deck.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- [Windows ScriptDeck](https://marketplace.elgato.com/product/windows-scriptdeck-857f01dd-8fd4-44d5-8ec7-67ac850b21d3)
|
||||||
|
|
||||||
|
This Voicemeeter Powershell Wrapper will need to be installed as a Module, see [Installation](https://github.com/onyx-and-iris/voicemeeter-api-powershell?tab=readme-ov-file#installation)
|
||||||
|
|
||||||
|
## How
|
||||||
|
|
||||||
|
Once ScriptDeck is installed create a button using *Powershell Script*, then:
|
||||||
|
|
||||||
|
### On one button
|
||||||
|
|
||||||
|
Due to the design of Voicemeeter's API you may only login/logout once per session so in order to program multiple buttons you must do the following for just ONE button (it can be any button).
|
||||||
|
|
||||||
|
#### Button 1
|
||||||
|
|
||||||
|
*When Loaded*
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$global:vmr = Connect-Voicemeeter -Kind "banana"
|
||||||
|
```
|
||||||
|
|
||||||
|
*When Unloaded*
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Disconnect-Voicemeeter
|
||||||
|
```
|
||||||
|
|
||||||
|
*When Pressed*
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
if ($vmr.strip[0].mute) {
|
||||||
|
$vmr.bus[0].mute=1
|
||||||
|
$vmr.bus[1].mute=1
|
||||||
|
} else {
|
||||||
|
$vmr.bus[0].mute=0
|
||||||
|
$vmr.bus[1].mute=0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Other buttons
|
||||||
|
|
||||||
|
Then your other buttons can have any scripts using the `$vmr` object:
|
||||||
|
|
||||||
|
#### Button 2
|
||||||
|
|
||||||
|
*When Pressed*
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$vmr.strip[1].mute=1
|
||||||
|
$vmr.strip[2].mute=1
|
||||||
|
|
||||||
|
if (-not $vmr.strip[0].mute) {
|
||||||
|
$vmr.strip[0].mute=1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Button 3
|
||||||
|
|
||||||
|
*When Pressed*
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$vmr.strip[1].mute=0
|
||||||
|
$vmr.strip[2].mute=0
|
||||||
|
|
||||||
|
if ($vmr.strip[0].mute) {
|
||||||
|
$vmr.strip[0].mute=0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Then let's say you have zillions of buttons you want to program, for each Stream Deck window configure ONE button as described above and the other buttons of the same window as described above.
|
||||||
|
|
||||||
|
If this explanation is unclear or you'd like me to add some screenshots just ask.
|
||||||
34
lib/base.ps1
34
lib/base.ps1
@@ -20,8 +20,27 @@ function Login {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$timeout = New-TimeSpan -Seconds 2
|
||||||
|
$sw = [diagnostics.stopwatch]::StartNew()
|
||||||
|
$exception = $null
|
||||||
|
do {
|
||||||
|
Start-Sleep -m 100
|
||||||
|
try {
|
||||||
|
"Successfully logged into Voicemeeter [" + $(VmType).ToUpper() + "] Version " + $(VmVersion) | Write-Verbose
|
||||||
|
$exception = $null
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch [CAPIError] {
|
||||||
|
$exception = $_
|
||||||
|
$exception | Write-Debug
|
||||||
|
}
|
||||||
|
} while ($sw.elapsed -lt $timeout)
|
||||||
|
|
||||||
|
if ($null -ne $exception) {
|
||||||
|
throw [VMRemoteError]::new("Timeout logging into the API.")
|
||||||
|
}
|
||||||
|
|
||||||
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
|
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
|
||||||
"Successfully logged into Voicemeeter [" + $(VmType).ToUpper() + "] Version " + $(VmVersion) | Write-Verbose
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Logout {
|
function Logout {
|
||||||
@@ -38,8 +57,8 @@ function RunVoicemeeter {
|
|||||||
[string]$kindId
|
[string]$kindId
|
||||||
)
|
)
|
||||||
$kinds = @{
|
$kinds = @{
|
||||||
"basic" = 1
|
"basic" = $(if ([Environment]::Is64BitOperatingSystem) { 4 } else { 1 })
|
||||||
"banana" = 2
|
"banana" = $(if ([Environment]::Is64BitOperatingSystem) { 5 } else { 2 })
|
||||||
"potato" = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
|
"potato" = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,13 +66,12 @@ function RunVoicemeeter {
|
|||||||
if ($retval -notin @(0)) {
|
if ($retval -notin @(0)) {
|
||||||
throw [CAPIError]::new($retval, "VBVMR_RunVoicemeeter")
|
throw [CAPIError]::new($retval, "VBVMR_RunVoicemeeter")
|
||||||
}
|
}
|
||||||
Start-Sleep -s 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function P_Dirty {
|
function P_Dirty {
|
||||||
$retval = [Voicemeeter.Remote]::VBVMR_IsParametersDirty()
|
$retval = [Voicemeeter.Remote]::VBVMR_IsParametersDirty()
|
||||||
if ($retval -notin @(0, 1)) {
|
if ($retval -notin @(0, 1)) {
|
||||||
throw [CAPIError]::new($retval, "VBVMR_RunVoicemeeter")
|
throw [CAPIError]::new($retval, "VBVMR_IsParametersDirty")
|
||||||
}
|
}
|
||||||
[bool]$retval
|
[bool]$retval
|
||||||
}
|
}
|
||||||
@@ -61,7 +79,7 @@ function P_Dirty {
|
|||||||
function M_Dirty {
|
function M_Dirty {
|
||||||
$retval = [Voicemeeter.Remote]::VBVMR_MacroButton_IsDirty()
|
$retval = [Voicemeeter.Remote]::VBVMR_MacroButton_IsDirty()
|
||||||
if ($retval -notin @(0, 1)) {
|
if ($retval -notin @(0, 1)) {
|
||||||
throw [CAPIError]::new($retval, "VBVMR_RunVoicemeeter")
|
throw [CAPIError]::new($retval, "VBVMR_MacroButton_IsDirty")
|
||||||
}
|
}
|
||||||
[bool]$retval
|
[bool]$retval
|
||||||
}
|
}
|
||||||
@@ -156,7 +174,7 @@ function MB_Get {
|
|||||||
New-Variable -Name ptr -Value 0.0
|
New-Variable -Name ptr -Value 0.0
|
||||||
$retval = [int][Voicemeeter.Remote]::VBVMR_MacroButton_GetStatus($ID, [ref]$ptr, $MODE)
|
$retval = [int][Voicemeeter.Remote]::VBVMR_MacroButton_GetStatus($ID, [ref]$ptr, $MODE)
|
||||||
if ($retval -notin @(0)) {
|
if ($retval -notin @(0)) {
|
||||||
throw [CAPIError]::new($retval, $MyInvocation.MyCommand)
|
throw [CAPIError]::new($retval, "VBVMR_MacroButton_GetStatus")
|
||||||
}
|
}
|
||||||
[int]$ptr
|
[int]$ptr
|
||||||
}
|
}
|
||||||
@@ -189,7 +207,7 @@ function Set_By_Script {
|
|||||||
[string]$script
|
[string]$script
|
||||||
)
|
)
|
||||||
if ($script.Length -gt 48000) {
|
if ($script.Length -gt 48000) {
|
||||||
throw [VMError]::new("Script size cannot be larger than 48kB")
|
throw [VMRemoteError]::new("Script size cannot be larger than 48kB")
|
||||||
}
|
}
|
||||||
$retval = [int][Voicemeeter.Remote]::VBVMR_SetParameters($script)
|
$retval = [int][Voicemeeter.Remote]::VBVMR_SetParameters($script)
|
||||||
if ($retval -notin @(0)) {
|
if ($retval -notin @(0)) {
|
||||||
|
|||||||
16
lib/inst.ps1
16
lib/inst.ps1
@@ -1,11 +1,17 @@
|
|||||||
function Get_VMPath {
|
function Get_VMPath {
|
||||||
$REG_KEY = "Registry::HKEY_LOCAL_MACHINE\Software" + `
|
$REG_KEY = @(
|
||||||
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
|
"Registry::HKEY_LOCAL_MACHINE",
|
||||||
"\Microsoft\Windows\CurrentVersion\Uninstall"
|
"Software",
|
||||||
$VM_KEY = "\VB:Voicemeeter {17359A74-1236-5467}\"
|
(& { if ([Environment]::Is64BitOperatingSystem) { "WOW6432Node" } else { "" } }),
|
||||||
|
"Microsoft",
|
||||||
|
"Windows",
|
||||||
|
"CurrentVersion",
|
||||||
|
"Uninstall"
|
||||||
|
).Where({ $_ -ne "" }) -Join "\"
|
||||||
|
$VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $(Get-ItemPropertyValue -Path ($REG_KEY + $VM_KEY) -Name UninstallString | Split-Path -Parent)
|
return $(Get-ItemPropertyValue -Path (@($REG_KEY, $VM_KEY) -Join "\") -Name UninstallString | Split-Path -Parent)
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throw [VMRemoteError]::new("Unable to fetch Voicemeeter path from the Registry.")
|
throw [VMRemoteError]::new("Unable to fetch Voicemeeter path from the Registry.")
|
||||||
|
|||||||
Reference in New Issue
Block a user