diff --git a/lib/Voicemeeter.psm1 b/lib/Voicemeeter.psm1 index 272ab53..05fad2e 100644 --- a/lib/Voicemeeter.psm1 +++ b/lib/Voicemeeter.psm1 @@ -10,6 +10,7 @@ . $PSScriptRoot\vban.ps1 . $PSScriptRoot\command.ps1 . $PSScriptRoot\recorder.ps1 +. $PSScriptRoot\patch.ps1 . $PSScriptRoot\profiles.ps1 class Remote { @@ -79,6 +80,7 @@ class RemoteBasic : Remote { [System.Collections.ArrayList]$button [PSCustomObject]$vban [Object]$command + [Object]$patch RemoteBasic () : base ('basic') { $this.strip = Make_Strips($this) @@ -86,6 +88,7 @@ class RemoteBasic : Remote { $this.button = Make_Buttons $this.vban = Make_Vban($this) $this.command = Make_Command($this) + $this.patch = Make_Patch($this) } } @@ -95,6 +98,7 @@ class RemoteBanana : Remote { [System.Collections.ArrayList]$button [PSCustomObject]$vban [Object]$command + [Object]$patch [Object]$recorder RemoteBanana () : base ('banana') { @@ -103,6 +107,7 @@ class RemoteBanana : Remote { $this.button = Make_Buttons $this.vban = Make_Vban($this) $this.command = Make_Command($this) + $this.patch = Make_Patch($this) $this.recorder = Make_Recorder($this) } } @@ -113,6 +118,7 @@ class RemotePotato : Remote { [System.Collections.ArrayList]$button [PSCustomObject]$vban [Object]$command + [Object]$patch [Object]$recorder RemotePotato () : base ('potato') { @@ -121,6 +127,7 @@ class RemotePotato : Remote { $this.button = Make_Buttons $this.vban = Make_Vban($this) $this.command = Make_Command($this) + $this.patch = Make_Patch($this) $this.recorder = Make_Recorder($this) } } diff --git a/lib/patch.ps1 b/lib/patch.ps1 new file mode 100644 index 0000000..e0a512a --- /dev/null +++ b/lib/patch.ps1 @@ -0,0 +1,49 @@ +class Patch : IRemote { + [System.Collections.ArrayList]$asio + [System.Collections.ArrayList]$composite + [System.Collections.ArrayList]$insert + + Patch ([Object]$remote) : base ($remote) { + AddBoolMembers -PARAMS @('postFaderComposite', 'postFxInsert') + + $this.AddASIOOutMembers() + + $this.asio = @() + for ($i = 0; $i -lt $remote.kind.asio_in; $i++) { + $this.asio.Add([IntArrayMember]::new($i, 'asio', $this)) + } + + $this.composite = @() + for ($i = 0; $i -lt $remote.kind.composite; $i++) { + $this.composite.Add([IntArrayMember]::new($i, 'composite', $this)) + } + + $this.insert = @() + for ($i = 0; $i -lt $remote.kind.insert; $i++) { + $this.insert.Add([BoolArrayMember]::new($i, 'insert', $this)) + } + } + + [string] identifier () { + return 'Patch' + } + + hidden [void] AddASIOOutMembers () { + $num_A = $this.remote.kind.p_out + $asio_out = $this.remote.kind.asio_out + + if ($asio_out -le 0) { return } + + for ($a = 2; $a -le $num_A; $a++) { + [System.Collections.ArrayList]$members = @() + for ($i = 0; $i -lt $asio_out; $i++) { + $members.Add([IntArrayMember]::new($i, "OutA$a", $this)) + } + Add-Member -InputObject $this -MemberType NoteProperty -Name "OutA$a" -Value $members -Force + } + } +} + +function Make_Patch ([Object]$remote) { + return [Patch]::new($remote) +} \ No newline at end of file