Compare commits

..

No commits in common. "b128ee0625ededb6a1e0c9e42447f998fc875be1" and "837211424f65a41951c401ccc27ff4059ab21c59" have entirely different histories.

7 changed files with 224 additions and 186 deletions

View File

@ -26,11 +26,8 @@ Strip Gainlayers are now FloatArrayMember objects, see README for details
- ArrayMember classes for array-like properties
- Patch class
- Option class
- IO classes to centralize controls common to both Strip and Bus
- IOControl
- IOLevels
- IOEq
- IODevice
- Device class
- EQ class
- FX class
- AddAliasMembers meta function takes a hashtable `-MAP` of `alias = property`
@ -58,7 +55,6 @@ Strip Gainlayers are now FloatArrayMember objects, see README for details
- Strip.Karaoke alias for Strip.K
- Strip.EQGain1|EQGain2|EQGain3 with bass/low, mid/med, treble/high aliases, respectively
- StripAudibility class with Strip.Audibility.Knob
- StripKnob base class for audibility knobs with `knob`
- Strip.Denoiser.Threshold
- Strip.VAIO
- Strip.Pitch, StripPitch class
@ -85,9 +81,12 @@ Strip Gainlayers are now FloatArrayMember objects, see README for details
- Recorder.Armstrip|Armbus -> BoolArrayMember: now have .Get()
- Cast Recorder getters to types for consistency
- Bus.Levels.Convert hidden and return type [float] -> [single] for naming consistency
- Strip.Mono is now an alias for Strip.MC on virtual strips
- Strip.AppMute|AppGain can now take an app index; see README for details
- Strip Knob setters: explicit $arg types for consistency
- Strip.Levels.Convert hidden and return type [float] -> [single] for naming consistency
### Fixed

View File

@ -4,7 +4,8 @@
. $PSScriptRoot\kinds.ps1
. $PSScriptRoot\iremote.ps1
. $PSScriptRoot\arraymember.ps1
. $PSScriptRoot\io.ps1
. $PSScriptRoot\device.ps1
. $PSScriptRoot\eq.ps1
. $PSScriptRoot\strip.ps1
. $PSScriptRoot\bus.ps1
. $PSScriptRoot\macrobuttons.ps1

View File

@ -1,12 +1,13 @@
class Bus : IOControl {
class Bus : IRemote {
[Object]$mode
[Object]$eq
[Object]$levels
Bus ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('sel', 'monitor')
AddBoolMembers -PARAMS @('mute', 'sel', 'monitor')
AddIntMembers -PARAMS @('mono')
AddFloatMembers -PARAMS @('returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
AddStringMembers -PARAMS @('label')
AddFloatMembers -PARAMS @('gain', 'returnreverb', 'returndelay', 'returnfx1', 'returnfx2')
$this.mode = [BusMode]::new($index, $remote)
$this.eq = [BusEq]::new($index, $remote)
@ -16,9 +17,17 @@ class Bus : IOControl {
[string] identifier () {
return 'Bus[' + $this.index + ']'
}
[void] FadeTo ([single]$target, [int]$time) {
$this.Setter('FadeTo', "($target, $time)")
}
class BusLevels : IOLevels {
[void] FadeBy ([single]$target, [int]$time) {
$this.Setter('FadeBy', "($target, $time)")
}
}
class BusLevels : IRemote {
[int]$init
[int]$offset
@ -27,6 +36,23 @@ class BusLevels : IOLevels {
$this.offset = 8
}
hidden [single] Convert([single]$val) {
if ($val -gt 0) {
return [math]::Round(20 * [math]::Log10($val), 1)
}
else {
return - 200.0
}
}
[System.Collections.ArrayList] Getter([int]$mode) {
[System.Collections.ArrayList]$vals = @()
$this.init..$($this.init + $this.offset - 1) | ForEach-Object {
$vals.Add($this.Convert($(Get_Level -MODE $mode -INDEX $_)))
}
return $vals
}
[System.Collections.ArrayList] All() {
return $this.Getter(3)
}
@ -67,7 +93,7 @@ class BusMode : IRemote {
}
}
class BusEq : IOEq {
class BusEq : Eq {
BusEq ([int]$index, [Object]$remote) : base ($index, $remote, 'Bus') {
}
@ -96,7 +122,7 @@ class VirtualBus : Bus {
}
}
class BusDevice : IODevice {
class BusDevice : Device {
BusDevice ([int]$index, [Object]$remote) : base ($index, $remote) {
if ($this.index -eq 0) {
$this.AddASIO()

52
lib/device.ps1 Normal file
View File

@ -0,0 +1,52 @@
class Device : IRemote {
Device ([int]$index, [Object]$remote) : base ($index, $remote) {
}
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
{
$this.Getter_String('name')
} `
{
return Write-Warning ("ERROR: $($this.identifier()).name is read only")
}
)
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{
[int]$this.Getter('sr')
} `
{
return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
}
)
hidden $_wdm = $($this | Add-Member ScriptProperty 'wdm' `
{
return Write-Warning ("ERROR: $($this.identifier()).wdm is write only")
} `
{
param([string]$arg)
return $this.Setter('wdm', $arg)
}
)
hidden $_ks = $($this | Add-Member ScriptProperty 'ks' `
{
return Write-Warning ("ERROR: $($this.identifier()).ks is write only")
} `
{
param([string]$arg)
return $this.Setter('ks', $arg)
}
)
hidden $_mme = $($this | Add-Member ScriptProperty 'mme' `
{
return Write-Warning ("ERROR: $($this.identifier()).mme is write only")
} `
{
param([string]$arg)
return $this.Setter('mme', $arg)
}
)
}

60
lib/eq.ps1 Normal file
View File

@ -0,0 +1,60 @@
class Eq : IRemote {
[System.Collections.ArrayList]$channel
[string]$kindOfEq
Eq ([int]$index, [Object]$remote, [string]$kindOfEq) : base ($index, $remote) {
$this.kindOfEq = $kindOfEq
AddBoolMembers -PARAMS @('on', 'ab')
$this.channel = @()
for ($ch = 0; $ch -lt $remote.kind.eq_ch[$this.kindOfEq]; $ch++) {
$this.channel.Add([EqChannel]::new($ch, $remote, $this.identifier()))
}
}
[void] Load ([string]$filename) {
$param = 'Command.Load{0}Eq[{1}]' -f $this.kindOfEq, $this.index
$this.remote.Setter($param, $filename)
}
[void] Save ([string]$filename) {
$param = 'Command.Save{0}Eq[{1}]' -f $this.kindOfEq, $this.index
$this.remote.Setter($param, $filename)
}
}
class EqChannel : IRemote {
[System.Collections.ArrayList]$cell
[string]$eqId
EqChannel ([int]$index, [Object]$remote, [string]$eqId) : base ($index, $remote) {
$this.eqId = $eqId
$this.cell = @()
$cellCount = $this.remote.kind.cells
for ($c = 0; $c -lt $cellCount; $c++) {
$this.cell.Add([EqCell]::new($c, $remote, $this.identifier()))
}
}
[string] identifier () {
return '{0}.Channel[{1}]' -f $this.eqId, $this.index
}
}
class EqCell : IRemote {
[string]$channelId
EqCell ([int]$index, [Object]$remote, [string]$channelId) : base ($index, $remote) {
$this.channelId = $channelId
AddBoolMembers -PARAMS @('on')
AddIntMembers -PARAMS @('type')
AddFloatMembers -PARAMS @('f', 'gain', 'q')
}
[string] identifier () {
return '{0}.Cell[{1}]' -f $this.channelId, $this.index
}
}

View File

@ -1,151 +0,0 @@
class IOControl : IRemote {
IOControl ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('mute')
AddFloatMembers -PARAMS @('gain')
AddStringMembers -PARAMS @('label')
}
[void] FadeTo ([single]$target, [int]$time) {
$this.Setter('FadeTo', "($target, $time)")
}
[void] FadeBy ([single]$target, [int]$time) {
$this.Setter('FadeBy', "($target, $time)")
}
}
class IOLevels : IRemote {
IOLevels ([int]$index, [Object]$remote) : base ($index, $remote) {
}
hidden [single] Convert([single]$val) {
if ($val -gt 0) {
return [math]::Round(20 * [math]::Log10($val), 1)
}
else {
return -200.0
}
}
[System.Collections.ArrayList] Getter([int]$mode) {
[System.Collections.ArrayList]$vals = @()
$this.init..$($this.init + $this.offset - 1) | ForEach-Object {
$vals.Add($this.Convert($(Get_Level -MODE $mode -INDEX $_)))
}
return $vals
}
}
class IOEq : IRemote {
[System.Collections.ArrayList]$channel
[string]$kindOfEq
IOEq ([int]$index, [Object]$remote, [string]$kindOfEq) : base ($index, $remote) {
$this.kindOfEq = $kindOfEq
AddBoolMembers -PARAMS @('on', 'ab')
$this.channel = @()
for ($ch = 0; $ch -lt $remote.kind.eq_ch[$this.kindOfEq]; $ch++) {
$this.channel.Add([EqChannel]::new($ch, $remote, $this.identifier()))
}
}
[void] Load ([string]$filename) {
$param = 'Command.Load{0}Eq[{1}]' -f $this.kindOfEq, $this.index
$this.remote.Setter($param, $filename)
}
[void] Save ([string]$filename) {
$param = 'Command.Save{0}Eq[{1}]' -f $this.kindOfEq, $this.index
$this.remote.Setter($param, $filename)
}
}
class EqChannel : IRemote {
[System.Collections.ArrayList]$cell
[string]$eqId
EqChannel ([int]$index, [Object]$remote, [string]$eqId) : base ($index, $remote) {
$this.eqId = $eqId
$this.cell = @()
$cellCount = $this.remote.kind.cells
for ($c = 0; $c -lt $cellCount; $c++) {
$this.cell.Add([EqCell]::new($c, $remote, $this.identifier()))
}
}
[string] identifier () {
return '{0}.Channel[{1}]' -f $this.eqId, $this.index
}
}
class EqCell : IRemote {
[string]$channelId
EqCell ([int]$index, [Object]$remote, [string]$channelId) : base ($index, $remote) {
$this.channelId = $channelId
AddBoolMembers -PARAMS @('on')
AddIntMembers -PARAMS @('type')
AddFloatMembers -PARAMS @('f', 'gain', 'q')
}
[string] identifier () {
return '{0}.Cell[{1}]' -f $this.channelId, $this.index
}
}
class IODevice : IRemote {
IODevice ([int]$index, [Object]$remote) : base ($index, $remote) {
}
hidden $_name = $($this | Add-Member ScriptProperty 'name' `
{
$this.Getter_String('name')
} `
{
return Write-Warning ("ERROR: $($this.identifier()).name is read only")
}
)
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
{
[int]$this.Getter('sr')
} `
{
return Write-Warning ("ERROR: $($this.identifier()).sr is read only")
}
)
hidden $_wdm = $($this | Add-Member ScriptProperty 'wdm' `
{
return Write-Warning ("ERROR: $($this.identifier()).wdm is write only")
} `
{
param([string]$arg)
return $this.Setter('wdm', $arg)
}
)
hidden $_ks = $($this | Add-Member ScriptProperty 'ks' `
{
return Write-Warning ("ERROR: $($this.identifier()).ks is write only")
} `
{
param([string]$arg)
return $this.Setter('ks', $arg)
}
)
hidden $_mme = $($this | Add-Member ScriptProperty 'mme' `
{
return Write-Warning ("ERROR: $($this.identifier()).mme is write only")
} `
{
param([string]$arg)
return $this.Setter('mme', $arg)
}
)
}

View File

@ -1,10 +1,11 @@
class Strip : IOControl {
class Strip : IRemote {
[System.Collections.ArrayList]$gainlayer
[Object]$levels
Strip ([int]$index, [Object]$remote) : base ($index, $remote) {
AddBoolMembers -PARAMS @('solo')
AddFloatMembers -PARAMS @('limit', 'pan_x', 'pan_y')
AddBoolMembers -PARAMS @('solo', 'mute')
AddFloatMembers -PARAMS @('gain', 'limit', 'pan_x', 'pan_y')
AddStringMembers -PARAMS @('label')
AddChannelMembers
@ -19,9 +20,17 @@ class Strip : IOControl {
[string] identifier () {
return 'Strip[' + $this.index + ']'
}
[void] FadeTo ([single]$target, [int]$time) {
$this.Setter('FadeTo', "($target, $time)")
}
class StripLevels : IOLevels {
[void] FadeBy ([single]$target, [int]$time) {
$this.Setter('FadeBy', "($target, $time)")
}
}
class StripLevels : IRemote {
[int]$init
[int]$offset
@ -37,6 +46,23 @@ class StripLevels : IOLevels {
}
}
hidden [single] Convert([single]$val) {
if ($val -gt 0) {
return [math]::Round(20 * [math]::Log10($val), 1)
}
else {
return -200.0
}
}
[System.Collections.ArrayList] Getter([int]$mode) {
[System.Collections.ArrayList]$vals = @()
$this.init..$($this.init + $this.offset - 1) | ForEach-Object {
$vals.Add($this.Convert($(Get_Level -MODE $mode -INDEX $_)))
}
return $vals
}
[System.Collections.ArrayList] PreFader() {
return $this.Getter(0)
}
@ -75,8 +101,14 @@ class PhysicalStrip : Strip {
}
}
class StripKnob : IRemote {
StripKnob ([int]$index, [Object]$remote) : base ($index, $remote) {
class StripComp : IRemote {
StripComp ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout')
AddBoolMembers -PARAMS @('makeup')
}
[string] identifier () {
return 'Strip[' + $this.index + '].Comp'
}
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
@ -90,18 +122,7 @@ class StripKnob : IRemote {
)
}
class StripComp : StripKnob {
StripComp ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('gainin', 'ratio', 'threshold', 'attack', 'release', 'knee', 'gainout')
AddBoolMembers -PARAMS @('makeup')
}
[string] identifier () {
return 'Strip[' + $this.index + '].Comp'
}
}
class StripGate : StripKnob {
class StripGate : IRemote {
StripGate ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('threshold', 'damping', 'bpsidechain', 'attack', 'hold', 'release')
}
@ -109,9 +130,19 @@ class StripGate : StripKnob {
[string] identifier () {
return 'Strip[' + $this.index + '].Gate'
}
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
{
[math]::Round($this.Getter(''), 2)
} `
{
param([single]$arg)
return $this.Setter('', $arg)
}
)
}
class StripDenoiser : StripKnob {
class StripDenoiser : IRemote {
StripDenoiser ([int]$index, [Object]$remote) : base ($index, $remote) {
AddFloatMembers -PARAMS @('threshold')
}
@ -119,6 +150,16 @@ class StripDenoiser : StripKnob {
[string] identifier () {
return 'Strip[' + $this.index + '].Denoiser'
}
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
{
[math]::Round($this.Getter(''), 2)
} `
{
param([single]$arg)
return $this.Setter('', $arg)
}
)
}
class StripPitch : IRemote {
@ -136,16 +177,26 @@ class StripPitch : IRemote {
}
}
class StripAudibility : StripKnob {
class StripAudibility : IRemote {
StripAudibility ([int]$index, [Object]$remote) : base ($index, $remote) {
}
[string] identifier () {
return 'Strip[' + $this.index + '].Audibility'
}
hidden $_knob = $($this | Add-Member ScriptProperty 'knob' `
{
[math]::Round($this.Getter(''), 2)
} `
{
param([single]$arg)
return $this.Setter('', $arg)
}
)
}
class StripEq : IOEq {
class StripEq : Eq {
StripEq ([int]$index, [Object]$remote) : base ($index, $remote, 'Strip') {
}
@ -154,7 +205,7 @@ class StripEq : IOEq {
}
}
class StripDevice : IODevice {
class StripDevice : Device {
StripDevice ([int]$index, [Object]$remote) : base ($index, $remote) {
}