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 {
try {
$vb_path = Get_VBPath
$vb_path = Get_VMPath
if ([string]::IsNullOrWhiteSpace($vb_path)) {
throw [VMRemoteError]::new("couldn't get Voicemeeter path")

View File

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

View File

@ -1,4 +1,5 @@
. $PSScriptRoot\meta.ps1
. $PSScriptRoot\inst.ps1
class 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' `
{
$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" + `
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + `
"\Microsoft\Windows\CurrentVersion\Uninstall"

View File

@ -1,21 +1,10 @@
. $PSScriptRoot\meta.ps1
class Recorder {
class IRecorder {
[Object]$remote
Recorder ([Object]$remote) {
IRecorder ([Object]$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) {
@ -29,15 +18,36 @@ class Recorder {
else {
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' `
{
return Write-Warning ("ERROR: $($this.identifier()).mode.loop is write only")
[bool]$this.mode.loop
} `
{
param([bool]$arg)
$this._loop = $this.Setter('mode.loop', $arg)
param($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) {
return [Recorder]::new($remote)
}

View File

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

View File

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