mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2025-01-18 05:10:48 +00:00
add special commands
Added special commands: show restart showvbanchat shutdown Updated README and CHANGELOG to reflect changes. Minor version bump
This commit is contained in:
parent
da9a71188c
commit
a7913f8934
12
CHANGELOG.md
12
CHANGELOG.md
@ -9,6 +9,18 @@ Before any minor/major patch is released all test units will be run to verify th
|
||||
## [Unreleased]
|
||||
- [x]
|
||||
|
||||
|
||||
|
||||
## [1.8] - 2021-08-23
|
||||
### Added
|
||||
- Added special commands
|
||||
|
||||
### Changed
|
||||
- Add special section to README
|
||||
|
||||
### Fixed
|
||||
- Removed unneeded console output
|
||||
|
||||
## [1.6] - 2021-06-06
|
||||
### Added
|
||||
- Add vban commands
|
||||
|
@ -145,6 +145,15 @@ $vmr.vban_in[2].port = 6990
|
||||
$vmr.vban_out[3].bit = 16
|
||||
```
|
||||
|
||||
### Special
|
||||
Certain 'special' commands are defined by the API as performing actions rather than setting values. You may invoke them with the following commands:
|
||||
```powershell
|
||||
$vmr.command.show
|
||||
$vmr.command.restart
|
||||
$vmr.command.showvbanchat
|
||||
$vmr.command.shutdown
|
||||
```
|
||||
|
||||
### Run tests
|
||||
Run tests using .\runall.ps1 which accepts two parameters:
|
||||
- tag Run tests of this type
|
||||
|
10
examples/special.ps1
Normal file
10
examples/special.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
Import-Module Voicemeeter
|
||||
|
||||
try {
|
||||
$vmr = Get-RemoteBanana
|
||||
|
||||
$vmr.command.show
|
||||
$vmr.command.restart
|
||||
$vmr.command.showvbanchat
|
||||
}
|
||||
finally { $vmr.Logout() }
|
@ -7,6 +7,7 @@ class Remote {
|
||||
[System.Collections.ArrayList]$bus
|
||||
[System.Collections.ArrayList]$vban_in
|
||||
[System.Collections.ArrayList]$vban_out
|
||||
$command
|
||||
|
||||
# Constructor
|
||||
Remote ([String]$type)
|
||||
@ -24,6 +25,7 @@ class Remote {
|
||||
$this.bus = Buses
|
||||
$this.vban_in = Vban_In
|
||||
$this.vban_out = Vban_Out
|
||||
$this.command = Special
|
||||
}
|
||||
else { Exit }
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
. $PSScriptRoot\bus.ps1
|
||||
. $PSScriptRoot\macrobuttons.ps1
|
||||
. $PSScriptRoot\vban.ps1
|
||||
. $PSScriptRoot\special.ps1
|
||||
|
||||
$global:layout = $null
|
||||
|
||||
|
49
lib/special.ps1
Normal file
49
lib/special.ps1
Normal file
@ -0,0 +1,49 @@
|
||||
class Special {
|
||||
hidden AddPublicMembers($commands) {
|
||||
$commands | ForEach-Object {
|
||||
# Define getter
|
||||
# $GetterSignature = "`$this.Getter(`$this.cmd('{0}'))" -f $_
|
||||
# Define setter
|
||||
$SetterSignature = "`$this.Setter(`$this.cmd('{0}'))" -f $_
|
||||
|
||||
$AddMemberParams = @{
|
||||
Name = $_
|
||||
MemberType = 'ScriptProperty'
|
||||
Value = [ScriptBlock]::Create($SetterSignature)
|
||||
SecondValue = [ScriptBlock]::Create($SetterSignature)
|
||||
}
|
||||
$this | Add-Member @AddMemberParams
|
||||
}
|
||||
}
|
||||
|
||||
# Constructor
|
||||
Special()
|
||||
{
|
||||
$this.AddPublicMembers(@('restart', 'shutdown', 'show'))
|
||||
}
|
||||
|
||||
[String] Getter($param) {
|
||||
return Write-Warning("ERROR: " + $param + " is a write only parameter")
|
||||
}
|
||||
|
||||
[void] Setter($param) {
|
||||
Param_Set -PARAM $param -VALUE 1
|
||||
}
|
||||
|
||||
[String] cmd ($arg) {
|
||||
return "Command.$arg"
|
||||
}
|
||||
|
||||
hidden $_showvbanchat = $($this | Add-Member ScriptProperty 'showvbanchat' `
|
||||
{
|
||||
$this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'))
|
||||
}`
|
||||
{
|
||||
$this._showvbanchat = $this.Setter($this.cmd('DialogShow.VBANCHAT'))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Function Special {
|
||||
return [Special]::new()
|
||||
}
|
Loading…
Reference in New Issue
Block a user