mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
8e03c4e53b
rename factory functions. class getters now send is_string parameter. each property type for each class now has separate meta function.
75 lines
1.7 KiB
PowerShell
75 lines
1.7 KiB
PowerShell
. $PSScriptRoot\meta.ps1
|
|
|
|
class Strip {
|
|
[Int]$id
|
|
|
|
# Constructor
|
|
Strip ([Int]$id)
|
|
{
|
|
$this.id = $id
|
|
|
|
AddBoolMembers -PARAMS @('mono', 'solo', 'mute')
|
|
AddFloatMembers -PARAMS @('gain', 'comp', 'gate')
|
|
AddIntMembers -PARAMS @('limit')
|
|
AddStringMembers -PARAMS @('label')
|
|
|
|
AddChannelMembers
|
|
}
|
|
|
|
[Single] Getter($cmd) {
|
|
return Param_Get -PARAM $cmd -IS_STRING $false
|
|
}
|
|
|
|
[String] Getter_String($cmd) {
|
|
return Param_Get -PARAM $cmd -IS_STRING $true
|
|
}
|
|
|
|
[void] Setter($cmd, $set) {
|
|
Param_Set -PARAM $cmd -VALUE $set
|
|
}
|
|
|
|
[String] cmd ($arg) {
|
|
return "Strip[" + $this.id + "].$arg"
|
|
}
|
|
|
|
hidden $_device = $($this | Add-Member ScriptProperty 'device' `
|
|
{
|
|
$this.Getter_String($this.cmd('device.name'))
|
|
}`
|
|
{
|
|
return Write-Warning("ERROR: " + $this.cmd('device.name') + " is read only")
|
|
}
|
|
)
|
|
|
|
hidden $_sr = $($this | Add-Member ScriptProperty 'sr' `
|
|
{
|
|
$this.Getter($this.cmd('device.sr'))
|
|
}`
|
|
{
|
|
return Write-Warning("ERROR: " + $this.cmd('device.sr') + " is read only")
|
|
}
|
|
)
|
|
}
|
|
|
|
class PhysicalStrip : Strip {
|
|
PhysicalStrip ([Int]$id) : base ($id) {
|
|
}
|
|
}
|
|
|
|
class VirtualStrip : Strip {
|
|
VirtualStrip ([Int]$id) : base ($id) {
|
|
}
|
|
}
|
|
|
|
|
|
Function Make_Strips {
|
|
[System.Collections.ArrayList]$strip = @()
|
|
0..$($layout.p_in + $layout.v_in - 1) | ForEach-Object {
|
|
if ($_ -lt $layout.p_in) {
|
|
[void]$strip.Add([PhysicalStrip]::new($_))
|
|
}
|
|
else { [void]$strip.Add([VirtualStrip]::new($_)) }
|
|
}
|
|
$strip
|
|
}
|