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 ## [Unreleased] These changes have not been added to PSGallery yet
- [x] Level methods for Strip,Bus classes implemented. - [x] Debug statements added to Getters, Setters in higher classes.
- [x] More Recorder commands implemented.
## [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] ## [3.0.0]

View File

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

View File

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

View File

@@ -1,13 +1,5 @@
. $PSScriptRoot\errors.ps1 . $PSScriptRoot\errors.ps1
. $PSScriptRoot\binding.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 { function Login {
param( param(
@@ -15,11 +7,9 @@ function Login {
) )
try { try {
$retval = [int][Voicemeeter.Remote]::VBVMR_Login() $retval = [int][Voicemeeter.Remote]::VBVMR_Login()
if (-not $retval) { if ($retval -ne 0) {
"LOGGED IN" | Write-Verbose switch ($retval) {
} 1 {
elseif ($retval -eq 1) {
"VM NOT RUNNING" | Write-Verbose
New-Variable -Name vmExe -Value 0 New-Variable -Name vmExe -Value 0
if ( $kindId -eq "basic" ) { $vmExe = 1 } if ( $kindId -eq "basic" ) { $vmExe = 1 }
@@ -30,31 +20,33 @@ function Login {
$retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$vmExe) $retval = [int][Voicemeeter.Remote]::VBVMR_RunVoicemeeter([int64]$vmExe)
if (-not $retval) { if (-not $retval) {
"STARTING VOICEMEETER" | Write-Verbose "Voicemeeter Engine running but GUI not launched. Launching GUI now." | Write-Verbose
Start-Sleep -s 1 Start-Sleep -s 1
} }
else { else {
throw [CAPIError]::new($retval, $MyInvocation.MyCommand) throw [CAPIError]::new($retval, $MyInvocation.MyCommand)
} }
} }
elseif ($retval -eq -2) { -2 {
throw [LoginError]::new('login may only be called once per session') 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) }
} }
catch [LoginError] { catch [LoginError] {
Write-Warning "$($_.Exception.ErrorMessage()). Fatal error, exiting..." "$($_.Exception.ErrorMessage()). Fatal error, exiting..." | Write-Warning
exit -2 exit -2
} }
while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 } 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 { function Logout {
Start-Sleep -m 20 Start-Sleep -m 20
$retval = [int][Voicemeeter.Remote]::VBVMR_Logout() $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 { function P_Dirty {
@@ -76,7 +68,7 @@ function VmType {
} }
} }
function Version { function VmVersion {
New-Variable -Name ptr -Value 0 New-Variable -Name ptr -Value 0
$retval = [int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterVersion([ref]$ptr) $retval = [int][Voicemeeter.Remote]::VBVMR_GetVoicemeeterVersion([ref]$ptr)
if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) } if ($retval) { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) }

View File

@@ -1,18 +1,11 @@
function Setup_DLL { . $PSScriptRoot\inst.ps1
try {
$vb_path = Get_VMPath
if ([string]::IsNullOrWhiteSpace($vb_path)) { function Setup_DLL {
throw [VMRemoteError]::new("couldn't get Voicemeeter path") $VMPATH = Get_VMPath
}
$dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + ` $dll = Join-Path -Path $VMPATH -ChildPath ("VoicemeeterRemote" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + ` (& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + `
".dll") ".dll")
}
catch [VMRemoteError] {
Write-Warning $_.Exception.ErrorMessage()
return $false
}
$Signature = @" $Signature = @"
[DllImport(@"$dll")] [DllImport(@"$dll")]
@@ -53,5 +46,5 @@ function Setup_DLL {
"@ "@
Add-Type -MemberDefinition $Signature -Name Remote -Namespace Voicemeeter -PassThru | Out-Null 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 { class IBus {
[int]$index [int]$index
[Object]$remote [Object]$remote
@@ -13,20 +11,26 @@ class IBus {
return "Bus[" + $this.index + "]" return "Bus[" + $this.index + "]"
} }
[string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($param) { [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) { [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) { [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) $this.levels = [BusLevels]::new($index, $remote)
} }
[string] ToString() {
return $this.GetType().Name + $this.index
}
[void] FadeTo ([single]$target, [int]$time) { [void] FadeTo ([single]$target, [int]$time) {
$this.Setter('FadeTo', "($target, $time)") $this.Setter('FadeTo', "($target, $time)")
} }

View File

@@ -1,6 +1,3 @@
. $PSScriptRoot\meta.ps1
. $PSScriptRoot\inst.ps1
class Special { class Special {
[Object]$remote [Object]$remote
@@ -32,10 +29,12 @@ class Special {
} }
[void] RunMacrobuttons() { [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() { [void] CloseMacrobuttons() {
"Closing the MacroButtons app" | Write-Verbose
Stop-Process -Name "VoicemeeterMacroButtons" Stop-Process -Name "VoicemeeterMacroButtons"
} }

View File

@@ -1,8 +1,13 @@
function Get_VMPath { function Get_VMPath {
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + ` $REG_KEY = "Registry::HKEY_LOCAL_MACHINE\Software" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + ` (& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall" "\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 { class MacroButton {
[int32]$index [int32]$index
@@ -10,40 +16,42 @@ class MacroButton {
} }
[int] Getter ($mode) { [int] Getter ($mode) {
"Button[$($this.index)].$([ButtonTypes].GetEnumName($mode))" | Write-Debug
return MB_Get -Id $this.index -Mode $mode return MB_Get -Id $this.index -Mode $mode
} }
[void] Setter ($set, $mode) { [void] Setter ($val, $mode) {
MB_Set -Id $this.index -SET $set -Mode $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' ` hidden $_state = $($this | Add-Member ScriptProperty 'state' `
{ {
[bool]$this.Getter(1) [bool]$this.Getter([ButtonTypes]::State)
} ` } `
{ {
param($arg) param($arg)
$this._state = $this.Setter($arg, 1) $this._state = $this.Setter($arg, [ButtonTypes]::State)
} }
) )
hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' ` hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' `
{ {
[bool]$this.Getter(2) [bool]$this.Getter([ButtonTypes]::StateOnly)
} ` } `
{ {
param($arg) param($arg)
$this._stateonly = $this.Setter($arg, 2) $this._stateonly = $this.Setter($arg, [ButtonTypes]::StateOnly)
} }
) )
hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' ` hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' `
{ {
[bool]$this.Getter(3) [bool]$this.Getter([ButtonTypes]::Trigger)
} ` } `
{ {
param($arg) 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 { class IRecorder {
[Object]$remote [Object]$remote

View File

@@ -1,5 +1,3 @@
. $PSScriptRoot\meta.ps1
class IStrip { class IStrip {
[int]$index [int]$index
[Object]$remote [Object]$remote
@@ -14,15 +12,25 @@ class IStrip {
} }
[single] Getter ($param) { [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) { [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) { [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 + "]" return "vban." + $this.direction + "stream[" + $this.index + "]"
} }
[string] ToString() {
return $this.GetType().Name + $this.index
}
[single] Getter ($param) { [single] Getter ($param) {
return $this.remote.Getter("$($this.identifier()).$param") return $this.remote.Getter($this.Cmd($param))
} }
[string] Getter_String ($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) { [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) { 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' ` hidden $_on = $($this | Add-Member ScriptProperty 'on' `
{ {
$this.Getter('on') $this.Getter('on')