mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-21 17:30:49 +00:00
Add Midi,Text In/Out Stream classes
define midi,text values for kind.vban in KindMaps
This commit is contained in:
parent
f32bfd5a4d
commit
33635e5f9b
@ -25,11 +25,11 @@ module Voicemeeter
|
||||
def to_s = name.to_s.capitalize
|
||||
end
|
||||
|
||||
basic = KindMap.new(:basic, [2, 1], [1, 1], [4, 4], [0, 0], 0, 80)
|
||||
basic = KindMap.new(:basic, [2, 1], [1, 1], [4, 4, 1, 1], [0, 0], 0, 80)
|
||||
|
||||
banana = KindMap.new(:banana, [3, 2], [3, 2], [8, 8], [6, 8], 22, 80)
|
||||
banana = KindMap.new(:banana, [3, 2], [3, 2], [8, 8, 1, 1], [6, 8], 22, 80)
|
||||
|
||||
potato = KindMap.new(:potato, [5, 3], [5, 3], [8, 8], [10, 8], 34, 80)
|
||||
potato = KindMap.new(:potato, [5, 3], [5, 3], [8, 8, 1, 1], [10, 8], 34, 80)
|
||||
|
||||
KIND_MAPS = [basic, banana, potato].to_h { |kind| [kind.name, kind] }
|
||||
|
||||
|
@ -36,6 +36,15 @@ module Voicemeeter
|
||||
end
|
||||
end
|
||||
|
||||
class VbanAudioInstream < VbanInstream; end
|
||||
# Represents a Vban Audio InStream
|
||||
|
||||
class VbanMidiInstream < VbanInstream; end
|
||||
# Represents a Vban Midi InStream
|
||||
|
||||
class VbanTextInstream < VbanInstream; end
|
||||
# Represents a Vban Text InStream
|
||||
|
||||
class VbanOutstream < VbanStream
|
||||
# Represents a Vban OutStream
|
||||
def initialize(remote, i)
|
||||
@ -48,14 +57,42 @@ module Voicemeeter
|
||||
end
|
||||
end
|
||||
|
||||
class VbanAudioOutstream < VbanOutstream; end
|
||||
# Represents a Vban Audio OutStream
|
||||
|
||||
class VbanMidiOutstream < VbanOutstream; end
|
||||
# Represents a Vban Midi OutStream
|
||||
|
||||
class RequestVbanStream
|
||||
def self.for(remote, i, dir)
|
||||
vban_in, vban_out, midi, _ = remote.kind.vban
|
||||
case dir
|
||||
when :in
|
||||
if i < vban_in
|
||||
VbanAudioInstream.new(remote, i)
|
||||
elsif i < vban_in + midi
|
||||
VbanMidiInstream.new(remote, i)
|
||||
else
|
||||
VbanTextInstream.new(remote, i)
|
||||
end
|
||||
when :out
|
||||
if i < vban_out
|
||||
VbanAudioInstream.new(remote, i)
|
||||
elsif i < vban_out + midi
|
||||
VbanMidiInstream.new(remote, i)
|
||||
end
|
||||
end
|
||||
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) }
|
||||
vban_in, vban_out, midi, text = remote.kind.vban
|
||||
@instream = (0...vban_in + midi + text).map { RequestVbanStream.for(remote, _1, :in) }
|
||||
@outstream = (0...vban_out + midi).map { RequestVbanStream.for(remote, _1, :out) }
|
||||
|
||||
@remote = remote
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user