2023-07-14 16:12:18 +01:00
|
|
|
module Voicemeeter
|
|
|
|
module Recorder
|
|
|
|
module FileTypeEnum
|
|
|
|
WAV = 1
|
|
|
|
AIFF = 2
|
|
|
|
BWF = 3
|
|
|
|
MP3 = 100
|
|
|
|
end
|
|
|
|
|
2023-08-29 14:07:52 +01:00
|
|
|
# Base class for Recorder
|
2023-07-27 10:58:26 +01:00
|
|
|
class Base
|
|
|
|
include IRemote
|
2023-07-14 16:12:18 +01:00
|
|
|
include Mixins::Outputs
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-14 16:12:18 +01:00
|
|
|
|
|
|
|
attr_reader :mode, :armstrip, :armbus
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_action_method :play, :stop, :pause, :replay, :record, :ff, :rew
|
|
|
|
attr_accessor_int :bitresolution, :channel, :kbps
|
|
|
|
attr_accessor_float :gain
|
2023-07-14 16:12:18 +01:00
|
|
|
|
|
|
|
def initialize(remote)
|
|
|
|
super
|
2023-08-30 12:27:50 +01:00
|
|
|
make_attr_outputs(*remote.kind.outs)
|
2023-07-16 22:33:21 +01:00
|
|
|
@mode = RecorderMode.new(remote)
|
2023-07-22 13:05:38 +01:00
|
|
|
@armstrip = (0...remote.kind.num_strip).map { RecorderArmStrip.new(remote, _1) }
|
|
|
|
@armbus = (0...remote.kind.num_bus).map { RecorderArmBus.new(remote, _1) }
|
2023-07-14 16:12:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def identifier
|
|
|
|
:recorder
|
|
|
|
end
|
|
|
|
|
|
|
|
def load(filepath)
|
|
|
|
setter("load", filepath)
|
|
|
|
end
|
|
|
|
|
|
|
|
def goto(timestr)
|
2023-07-22 16:44:24 +01:00
|
|
|
unless /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/.match?(timestr)
|
2023-08-01 23:41:23 +01:00
|
|
|
logger.error "goto got: '#{timestr}', but expects a time string in the format 'hh:mm:ss'"
|
2023-07-14 16:12:18 +01:00
|
|
|
return
|
|
|
|
end
|
|
|
|
dt = DateTime.parse(timestr)
|
|
|
|
seconds = dt.hour * 3600 + dt.min * 60 + dt.second
|
|
|
|
setter("goto", seconds)
|
|
|
|
end
|
|
|
|
|
|
|
|
def filetype(val)
|
|
|
|
opts = {wav: FileTypeEnum::WAV, aiff: FileTypeEnum::AIFF, bwf: FileTypeEnum::BWF, mp3: FileTypeEnum::MP3}
|
|
|
|
setter("filetype", opts[val])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class RecorderMode
|
|
|
|
include IRemote
|
2023-08-30 12:27:50 +01:00
|
|
|
extend MetaFunctions
|
2023-07-27 10:58:26 +01:00
|
|
|
|
2023-08-30 12:27:50 +01:00
|
|
|
attr_accessor_bool :recbus, :playonload, :loop, :multitrack
|
2023-07-14 16:12:18 +01:00
|
|
|
|
|
|
|
def identifier
|
|
|
|
"recorder.mode"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-27 10:58:26 +01:00
|
|
|
class RecorderArmChannel
|
|
|
|
include IRemote
|
|
|
|
|
2023-07-16 22:33:21 +01:00
|
|
|
def initialize(remote, j)
|
|
|
|
super(remote)
|
|
|
|
@j = j
|
|
|
|
end
|
2023-07-14 16:12:18 +01:00
|
|
|
|
2023-07-16 22:33:21 +01:00
|
|
|
def set
|
|
|
|
setter("", val && 1 || 0)
|
|
|
|
end
|
2023-07-14 16:12:18 +01:00
|
|
|
end
|
|
|
|
|
2023-07-16 22:33:21 +01:00
|
|
|
class RecorderArmStrip < RecorderArmChannel
|
|
|
|
def identifier
|
|
|
|
"recorder.armstrip[#{@j}]"
|
|
|
|
end
|
2023-07-14 16:12:18 +01:00
|
|
|
end
|
|
|
|
|
2023-07-16 22:33:21 +01:00
|
|
|
class RecorderArmBus < RecorderArmChannel
|
|
|
|
def identifier
|
|
|
|
"recorder.armbus[#{@j}]"
|
|
|
|
end
|
2023-07-14 16:12:18 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|