mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-19 05:53:32 +00:00
Compare commits
2 Commits
add-level-
...
4e9ff66640
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e9ff66640 | |||
| bee52b6541 |
@@ -75,7 +75,7 @@ class RemoteBasic : Remote {
|
||||
$this.bus = Make_Buses($this)
|
||||
$this.button = Make_Buttons
|
||||
$this.vban = Make_Vban($this)
|
||||
$this.command = Make_Command
|
||||
$this.command = Make_Command($this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class RemoteBanana : Remote {
|
||||
$this.bus = Make_Buses($this)
|
||||
$this.button = Make_Buttons
|
||||
$this.vban = Make_Vban($this)
|
||||
$this.command = Make_Command
|
||||
$this.command = Make_Command($this)
|
||||
$this.recorder = Make_Recorder($this)
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class RemotePotato : Remote {
|
||||
$this.bus = Make_Buses($this)
|
||||
$this.button = Make_Buttons
|
||||
$this.vban = Make_Vban($this)
|
||||
$this.command = Make_Command
|
||||
$this.command = Make_Command($this)
|
||||
$this.recorder = Make_Recorder($this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
32
lib/bus.ps1
32
lib/bus.ps1
@@ -18,15 +18,15 @@ class IBus {
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||
return $this.remote.Getter("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[string] Getter_String ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $true
|
||||
return $this.remote.Getter_String("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[void] Setter ($param, $set) {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $set
|
||||
[void] Setter ($param, $val) {
|
||||
$this.remote.Setter("$($this.identifier()).$param", $val)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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 () {
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
. $PSScriptRoot\meta.ps1
|
||||
. $PSScriptRoot\inst.ps1
|
||||
|
||||
class Special {
|
||||
Special () {
|
||||
[Object]$remote
|
||||
|
||||
Special ([Object]$remote) {
|
||||
AddActionMembers -PARAMS @('restart', 'shutdown', 'show')
|
||||
|
||||
$this.remote = $remote
|
||||
}
|
||||
|
||||
[string] identifier () {
|
||||
@@ -14,18 +19,26 @@ class Special {
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||
return $this.remote.Getter("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[void] Setter ($param, $val) {
|
||||
if ($val -is [Boolean]) {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $(if ($val) { 1 } else { 0 })
|
||||
$this.remote.Setter("$($this.identifier()).$param", $(if ($val) { 1 } else { 0 }))
|
||||
}
|
||||
else {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
|
||||
$this.remote.Setter("$($this.identifier()).$param", $val)
|
||||
}
|
||||
}
|
||||
|
||||
[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)
|
||||
@@ -58,6 +71,6 @@ class Special {
|
||||
}
|
||||
}
|
||||
|
||||
function Make_Command {
|
||||
return [Special]::new()
|
||||
function Make_Command([Object]$remote) {
|
||||
return [Special]::new($remote)
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
. $PSScriptRoot\meta.ps1
|
||||
|
||||
class Recorder {
|
||||
class IRecorder {
|
||||
[Object]$remote
|
||||
|
||||
Recorder ([Object]$remote) {
|
||||
IRecorder ([Object]$remote) {
|
||||
$this.remote = $remote
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return $this.remote.Getter("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[void] Setter ($param, $val) {
|
||||
if ($val -is [Boolean]) {
|
||||
$this.remote.Setter("$($this.identifier()).$param", $(if ($val) { 1 } else { 0 }))
|
||||
}
|
||||
else {
|
||||
$this.remote.Setter("$($this.identifier()).$param", $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
|
||||
@@ -18,26 +41,13 @@ class Recorder {
|
||||
return $this.GetType().Name
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||
}
|
||||
|
||||
[void] Setter ($param, $val) {
|
||||
if ($val -is [Boolean]) {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $(if ($val) { 1 } else { 0 })
|
||||
}
|
||||
else {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ class IStrip {
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||
return $this.remote.Getter("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[string] Getter_String ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $true
|
||||
return $this.remote.Getter_String("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[void] Setter ($param, $val) {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
|
||||
$this.remote.Setter("$($this.identifier()).$param", $val)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
20
lib/vban.ps1
20
lib/vban.ps1
@@ -1,9 +1,11 @@
|
||||
class IVban {
|
||||
[int32]$index
|
||||
[Object]$remote
|
||||
[string]$direction
|
||||
|
||||
IVban ([int]$index, [string]$direction) {
|
||||
IVban ([int]$index, [Object]$remote, [string]$direction) {
|
||||
$this.index = $index
|
||||
$this.remote = $remote
|
||||
$this.direction = $direction
|
||||
}
|
||||
|
||||
@@ -16,20 +18,20 @@ class IVban {
|
||||
}
|
||||
|
||||
[single] Getter ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $false
|
||||
return $this.remote.Getter("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[string] Getter_String ($param) {
|
||||
return Param_Get -PARAM "$($this.identifier()).$param" -IS_STRING $true
|
||||
return $this.remote.Getter_String("$($this.identifier()).$param")
|
||||
}
|
||||
|
||||
[void] Setter ($param, $val) {
|
||||
Param_Set -PARAM "$($this.identifier()).$param" -Value $val
|
||||
$this.remote.Setter("$($this.identifier()).$param", $val)
|
||||
}
|
||||
}
|
||||
|
||||
class Vban : IVban {
|
||||
Vban ([int]$index, [string]$direction) : base ($index, $direction) {
|
||||
Vban ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
}
|
||||
|
||||
hidden $_on = $($this | Add-Member ScriptProperty 'on' `
|
||||
@@ -173,13 +175,13 @@ class Vban : IVban {
|
||||
|
||||
|
||||
class VbanInstream : Vban {
|
||||
VbanInstream ([int]$index, [string]$direction) : base ($index, $direction) {
|
||||
VbanInstream ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class VbanOutstream : Vban {
|
||||
VbanOutstream ([int]$index, [string]$direction) : base ($index, $direction) {
|
||||
VbanOutstream ([int]$index, [Object]$remote, [string]$direction) : base ($index, $remote, $direction) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,10 +191,10 @@ function Make_Vban ([Object]$remote) {
|
||||
[System.Collections.ArrayList]$outstream = @()
|
||||
|
||||
0..$($remote.kind.vban_in - 1) | ForEach-Object {
|
||||
[void]$instream.Add([VbanInstream]::new($_, "in"))
|
||||
[void]$instream.Add([VbanInstream]::new($_, $remote, "in"))
|
||||
}
|
||||
0..$($remote.kind.vban_out - 1) | ForEach-Object {
|
||||
[void]$outstream.Add([VbanOutstream]::new($_, "out"))
|
||||
[void]$outstream.Add([VbanOutstream]::new($_, $remote, "out"))
|
||||
}
|
||||
|
||||
$CustomObject = [pscustomobject]@{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user