rename some of the internal classes

RecorderMode class added to Recorder

RunMacrobuttons() and CloseMacrobuttons() added to Special (Command)
This commit is contained in:
onyx-and-iris 2023-08-12 01:40:29 +01:00
parent 5bda43131b
commit bee52b6541
7 changed files with 79 additions and 49 deletions

View File

@ -1,6 +1,6 @@
function Setup_DLL { function Setup_DLL {
try { try {
$vb_path = Get_VBPath $vb_path = Get_VMPath
if ([string]::IsNullOrWhiteSpace($vb_path)) { if ([string]::IsNullOrWhiteSpace($vb_path)) {
throw [VMRemoteError]::new("couldn't get Voicemeeter path") throw [VMRemoteError]::new("couldn't get Voicemeeter path")

View File

@ -40,9 +40,9 @@ class Bus : IBus {
AddStringMembers -PARAMS @('label') AddStringMembers -PARAMS @('label')
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2') AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
$this.mode = [Mode]::new($index, $remote) $this.mode = [BusMode]::new($index, $remote)
$this.eq = [Eq]::new($index, $remote) $this.eq = [BusEq]::new($index, $remote)
$this.levels = [Levels]::new($index, $remote) $this.levels = [BusLevels]::new($index, $remote)
} }
[void] FadeTo ([single]$target, [int]$time) { [void] FadeTo ([single]$target, [int]$time) {
@ -54,11 +54,11 @@ class Bus : IBus {
} }
} }
class Levels : IBus { class BusLevels : IBus {
[int]$init [int]$init
[int]$offset [int]$offset
Levels ([int]$index, [Object]$remote) : base ($index, $remote) { BusLevels ([int]$index, [Object]$remote) : base ($index, $remote) {
$this.init = $index * 8 $this.init = $index * 8
$this.offset = 8 $this.offset = 8
} }
@ -68,7 +68,7 @@ class Levels : IBus {
return [math]::Round(20 * [math]::Log10($val), 1) return [math]::Round(20 * [math]::Log10($val), 1)
} }
else { else {
return -200.0 return - 200.0
} }
} }
@ -85,10 +85,10 @@ class Levels : IBus {
} }
} }
class Mode : IBus { class BusMode : IBus {
[System.Collections.ArrayList]$modes [System.Collections.ArrayList]$modes
Mode ([int]$index, [Object]$remote) : base ($index, $remote) { BusMode ([int]$index, [Object]$remote) : base ($index, $remote) {
$this.modes = @( $this.modes = @(
'normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21', 'upmix41', 'upmix61', 'normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21', 'upmix41', 'upmix61',
'centeronly', 'lfeonly', 'rearonly' 'centeronly', 'lfeonly', 'rearonly'
@ -111,8 +111,8 @@ class Mode : IBus {
} }
} }
class Eq : IBus { class BusEq : IBus {
Eq ([int]$index, [Object]$remote) : base ($index, $remote) { BusEq ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('on', 'ab') AddBoolMembers -PARAMS @('on', 'ab')
} }
@ -125,12 +125,12 @@ class PhysicalBus : Bus {
[Object]$device [Object]$device
PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) { PhysicalBus ([int]$index, [Object]$remote) : base ($index, $remote) {
$this.device = [Device]::new($index, $remote) $this.device = [BusDevice]::new($index, $remote)
} }
} }
class Device : IBus { class BusDevice : IBus {
Device ([int]$index, [Object]$remote) : base ($index, $remote) { BusDevice ([int]$index, [Object]$remote) : base ($index, $remote) {
} }
[string] identifier () { [string] identifier () {

View File

@ -1,4 +1,5 @@
. $PSScriptRoot\meta.ps1 . $PSScriptRoot\meta.ps1
. $PSScriptRoot\inst.ps1
class Special { class Special {
Special () { Special () {
@ -26,6 +27,14 @@ class Special {
} }
} }
[void] RunMacrobuttons() {
Start-Process -FilePath $(Join-Path -Path $(Get_VMPath) -ChildPath "VoicemeeterMacroButtons.exe")
}
[void] CloseMacrobuttons() {
Stop-Process -Name "VoicemeeterMacroButtons"
}
hidden $_hide = $($this | Add-Member ScriptProperty 'hide' ` hidden $_hide = $($this | Add-Member ScriptProperty 'hide' `
{ {
$this._hide = $this.Setter('show', $false) $this._hide = $this.Setter('show', $false)

View File

@ -1,4 +1,4 @@
function Get_VBPath { function Get_VMPath {
$reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + ` $reg_path = "Registry::HKEY_LOCAL_MACHINE\Software" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + ` (& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall" "\Microsoft\Windows\CurrentVersion\Uninstall"

View File

@ -1,21 +1,10 @@
. $PSScriptRoot\meta.ps1 . $PSScriptRoot\meta.ps1
class Recorder { class IRecorder {
[Object]$remote [Object]$remote
Recorder ([Object]$remote) { IRecorder ([Object]$remote) {
$this.remote = $remote $this.remote = $remote
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
AddChannelMembers
}
[string] identifier () {
return "Recorder"
}
[string] ToString() {
return $this.GetType().Name
} }
[single] Getter ($param) { [single] Getter ($param) {
@ -30,14 +19,35 @@ class Recorder {
Param_Set -PARAM "$($this.identifier()).$param" -Value $val Param_Set -PARAM "$($this.identifier()).$param" -Value $val
} }
} }
}
class Recorder : IRecorder {
[Object]$remote
[Object]$mode
Recorder ([Object]$remote) : base ($remote) {
$this.remote = $remote
$this.mode = [RecorderMode]::new($remote)
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
AddChannelMembers
}
[string] identifier () {
return "Recorder"
}
[string] ToString() {
return $this.GetType().Name
}
hidden $_loop = $($this | Add-Member ScriptProperty 'loop' ` hidden $_loop = $($this | Add-Member ScriptProperty 'loop' `
{ {
return Write-Warning ("ERROR: $($this.identifier()).mode.loop is write only") [bool]$this.mode.loop
} ` } `
{ {
param([bool]$arg) param($arg)
$this._loop = $this.Setter('mode.loop', $arg) $this.mode.loop = $arg
} }
) )
@ -46,6 +56,16 @@ class Recorder {
} }
} }
class RecorderMode : IRecorder {
RecorderMode ([Object]$remote) : base ($remote) {
AddBoolMembers -PARAMS @('loop')
}
[string] identifier () {
return "Recorder.Mode"
}
}
function Make_Recorder ([Object]$remote) { function Make_Recorder ([Object]$remote) {
return [Recorder]::new($remote) return [Recorder]::new($remote)
} }

View File

@ -38,7 +38,7 @@ class Strip : IStrip {
AddChannelMembers AddChannelMembers
AddGainlayerMembers AddGainlayerMembers
$this.levels = [Levels]::new($index, $remote) $this.levels = [StripLevels]::new($index, $remote)
} }
[string] ToString() { [string] ToString() {
@ -54,11 +54,11 @@ class Strip : IStrip {
} }
} }
class Levels : IStrip { class StripLevels : IStrip {
[int]$init [int]$init
[int]$offset [int]$offset
Levels ([int]$index, [Object]$remote) : base ($index, $remote) { StripLevels ([int]$index, [Object]$remote) : base ($index, $remote) {
$p_in = $remote.kind.p_in $p_in = $remote.kind.p_in
if ($index -lt $p_in) { if ($index -lt $p_in) {
$this.init = $index * 2 $this.init = $index * 2
@ -112,16 +112,16 @@ class PhysicalStrip : Strip {
AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2') AddFloatMembers -PARAMS @('reverb', 'delay', 'fx1', 'fx2')
AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2') AddBoolMembers -PARAMS @('postreverb', 'postdelay', 'postfx1', 'postfx2')
$this.comp = [Comp]::new($index, $remote) $this.comp = [StripComp]::new($index, $remote)
$this.gate = [Gate]::new($index, $remote) $this.gate = [StripGate]::new($index, $remote)
$this.denoiser = [Denoiser]::new($index, $remote) $this.denoiser = [StripDenoiser]::new($index, $remote)
$this.eq = [Eq]::new($index, $remote) $this.eq = [StripEq]::new($index, $remote)
$this.device = [Device]::new($index, $remote) $this.device = [StripDevice]::new($index, $remote)
} }
} }
class Comp : IStrip { class StripComp : IStrip {
Comp ([int]$index, [Object]$remote) : base ($index, $remote) { StripComp ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout') AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout')
AddBoolMembers -PARAMS @('makeup') AddBoolMembers -PARAMS @('makeup')
} }
@ -141,8 +141,8 @@ class Comp : IStrip {
) )
} }
class Gate : IStrip { class StripGate : IStrip {
Gate ([int]$index, [Object]$remote) : base ($index, $remote) { StripGate ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('threshold', 'damping', 'bpsidechain', 'attack', 'hold', 'release') AddFloatMembers -PARAMS @('threshold', 'damping', 'bpsidechain', 'attack', 'hold', 'release')
} }
@ -161,8 +161,8 @@ class Gate : IStrip {
) )
} }
class Denoiser : IStrip { class StripDenoiser : IStrip {
Denoiser ([int]$index, [Object]$remote) : base ($index, $remote) { StripDenoiser ([int]$index, [Object]$remote) : base ($index, $remote) {
} }
[string] identifier () { [string] identifier () {
@ -180,8 +180,8 @@ class Denoiser : IStrip {
) )
} }
class Eq : IStrip { class StripEq : IStrip {
Eq ([int]$index, [Object]$remote) : base ($index, $remote) { StripEq ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('on', 'ab') AddBoolMembers -PARAMS @('on', 'ab')
} }
@ -190,8 +190,8 @@ class Eq : IStrip {
} }
} }
class Device : IStrip { class StripDevice : IStrip {
Device ([int]$index, [Object]$remote) : base ($index, $remote) { StripDevice ([int]$index, [Object]$remote) : base ($index, $remote) {
} }
[string] identifier () { [string] identifier () {

View File

@ -34,6 +34,7 @@ Function ParseLog {
function main() { function main() {
try { try {
$vmr = Connect-Voicemeeter -Kind $kind $vmr = Connect-Voicemeeter -Kind $kind
$vmr.command.RunMacrobuttons() # ensure macrobuttons is running before we begin
Write-Host "Running tests for $vmr" Write-Host "Running tests for $vmr"
# test boundaries by kind # test boundaries by kind