mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
73 lines
1.4 KiB
Ruby
73 lines
1.4 KiB
Ruby
require_relative "iremote"
|
|
require_relative "meta"
|
|
require_relative "errors"
|
|
|
|
module Voicemeeter
|
|
module Vban
|
|
class VbanStream
|
|
# Base class for Vban Stream types
|
|
include IRemote
|
|
|
|
def initialize(remote, i)
|
|
super
|
|
make_accessor_bool :on
|
|
make_accessor_string :name, :ip
|
|
make_accessor_int :quality, :route
|
|
end
|
|
|
|
def identifier
|
|
"vban.#{direction}stream[#{@index}]"
|
|
end
|
|
|
|
def direction
|
|
raise "Called abstract method: direction"
|
|
end
|
|
end
|
|
|
|
class VbanInstream < VbanStream
|
|
# Represents a Vban InStream
|
|
def initialize(remote, i)
|
|
super
|
|
make_reader_int :sr, :channel, :bit
|
|
end
|
|
|
|
def direction
|
|
:in
|
|
end
|
|
end
|
|
|
|
class VbanOutstream < VbanStream
|
|
# Represents a Vban OutStream
|
|
def initialize(remote, i)
|
|
super
|
|
make_accessor_int :sr, :channel, :bit
|
|
end
|
|
|
|
def direction
|
|
:out
|
|
end
|
|
end
|
|
|
|
class Base
|
|
# Base class for Vban type
|
|
attr_reader :instream, :outstream
|
|
|
|
def initialize(remote)
|
|
vban_in, vban_out = remote.kind.vban
|
|
@instream = (0...vban_in).map { VbanInstream.new(remote, _1) }
|
|
@outstream = (0...vban_out).map { VbanOutstream.new(remote, _1) }
|
|
|
|
@remote = remote
|
|
end
|
|
|
|
def enable
|
|
@remote.set("vban.enable", 1)
|
|
end
|
|
|
|
def disable
|
|
@remote.set("vban.enable", 0)
|
|
end
|
|
end
|
|
end
|
|
end
|