Compare commits

..

No commits in common. "83c81384bec8ed63c9ad1470daef6f81fe4e9fd6" and "b128ee0625ededb6a1e0c9e42447f998fc875be1" have entirely different histories.

5 changed files with 86 additions and 35 deletions

View File

@ -72,11 +72,9 @@ Strip Gainlayers are now FloatArrayMember objects, see README for details
### Changed ### Changed
- Meta functions can now take a -ReadOnly or -WriteOnly switch parameter - Device: explicit $arg types for consistency
- Meta: AddBoolMembers, AddIntMembers $arg types for consistency - Meta: AddBoolMembers, AddIntMembers $arg types for consistency
- Float getters/setters now default to two decimal places. - Float getters/setters now default to two decimal places.
- Device: explicit $arg types for consistency
- Device members now added with meta functions
- some vban.instream | vban.outstream commands now added with meta functions - some vban.instream | vban.outstream commands now added with meta functions
- on - on
@ -86,7 +84,6 @@ Strip Gainlayers are now FloatArrayMember objects, see README for details
- Recorder.Armstrip|Armbus -> BoolArrayMember: now have .Get() - Recorder.Armstrip|Armbus -> BoolArrayMember: now have .Get()
- Cast Recorder getters to types for consistency - Cast Recorder getters to types for consistency
- Recorder.Prefix now added with AddStringMembers
- Strip.Mono is now an alias for Strip.MC on virtual strips - 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.AppMute|AppGain can now take an app index; see README for details

View File

@ -99,13 +99,23 @@ class VirtualBus : Bus {
class BusDevice : IODevice { class BusDevice : IODevice {
BusDevice ([int]$index, [Object]$remote) : base ($index, $remote) { BusDevice ([int]$index, [Object]$remote) : base ($index, $remote) {
if ($this.index -eq 0) { if ($this.index -eq 0) {
AddStringMembers -PARAMS @('asio') -WriteOnly $this.AddASIO()
} }
} }
[string] identifier () { [string] identifier () {
return 'Bus[' + $this.index + '].Device' return 'Bus[' + $this.index + '].Device'
} }
hidden [void] AddASIO () {
Add-Member -InputObject $this -MemberType ScriptProperty -Name 'asio' `
-Value {
return Write-Warning ("ERROR: $($this.identifier()).asio is write only")
} -SecondValue {
param([string]$arg)
return $this.Setter('asio', $arg)
} -Force
}
} }
function Make_Buses ([Object]$remote) { function Make_Buses ([Object]$remote) {

View File

@ -99,8 +99,53 @@ class EqCell : IRemote {
class IODevice : IRemote { class IODevice : IRemote {
IODevice ([int]$index, [Object]$remote) : base ($index, $remote) { IODevice ([int]$index, [Object]$remote) : base ($index, $remote) {
AddStringMembers -WriteOnly -PARAMS @('wdm', 'ks', 'mme')
AddStringMembers -ReadOnly -PARAMS @('name')
AddIntMembers -ReadOnly -PARAMS @('sr')
} }
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,57 +1,65 @@
function AddBoolMembers () { function AddBoolMembers () {
param( param(
[String[]]$PARAMS, [Switch]$readOnly, [Switch]$writeOnly [String[]]$PARAMS
) )
[hashtable]$Signatures = @{} [hashtable]$Signatures = @{}
foreach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter
$Signatures['Getter'] = "[bool]`$this.Getter('{0}')" -f $param $Signatures['Getter'] = "[bool]`$this.Getter('{0}')" -f $param
# Define setter
$Signatures['Setter'] = "param ( [bool]`$arg )`n`$this.Setter('{0}', `$arg)" ` $Signatures['Setter'] = "param ( [bool]`$arg )`n`$this.Setter('{0}', `$arg)" `
-f $param -f $param
Addmember -ReadOnly:$readOnly -WriteOnly:$writeOnly Addmember
} }
} }
function AddFloatMembers () { function AddFloatMembers () {
param( param(
[String[]]$PARAMS, [Switch]$readOnly, [Switch]$writeOnly, [String[]]$PARAMS,
[int]$decimals = 2 [int]$decimals = 2
) )
[hashtable]$Signatures = @{} [hashtable]$Signatures = @{}
foreach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter
$Signatures['Getter'] = "[math]::Round(`$this.Getter('{0}'), {1})" -f $param, $decimals $Signatures['Getter'] = "[math]::Round(`$this.Getter('{0}'), {1})" -f $param, $decimals
# Define setter
$Signatures['Setter'] = "param ( [Single]`$arg )`n`$this.Setter('{0}', `$arg)" ` $Signatures['Setter'] = "param ( [Single]`$arg )`n`$this.Setter('{0}', `$arg)" `
-f $param -f $param
Addmember -ReadOnly:$readOnly -WriteOnly:$writeOnly Addmember
} }
} }
function AddIntMembers () { function AddIntMembers () {
param( param(
[String[]]$PARAMS, [Switch]$readOnly, [Switch]$writeOnly [String[]]$PARAMS
) )
[hashtable]$Signatures = @{} [hashtable]$Signatures = @{}
foreach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter
$Signatures['Getter'] = "[Int]`$this.Getter('{0}')" -f $param $Signatures['Getter'] = "[Int]`$this.Getter('{0}')" -f $param
# Define setter
$Signatures['Setter'] = "param ( [Int]`$arg )`n`$this.Setter('{0}', `$arg)" ` $Signatures['Setter'] = "param ( [Int]`$arg )`n`$this.Setter('{0}', `$arg)" `
-f $param -f $param
Addmember -ReadOnly:$readOnly -WriteOnly:$writeOnly Addmember
} }
} }
function AddStringMembers () { function AddStringMembers () {
param( param(
[String[]]$PARAMS, [Switch]$readOnly, [Switch]$writeOnly [String[]]$PARAMS
) )
[hashtable]$Signatures = @{} [hashtable]$Signatures = @{}
foreach ($param in $PARAMS) { foreach ($param in $PARAMS) {
# Define getter
$Signatures['Getter'] = "[String]`$this.Getter_String('{0}')" -f $param $Signatures['Getter'] = "[String]`$this.Getter_String('{0}')" -f $param
# Define setter
$Signatures['Setter'] = "param ( [String]`$arg )`n`$this.Setter('{0}', `$arg)" ` $Signatures['Setter'] = "param ( [String]`$arg )`n`$this.Setter('{0}', `$arg)" `
-f $param -f $param
Addmember -ReadOnly:$readOnly -WriteOnly:$writeOnly Addmember
} }
} }
@ -89,24 +97,6 @@ function AddChannelMembers () {
} }
function Addmember { function Addmember {
param(
[Switch]$readOnly, [Switch]$writeOnly
)
if ($readOnly -and $writeOnly) {
throw "AddMember: cannot be both readOnly and writeOnly for '$param'"
}
# Override signatures based on mode
if ($readOnly) {
$Signatures['Setter'] = "return Write-Warning (`"ERROR: `$(`$this.identifier()).{0} is read only`")" `
-f $param
}
elseif ($writeOnly) {
$Signatures['Getter'] = "return Write-Warning (`"ERROR: `$(`$this.identifier()).{0} is write only`")" `
-f $param
}
$AddMemberParams = @{ $AddMemberParams = @{
Name = $param Name = $param
MemberType = 'ScriptProperty' MemberType = 'ScriptProperty'

View File

@ -25,7 +25,6 @@ class Recorder : IRemote {
AddActionMembers -PARAMS @('replay', 'ff', 'rew') AddActionMembers -PARAMS @('replay', 'ff', 'rew')
AddFloatMembers -PARAMS @('gain') AddFloatMembers -PARAMS @('gain')
AddIntMembers -PARAMS @('prerectime') AddIntMembers -PARAMS @('prerectime')
AddStringMembers -PARAMS @('prefix') -WriteOnly
AddChannelMembers AddChannelMembers
} }
@ -118,6 +117,16 @@ class Recorder : IRemote {
} }
) )
hidden $_prefix = $($this | Add-Member ScriptProperty 'prefix' `
{
return Write-Warning ("ERROR: $($this.identifier()).prefix is write only")
} `
{
param([string]$arg)
$this._prefix = $this.Setter('prefix', $arg)
}
)
hidden $_filetype = $($this | Add-Member ScriptProperty 'filetype' ` hidden $_filetype = $($this | Add-Member ScriptProperty 'filetype' `
{ {
return Write-Warning ("ERROR: $($this.identifier()).filetype is write only") return Write-Warning ("ERROR: $($this.identifier()).filetype is write only")