3 Commits

Author SHA1 Message Date
a40adf27be readme, changelog updated 2023-08-16 03:05:06 +01:00
1397c14522 debug statements added to getters and setters
made some rearrangements to the dot sourcing

ButtonTypes enum added to macrobuttons.ps1

login string now includes version number

Test-RegistryValue added to inst.ps1
2023-08-16 02:52:12 +01:00
ff1bd5e6cc section 3.1.0 added to CHANGELOG
close #4
2023-08-15 15:44:14 +01:00
12 changed files with 179 additions and 137 deletions

View File

@@ -9,8 +9,16 @@ 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
- [x] Level methods for Strip,Bus classes implemented.
- [x] More Recorder commands implemented.
- [x] Debug statements added to Getters, Setters in higher classes.
## [3.1.0]
### Added
- Level methods for Strip class implemented. See Strip.levels section in README.
- Level methods for Bus class implemented. See Bus.levels section in README.
- More Recorder commands implemented. See Recorder section in README.
- RunMacrobuttons, CloseMacrobuttons added to Special class
## [3.0.0]

View File

@@ -115,13 +115,13 @@ $vmr.Logout()
The following strip commands are available:
- mute: boolean
- mono: boolean
- mc: boolean
- mute: bool
- mono: bool
- mc: bool
- k: int, from 0 to 4
- solo: boolean
- A1-A5: boolean
- B1-B3: boolean
- solo: bool
- A1-A5: bool
- B1-B3: bool
- limit: int, from -40 to 12
- gain: float, from -60.0 to 12.0
- label: string
@@ -135,10 +135,10 @@ The following strip commands are available:
- color_y: float, from 0.0 to 1.0
- fx_x: float, from -0.5 to 0.5
- fx_y: float, from 0.0 to 1.0
- postreverb: boolean
- postdelay: boolean
- postfx1: boolean
- postfx2: boolean
- postreverb: bool
- postdelay: bool
- postfx1: bool
- postfx2: bool
- gainlayer0-gainlayer7: float
for example:
@@ -165,7 +165,7 @@ The following strip.comp commands are available:
- release: float, from 0.0 to 5000.0
- knee: float, 0.0 to 1.0
- gainout: float, from -24.0 to 24.0
- makeup: boolean
- makeup: bool
for example:
@@ -206,7 +206,7 @@ $vmr.strip[3].denoiser.knob = 5
#### AppGain | AppMute
- `AppGain(amount, gain)` : string, float
- `AppMute(amount, mutestate)` : string, boolean
- `AppMute(amount, mutestate)` : string, bool
for example:
@@ -253,18 +253,18 @@ $vmr.bus[3].returnreverb = 5.7
The following bus.mode members are available:
- normal: boolean
- amix: boolean
- bmix: boolean
- repeat: boolean
- composite: boolean
- tvmix: boolean
- upmix21: boolean
- upmix41: boolean
- upmix61: boolean
- centeronly: boolean
- lfeonly: boolean
- rearonly: boolean
- normal: bool
- amix: bool
- bmix: bool
- repeat: bool
- composite: bool
- tvmix: bool
- upmix21: bool
- upmix41: bool
- upmix61: bool
- centeronly: bool
- lfeonly: bool
- rearonly: bool
The following bus.mode commands are available:
@@ -317,8 +317,8 @@ wdm, ks, mme, asio are defined as write only.
The following strip.eq | bus.eq commands are available:
- on: boolean
- ab: boolean
- on: bool
- ab: bool
for example:
@@ -359,19 +359,19 @@ $vmr.button[5].trigger = $true
### VBAN
- vmr.vban.enable: Toggle VBAN on or off. Accepts a boolean value.
- vmr.vban.enable: Toggle VBAN on or off. Accepts a bool value.
For each vban in/out stream the following parameters are defined:
- on: boolean
- on: bool
- name: string
- ip: string
- port: int from 1024 - 65535
- sr: int (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
- port: int, from 1024 - 65535
- sr: in, (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
- channel: int from 1 to 8
- bit: int 16 or 24
- quality: int from 0 to 4
- route: int from 0 to 8
- bit: int, 16 or 24
- quality: int, from 0 to 4
- route: int, from 0 to 8
SR, channel and bit are defined as readonly for instreams. Attempting to write
to those parameters will throw an error. They are read and write for outstreams.
@@ -396,8 +396,8 @@ The following commands are available:
- hide
- restart
- shutdown
- showvbanchat: boolean (write only)
- lock: boolean (write only)
- showvbanchat: bool, (write only)
- lock: bool, (write only)
The following methods are available:
@@ -423,12 +423,12 @@ The following commands are available:
- record
- ff
- rew
- A1 - A5: boolean
- B1 - B3: boolean
- samplerate: int (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
- bitresolution: int (8, 16, 24, 32)
- channel: int from 1 to 8
- kbps: int (32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320)
- A1 - A5: bool
- B1 - B3: bool
- samplerate: int, (22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000)
- bitresolution: int, (8, 16, 24, 32)
- channel: int, from 1 to 8
- kbps: int, (32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320)
The following methods are available:
@@ -464,7 +464,7 @@ $vmr.recorder.mode.loop = $true
The following method is available:
- Set($val): boolean
- Set($val): bool
example:

View File

@@ -1,14 +1,22 @@
. $PSScriptRoot\kinds.ps1
. $PSScriptRoot\errors.ps1
. $PSScriptRoot\meta.ps1
. $PSScriptRoot\base.ps1
. $PSScriptRoot\kinds.ps1
. $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1
. $PSScriptRoot\vban.ps1
. $PSScriptRoot\command.ps1
. $PSScriptRoot\recorder.ps1
. $PSScriptRoot\profiles.ps1
class Remote {
[String]$vmpath
[Hashtable]$kind
[Object]$profiles
Remote ([String]$kindId) {
if (!(Setup_DLL)) {
Exit -1
}
$this.vmpath = Setup_DLL
$this.kind = GetKind($kindId)
$this.profiles = Get_Profiles($this.kind.name)
}
@@ -31,7 +39,7 @@ class Remote {
}
[String] GetVersion() {
return Version
return VmVersion
}
[void] Set_Profile([String]$config) {
@@ -147,6 +155,12 @@ Function Connect-Voicemeeter {
Write-Warning $_.Exception.ErrorMessage()
throw
}
catch [VMRemoteError] {
$_.Exception.ErrorMessage() | Write-Warning
if ($_.Exception.ErrorMessage() -eq "Couldn't get Voicemeeter path") {
Exit -1
}
}
}
Function Disconnect-Voicemeeter {

View File

@@ -1,13 +1,5 @@
. $PSScriptRoot\errors.ps1
. $PSScriptRoot\binding.ps1
. $PSScriptRoot\profiles.ps1
. $PSScriptRoot\inst.ps1
. $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1
. $PSScriptRoot\vban.ps1
. $PSScriptRoot\command.ps1
. $PSScriptRoot\recorder.ps1
function Login {
param(
@@ -15,46 +7,46 @@ function Login {
)
try {
$retval = [int][Voicemeeter.Remote]::VBVMR_Login()
if (-not $retval) {
"LOGGED IN" | Write-Verbose
}
elseif ($retval -eq 1) {
"VM NOT RUNNING" | Write-Verbose
New-Variable -Name vmExe -Value 0
if ($retval -ne 0) {
switch ($retval) {
1 {
New-Variable -Name vmExe -Value 0
if ( $kindId -eq "basic" ) { $vmExe = 1 }
elseif ( $kindId -eq "banana" ) { $vmExe = 2 }
elseif ( $kindId -eq "potato" ) {
$vmExe = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
}
if ( $kindId -eq "basic" ) { $vmExe = 1 }
elseif ( $kindId -eq "banana" ) { $vmExe = 2 }
elseif ( $kindId -eq "potato" ) {
$vmExe = $(if ([Environment]::Is64BitOperatingSystem) { 6 } else { 3 })
}
$retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$vmExe)
if (-not $retval) {
"STARTING VOICEMEETER" | Write-Verbose
Start-Sleep -s 1
$retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$vmExe)
if (-not $retval) {
"Voicemeeter Engine running but GUI not launched. Launching GUI now." | Write-Verbose
Start-Sleep -s 1
}
else {
throw [CAPIError]::new($retval, $MyInvocation.MyCommand)
}
}
-2 {
throw [LoginError]::new('Login may only be called once per session')
}
default { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
else {
throw [CAPIError]::new($retval, $MyInvocation.MyCommand)
}
}
elseif ($retval -eq -2) {
throw [LoginError]::new('login may only be called once per session')
}
else { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }
}
}
catch [LoginError] {
Write-Warning "$($_.Exception.ErrorMessage()). Fatal error, exiting..."
"$($_.Exception.ErrorMessage()). Fatal error, exiting..." | Write-Warning
exit -2
}
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 }
"VERSION:[" + $(VmType).ToUpper() + "]" | Write-Verbose
"Successfully logged into Voicemeeter [" + $(VmType).ToUpper() + "] Version " + $(VmVersion) | Write-Verbose
}
function Logout {
Start-Sleep -m 20
$retval = [int][Voicemeeter.Remote]::VBVMR_Logout()
if (-not $retval) { "LOGGED OUT" | Write-Verbose }
if ($retval -eq 0) { "Sucessfully logged out" | Write-Verbose }
}
function P_Dirty {
@@ -76,7 +68,7 @@ function VmType {
}
}
function Version {
function VmVersion {
New-Variable -Name ptr -Value 0
$retval = [int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterVersion([ref]$ptr)
if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }

View File

@@ -1,18 +1,11 @@
function Setup_DLL {
try {
$vb_path = Get_VMPath
. $PSScriptRoot\inst.ps1
if ([string]::IsNullOrWhiteSpace($vb_path)) {
throw [VMRemoteError]::new("couldn't get Voicemeeter path")
}
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + `
".dll")
}
catch [VMRemoteError] {
Write-Warning $_.Exception.ErrorMessage()
return $false
}
function Setup_DLL {
$VMPATH = Get_VMPath
$dll = Join-Path -Path $VMPATH -ChildPath ("VoicemeeterRemote" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + `
".dll")
$Signature = @"
[DllImport(@"$dll")]
@@ -53,5 +46,5 @@ function Setup_DLL {
"@
Add-Type -MemberDefinition $Signature -Name Remote -Namespace Voicemeeter -PassThru | Out-Null
return $true
return $VMPATH
}

View File

@@ -1,5 +1,3 @@
. $PSScriptRoot\meta.ps1
class IBus {
[int]$index
[Object]$remote
@@ -13,20 +11,26 @@ class IBus {
return "Bus[" + $this.index + "]"
}
[string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($param) {
return $this.remote.Getter("$($this.identifier()).$param")
$this.ToString() + " Getter: $($this.Cmd($param))" | Write-Debug
return $this.remote.Getter($this.Cmd($param))
}
[string] Getter_String ($param) {
return $this.remote.Getter_String("$($this.identifier()).$param")
$this.ToString() + " Getter_String: $($this.Cmd($param))" | Write-Debug
return $this.remote.Getter_String($this.Cmd($param))
}
[void] Setter ($param, $val) {
$this.remote.Setter("$($this.identifier()).$param", $val)
$this.ToString() + " Setter: $($this.Cmd($param))=$val" | Write-Debug
$this.remote.Setter($this.Cmd($param), $val)
}
[string] Cmd ($param) {
if ([string]::IsNullOrEmpty($param)) {
return $this.identifier()
}
return "$($this.identifier()).$param"
}
}
@@ -45,6 +49,10 @@ class Bus : IBus {
$this.levels = [BusLevels]::new($index, $remote)
}
[string] ToString() {
return $this.GetType().Name + $this.index
}
[void] FadeTo ([single]$target, [int]$time) {
$this.Setter('FadeTo', "($target, $time)")
}

View File

@@ -1,6 +1,3 @@
. $PSScriptRoot\meta.ps1
. $PSScriptRoot\inst.ps1
class Special {
[Object]$remote
@@ -32,10 +29,12 @@ class Special {
}
[void] RunMacrobuttons() {
Start-Process -FilePath $(Join-Path -Path $(Get_VMPath) -ChildPath "VoicemeeterMacroButtons.exe")
"Launching the MacroButtons app" | Write-Verbose
Start-Process -FilePath $(Join-Path -Path $this.remote.vmpath -ChildPath "VoicemeeterMacroButtons.exe")
}
[void] CloseMacrobuttons() {
"Closing the MacroButtons app" | Write-Verbose
Stop-Process -Name "VoicemeeterMacroButtons"
}

View File

@@ -1,8 +1,13 @@
function Get_VMPath {
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + `
$REG_KEY = "Registry::HKEY_LOCAL_MACHINE\Software" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall"
$vm_key = "\VB:Voicemeeter {17359A74-1236-5467}\"
$VM_KEY = "\VB:Voicemeeter {17359A74-1236-5467}\"
return $(Get-ItemPropertyValue -Path ($reg_path + $vm_key) -Name UninstallString | Split-Path -Parent)
try {
return $(Get-ItemPropertyValue -Path ($REG_KEY + $VM_KEY) -Name UninstallString | Split-Path -Parent)
}
catch {
throw [VMRemoteError]::new("Couldn't get Voicemeeter path")
}
}

View File

@@ -1,3 +1,9 @@
enum ButtonTypes {
State = 1
StateOnly = 2
Trigger = 3
}
class MacroButton {
[int32]$index
@@ -10,40 +16,42 @@ class MacroButton {
}
[int] Getter ($mode) {
"Button[$($this.index)].$([ButtonTypes].GetEnumName($mode))" | Write-Debug
return MB_Get -Id $this.index -Mode $mode
}
[void] Setter ($set, $mode) {
MB_Set -Id $this.index -SET $set -Mode $mode
[void] Setter ($val, $mode) {
"Button[$($this.index)].$([ButtonTypes].GetEnumName($mode))=$val" | Write-Debug
MB_Set -Id $this.index -SET $val -Mode $mode
}
hidden $_state = $($this | Add-Member ScriptProperty 'state' `
{
[bool]$this.Getter(1)
[bool]$this.Getter([ButtonTypes]::State)
} `
{
param($arg)
$this._state = $this.Setter($arg, 1)
$this._state = $this.Setter($arg, [ButtonTypes]::State)
}
)
hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' `
{
[bool]$this.Getter(2)
[bool]$this.Getter([ButtonTypes]::StateOnly)
} `
{
param($arg)
$this._stateonly = $this.Setter($arg, 2)
$this._stateonly = $this.Setter($arg, [ButtonTypes]::StateOnly)
}
)
hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' `
{
[bool]$this.Getter(3)
[bool]$this.Getter([ButtonTypes]::Trigger)
} `
{
param($arg)
$this._trigger = $this.Setter($arg, 3)
$this._trigger = $this.Setter($arg, [ButtonTypes]::Trigger)
}
)
}

View File

@@ -1,5 +1,3 @@
. $PSScriptRoot\meta.ps1
class IRecorder {
[Object]$remote

View File

@@ -1,5 +1,3 @@
. $PSScriptRoot\meta.ps1
class IStrip {
[int]$index
[Object]$remote
@@ -14,15 +12,25 @@ class IStrip {
}
[single] Getter ($param) {
return $this.remote.Getter("$($this.identifier()).$param")
$this.Cmd($param) | Write-Debug
return $this.remote.Getter($this.Cmd($param))
}
[string] Getter_String ($param) {
return $this.remote.Getter_String("$($this.identifier()).$param")
$this.Cmd($param) | Write-Debug
return $this.remote.Getter_String($this.Cmd($param))
}
[void] Setter ($param, $val) {
$this.remote.Setter("$($this.identifier()).$param", $val)
"$($this.Cmd($param))=$val" | Write-Debug
$this.remote.Setter($this.Cmd($param), $val)
}
[string] Cmd ($param) {
if ([string]::IsNullOrEmpty($param)) {
return $this.identifier()
}
return "$($this.identifier()).$param"
}
}

View File

@@ -13,20 +13,25 @@ class IVban {
return "vban." + $this.direction + "stream[" + $this.index + "]"
}
[string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($param) {
return $this.remote.Getter("$($this.identifier()).$param")
return $this.remote.Getter($this.Cmd($param))
}
[string] Getter_String ($param) {
return $this.remote.Getter_String("$($this.identifier()).$param")
$this.Cmd($param) | Write-Debug
return $this.remote.Getter_String($this.Cmd($param))
}
[void] Setter ($param, $val) {
$this.remote.Setter("$($this.identifier()).$param", $val)
"$($this.Cmd($param))=$val" | Write-Debug
$this.remote.Setter($this.Cmd($param), $val)
}
[string] Cmd ($param) {
if ([string]::IsNullOrEmpty($param)) {
return $this.identifier()
}
return "$($this.identifier()).$param"
}
}
@@ -34,6 +39,10 @@ class Vban : IVban {
Vban ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
}
[string] ToString() {
return $this.GetType().Name + $this.index
}
hidden $_on = $($this | Add-Member ScriptProperty 'on' `
{
$this.Getter('on')