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