mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-03-20 17:09:10 +00:00
drivers
switch -> hashtable
This commit is contained in:
parent
1f5b52b439
commit
8d267078ff
18
lib/io.ps1
18
lib/io.ps1
@ -101,6 +101,7 @@ class EqCell : IRemote {
|
|||||||
|
|
||||||
class IODevice : IRemote {
|
class IODevice : IRemote {
|
||||||
[string]$kindOfDevice
|
[string]$kindOfDevice
|
||||||
|
[Hashtable]$drivers
|
||||||
|
|
||||||
IODevice ([int]$index, [Object]$remote, [string]$kindOfDevice) : base ($index, $remote) {
|
IODevice ([int]$index, [Object]$remote, [string]$kindOfDevice) : base ($index, $remote) {
|
||||||
$this.kindOfDevice = $kindOfDevice
|
$this.kindOfDevice = $kindOfDevice
|
||||||
@ -108,6 +109,13 @@ class IODevice : IRemote {
|
|||||||
AddStringMembers -WriteOnly -PARAMS @('wdm', 'ks', 'mme')
|
AddStringMembers -WriteOnly -PARAMS @('wdm', 'ks', 'mme')
|
||||||
AddStringMembers -ReadOnly -PARAMS @('name')
|
AddStringMembers -ReadOnly -PARAMS @('name')
|
||||||
AddIntMembers -ReadOnly -PARAMS @('sr')
|
AddIntMembers -ReadOnly -PARAMS @('sr')
|
||||||
|
|
||||||
|
$this.drivers = @{
|
||||||
|
'1' = 'mme'
|
||||||
|
'4' = 'wdm'
|
||||||
|
'8' = 'ks'
|
||||||
|
'256' = 'asio'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hidden $_driver = $($this | Add-Member ScriptProperty 'driver' `
|
hidden $_driver = $($this | Add-Member ScriptProperty 'driver' `
|
||||||
@ -141,13 +149,9 @@ class IODevice : IRemote {
|
|||||||
$type = $matches['type']
|
$type = $matches['type']
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($type) {
|
if ($null -eq $type) { return 'none' }
|
||||||
'1' { return 'mme' }
|
if ($type -notin $this.drivers.Keys) { return 'unknown' }
|
||||||
'4' { return 'wdm' }
|
return $this.drivers[$type]
|
||||||
'8' { return 'ks' }
|
|
||||||
'256' { return 'asio' }
|
|
||||||
default { return 'none' }
|
|
||||||
}
|
|
||||||
} `
|
} `
|
||||||
{
|
{
|
||||||
Write-Warning ("ERROR: $($this.identifier()).driver is read only")
|
Write-Warning ("ERROR: $($this.identifier()).driver is read only")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user