A Powershell wrapper for the Voiceemeter API
Go to file
onyx-and-iris 94be34b3da added custom error classes
Added CAPI and Login custom error classes.

Cleaned up output when error is thrown.
2021-04-29 20:23:02 +01:00
lib added custom error classes 2021-04-29 20:23:02 +01:00
test auto login added, tests updated to take $true, $false 2021-04-29 00:48:16 +01:00
example.ps1 auto login added, tests updated to take $true, $false 2021-04-29 00:48:16 +01:00
LICENSE Initial commit 2021-04-28 17:16:09 +01:00
README.md Update README.md 2021-04-29 00:48:44 +01:00

Powershell Wrapper for Voicemeeter API

This wrapper was written in response to a request in the VB-AUDIO discord for a way to invoke commands using Powershell. It is designed to be simple to use but not every feature is added.

Tested against

  • Basic 1.0.7.8
  • Banana 2.0.5.8
  • Potato 3.0.1.8

You may have success with many commands in earlier versions but some commands (example Macrobuttons) were only added to the API in later releases.

Requirements

Use

When you instantiate Remote class you will automatically be logged in. Use a try finally block to ensure you logout at the end of your code.

. $PSScriptRoot\lib\voicemeeter.ps1

try {
    # pass a Voicemeeter type to class Remote
    $vmr = [Remote]::new('banana')

    # Set strip and bus params
    $vmr.strip[0].mono = $true
    $vmr.strip[0].mono  '=> $true'
    $vmr.bus[1].mute = $false
    $vmr.bus[1].mute    '=> $false'

    # Set macrobutton with id 4, mode state to 1
    $vmr.button[4].state = $true
    $vmr.button[4].state    '=> $true'
}
finally { $vmr.Logout() }

Voicemeeter type can be one of:

  • basic
  • banana
  • potato

There is no bounds checking in this wrapper, meaning if you attempt to set a parameter that does not exist for that version of Voicemeeter the wrapper will throw an error and crash. So make sure what you are settings actually exists.

Multiple parameters

Set many strip/bus parameters at once, for Example

. $PSScriptRoot\lib\voicemeeter.ps1
try {
    $hash = @{
        "Strip[0].Mute" = $true
        "Strip[1].Mute" = $true
        "Strip[2].Mute" = $false
        "Strip[0].Mono" = $true
        "Strip[1].Mono" = $false
        "Strip[2].Mono" = $true
    }

    Param_Set_Multi -HASH $hash
}
finally { $vmr.Logout() }

Macrobuttons

Three modes defined: state, stateonly and trigger.

  • State runs associated scripts
  • Stateonly does not run associated scripts
  • Index range (0, 69)
$vmr.button[3].state = $true

$vmr.button[4].stateonly = $false

$vmr.button[5].trigger = $true

Run tests

Run tests using invoke-pester in powershell console from test directory.

Alternatively you may use .\runall.ps1 which accepts two parameters:

  • tag Run tests of this type
  • num Run this number of tests

Current test types are 'higher' and 'lower'

Example: .\runall.ps1 -tag 'higher' -num 3