2022-03-08 22:54:34 +00:00
|
|
|
. $PSScriptRoot\meta.ps1
|
|
|
|
|
2023-08-12 01:40:29 +01:00
|
|
|
class IRecorder {
|
2022-06-25 23:12:02 +01:00
|
|
|
[Object]$remote
|
2022-12-17 17:47:42 +00:00
|
|
|
|
2023-08-12 01:40:29 +01:00
|
|
|
IRecorder ([Object]$remote) {
|
2022-06-25 23:12:02 +01:00
|
|
|
$this.remote = $remote
|
2022-10-27 21:20:03 +01:00
|
|
|
}
|
|
|
|
|
2022-12-16 17:29:04 +00:00
|
|
|
[single] Getter ($param) {
|
2023-08-12 03:09:23 +01:00
|
|
|
return $this.remote.Getter("$($this.identifier()).$param")
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] Setter ($param, $val) {
|
2022-03-08 22:54:34 +00:00
|
|
|
if ($val -is [Boolean]) {
|
2023-08-12 03:09:23 +01:00
|
|
|
$this.remote.Setter("$($this.identifier()).$param", $(if ($val) { 1 } else { 0 }))
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
|
|
|
else {
|
2023-08-12 03:09:23 +01:00
|
|
|
$this.remote.Setter("$($this.identifier()).$param", $val)
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
2023-08-12 01:40:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Recorder : IRecorder {
|
|
|
|
[Object]$remote
|
|
|
|
[Object]$mode
|
|
|
|
|
|
|
|
Recorder ([Object]$remote) : base ($remote) {
|
|
|
|
$this.remote = $remote
|
|
|
|
$this.mode = [RecorderMode]::new($remote)
|
|
|
|
|
|
|
|
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
|
|
|
|
AddChannelMembers
|
|
|
|
}
|
|
|
|
|
|
|
|
[string] identifier () {
|
|
|
|
return "Recorder"
|
|
|
|
}
|
|
|
|
|
|
|
|
[string] ToString() {
|
|
|
|
return $this.GetType().Name
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hidden $_loop = $($this | Add-Member ScriptProperty 'loop' `
|
|
|
|
{
|
2023-08-12 01:40:29 +01:00
|
|
|
[bool]$this.mode.loop
|
2022-10-27 21:20:03 +01:00
|
|
|
} `
|
2022-03-08 22:54:34 +00:00
|
|
|
{
|
2023-08-12 01:40:29 +01:00
|
|
|
param($arg)
|
|
|
|
$this.mode.loop = $arg
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
[void] Load ([string]$filename) {
|
2022-12-16 17:29:04 +00:00
|
|
|
$this.Setter('load', $filename)
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-12 01:40:29 +01:00
|
|
|
class RecorderMode : IRecorder {
|
|
|
|
RecorderMode ([Object]$remote) : base ($remote) {
|
|
|
|
AddBoolMembers -PARAMS @('loop')
|
|
|
|
}
|
|
|
|
|
|
|
|
[string] identifier () {
|
|
|
|
return "Recorder.Mode"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-27 21:20:03 +01:00
|
|
|
function Make_Recorder ([Object]$remote) {
|
2022-06-25 23:12:02 +01:00
|
|
|
return [Recorder]::new($remote)
|
2022-03-08 22:54:34 +00:00
|
|
|
}
|