mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 13:20:47 +00:00
onyx-and-iris
1397c14522
made some rearrangements to the dot sourcing ButtonTypes enum added to macrobuttons.ps1 login string now includes version number Test-RegistryValue added to inst.ps1
66 lines
1.6 KiB
PowerShell
66 lines
1.6 KiB
PowerShell
enum ButtonTypes {
|
|
State = 1
|
|
StateOnly = 2
|
|
Trigger = 3
|
|
}
|
|
|
|
class MacroButton {
|
|
[int32]$index
|
|
|
|
MacroButton ([int]$index) {
|
|
$this.index = $index
|
|
}
|
|
|
|
[string] ToString() {
|
|
return $this.GetType().Name + $this.index
|
|
}
|
|
|
|
[int] Getter ($mode) {
|
|
"Button[$($this.index)].$([ButtonTypes].GetEnumName($mode))" | Write-Debug
|
|
return MB_Get -Id $this.index -Mode $mode
|
|
}
|
|
|
|
[void] Setter ($val, $mode) {
|
|
"Button[$($this.index)].$([ButtonTypes].GetEnumName($mode))=$val" | Write-Debug
|
|
MB_Set -Id $this.index -SET $val -Mode $mode
|
|
}
|
|
|
|
hidden $_state = $($this | Add-Member ScriptProperty 'state' `
|
|
{
|
|
[bool]$this.Getter([ButtonTypes]::State)
|
|
} `
|
|
{
|
|
param($arg)
|
|
$this._state = $this.Setter($arg, [ButtonTypes]::State)
|
|
}
|
|
)
|
|
|
|
hidden $_stateonly = $($this | Add-Member ScriptProperty 'stateonly' `
|
|
{
|
|
[bool]$this.Getter([ButtonTypes]::StateOnly)
|
|
} `
|
|
{
|
|
param($arg)
|
|
$this._stateonly = $this.Setter($arg, [ButtonTypes]::StateOnly)
|
|
}
|
|
)
|
|
|
|
hidden $_trigger = $($this | Add-Member ScriptProperty 'trigger' `
|
|
{
|
|
[bool]$this.Getter([ButtonTypes]::Trigger)
|
|
} `
|
|
{
|
|
param($arg)
|
|
$this._trigger = $this.Setter($arg, [ButtonTypes]::Trigger)
|
|
}
|
|
)
|
|
}
|
|
|
|
function Make_Buttons {
|
|
[System.Collections.ArrayList]$button = @()
|
|
0..79 | ForEach-Object {
|
|
[void]$button.Add([MacroButton]::new($_))
|
|
}
|
|
$button
|
|
}
|