mirror of
				https://github.com/onyx-and-iris/voicemeeter-rb.git
				synced 2025-10-31 20:31:47 +00:00 
			
		
		
		
	higher classes bus, button, strip and vban modules
bus, strip are not fully implemented yet
This commit is contained in:
		
							parent
							
								
									0679959ae1
								
							
						
					
					
						commit
						941c3339d8
					
				
							
								
								
									
										24
									
								
								lib/voicemeeter/bus.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								lib/voicemeeter/bus.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | require_relative "iremote" | ||||||
|  | require_relative "kinds" | ||||||
|  | 
 | ||||||
|  | module Voicemeeter | ||||||
|  |   module Bus | ||||||
|  |     class Bus < IRemote | ||||||
|  |       def self.make(remote, i) | ||||||
|  |         " | ||||||
|  |         Factory function for Bus classes. | ||||||
|  | 
 | ||||||
|  |         Returns a PhysicalBus or VirtualBus class | ||||||
|  |         " | ||||||
|  |         p_out, v_out = remote.kind.outs | ||||||
|  |         i < p_out ? PhysicalBus.new(remote, i) : VirtualBus.new(remote, i) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class PhysicalBus < Bus | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class VirtualBus < Bus | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										50
									
								
								lib/voicemeeter/button.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								lib/voicemeeter/button.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | require_relative "iremote" | ||||||
|  | require_relative "meta" | ||||||
|  | 
 | ||||||
|  | module Voicemeeter | ||||||
|  |   module Button | ||||||
|  |     module ButtonEnum | ||||||
|  |       STATE = 1 | ||||||
|  |       STATEONLY = 2 | ||||||
|  |       TRIGGER = 3 | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class MacroButton < IRemote | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def getter(mode) | ||||||
|  |         @remote.get_buttonstatus(@index, mode) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def setter(set, mode) | ||||||
|  |         @remote.set_buttonstatus(@index, set, mode) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def state | ||||||
|  |         getter(ButtonEnum::STATE) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def state=(value) | ||||||
|  |         setter(ButtonEnum::STATE, value && 1 || 0) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def stateonly | ||||||
|  |         getter(ButtonEnum::STATEONLY) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def stateonly=(value) | ||||||
|  |         setter(ButtonEnum::STATEONLY, value && 1 || 0) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def trigger | ||||||
|  |         getter(ButtonEnum::TRIGGER) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def trigger=(value) | ||||||
|  |         setter(ButtonEnum::TRIGGER, value && 1 || 0) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										162
									
								
								lib/voicemeeter/strip.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								lib/voicemeeter/strip.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,162 @@ | |||||||
|  | require_relative "iremote" | ||||||
|  | require_relative "kinds" | ||||||
|  | require_relative "meta" | ||||||
|  | require_relative "mixins" | ||||||
|  | 
 | ||||||
|  | module Voicemeeter | ||||||
|  |   module Strip | ||||||
|  |     class Strip < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def self.make(remote, i) | ||||||
|  |         " | ||||||
|  |         Factory function for Strip classes. | ||||||
|  | 
 | ||||||
|  |         Returns a PhysicalStrip or VirtualStrip class | ||||||
|  |         " | ||||||
|  |         p_in, v_in = remote.kind.ins | ||||||
|  |         i < p_in ? PhysicalStrip.new(remote, i) : VirtualStrip.new(remote, i) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_bool :solo, :mute, :mono | ||||||
|  |         make_accessor_float :gain | ||||||
|  |         make_accessor_int :limit | ||||||
|  |         make_accessor_string :label | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}]" | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class PhysicalStrip < Strip | ||||||
|  |       include Mixins::StripMixins::Xy::Pan | ||||||
|  |       include Mixins::StripMixins::Xy::Color | ||||||
|  |       include Mixins::StripMixins::Xy::Fx | ||||||
|  |       include Mixins::StripMixins::Fx | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_float :audibility | ||||||
|  | 
 | ||||||
|  |         @comp = StripComp.new(remote, i) | ||||||
|  |         @gate = StripGate.new(remote, i) | ||||||
|  |         @denoiser = StripDenoiser.new(remote, i) | ||||||
|  |         @eq = StripEq.new(remote, i) | ||||||
|  |         @device = StripDevice.new(remote, i) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class StripComp < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_float :gainin, | ||||||
|  |                             :ratio, | ||||||
|  |                             :threshold, | ||||||
|  |                             :attack, | ||||||
|  |                             :release, | ||||||
|  |                             :knee, | ||||||
|  |                             :gainout | ||||||
|  |         make_accessor_bool :makeup | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}].comp" | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob | ||||||
|  |         getter("").to_i == 1 | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob=(val) | ||||||
|  |         setter("", val && 1 || 0) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class StripGate < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_float :threshold, :damping, :attack, :hold, :release | ||||||
|  |         make_accessor_int :bpsidechain | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}].gate" | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob | ||||||
|  |         getter("").to_i == 1 | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob=(val) | ||||||
|  |         setter("", val && 1 || 0) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class StripDenoiser < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}].denoiser" | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob | ||||||
|  |         getter("").to_i == 1 | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def knob=(val) | ||||||
|  |         setter("", val && 1 || 0) | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class StripEq < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_bool :on, :ab | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}].device" | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class StripDevice < IRemote | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_reader_int :sr | ||||||
|  |         make_reader_string :name | ||||||
|  |         make_writer_string :wdm, :ks, :mme, :asio | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def identifier | ||||||
|  |         "strip[#{@index}].device" | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class VirtualStrip < Strip | ||||||
|  |       include Mixins::StripMixins::Xy::Pan | ||||||
|  |       include Mixins::StripMixins::Apps | ||||||
|  | 
 | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_bool :mc | ||||||
|  |         make_accessor_int :k | ||||||
|  |         make_accessor_float :bass, :mid, :treble | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										86
									
								
								lib/voicemeeter/vban.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								lib/voicemeeter/vban.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,86 @@ | |||||||
|  | require_relative "iremote" | ||||||
|  | require_relative "meta" | ||||||
|  | require_relative "errors" | ||||||
|  | 
 | ||||||
|  | module Voicemeeter | ||||||
|  |   module Vban | ||||||
|  |     class VbanStream < IRemote | ||||||
|  |       " | ||||||
|  |       A class representing a VBAN stream | ||||||
|  |       " | ||||||
|  |       include Meta_Functions | ||||||
|  | 
 | ||||||
|  |       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 mehod: direction" | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class VbanInstream < VbanStream | ||||||
|  |       " | ||||||
|  |       A subclass representing a VBAN Instream | ||||||
|  |       " | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_reader_int :sr, :channel, :bit | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def direction | ||||||
|  |         :in | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class VbanOutstream < VbanStream | ||||||
|  |       " | ||||||
|  |       A subclass representing a VBAN Outstream | ||||||
|  |       " | ||||||
|  |       def initialize(remote, i) | ||||||
|  |         super | ||||||
|  |         make_accessor_int :sr, :channel, :bit | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def direction | ||||||
|  |         :out | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     class Vban | ||||||
|  |       attr_accessor :instream, :outstream | ||||||
|  | 
 | ||||||
|  |       def initialize(remote) | ||||||
|  |         " | ||||||
|  |         Initializes a Vban class | ||||||
|  | 
 | ||||||
|  |         Creates an array for each in/out stream and sets as class attributes | ||||||
|  |         " | ||||||
|  |         vban_in, vban_out = remote.kind.vban | ||||||
|  |         @instream = [] | ||||||
|  |         vban_in.times { |i| @instream << VbanInstream.new(remote, i) } | ||||||
|  |         @outstream = [] | ||||||
|  |         vban_out.times { |i| @outstream << VbanOutstream.new(remote, i) } | ||||||
|  | 
 | ||||||
|  |         @remote = remote | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       #stree-ignore | ||||||
|  |       def enable | ||||||
|  |         @remote.set("vban.enable", 1) | ||||||
|  |         end | ||||||
|  | 
 | ||||||
|  |       #stree-ignore | ||||||
|  |       def disable | ||||||
|  |         @remote.set("vban.enable", 0) | ||||||
|  |         end | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user