Class: MusaLCEServer::Live::Track
- Inherits:
-
Object
- Object
- MusaLCEServer::Live::Track
- Defined in:
- lib/live/tracks.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #_update_current_input_routing(value) ⇒ Object
- #_update_current_input_sub_routing(value) ⇒ Object
- #_update_current_output_routing(value) ⇒ Object
- #_update_current_output_sub_routing(value) ⇒ Object
- #_update_has_audio_input(value) ⇒ Object
- #_update_has_audio_output(value) ⇒ Object
- #_update_has_midi_input(value) ⇒ Object
- #_update_has_midi_output(value) ⇒ Object
- #_update_name(value) ⇒ Object
-
#initialize(id, midi_devices, logger:) ⇒ Track
constructor
A new instance of Track.
- #out ⇒ Object
Constructor Details
#initialize(id, midi_devices, logger:) ⇒ Track
Returns a new instance of Track.
6 7 8 9 10 11 12 |
# File 'lib/live/tracks.rb', line 6 def initialize(id, midi_devices, logger:) @id = id @midi_devices = midi_devices @logger = logger @output = Musa::Extension::DynamicProxy::DynamicProxy.new end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/live/tracks.rb', line 14 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/live/tracks.rb', line 14 def name @name end |
Instance Method Details
#_update_current_input_routing(value) ⇒ Object
38 39 40 41 |
# File 'lib/live/tracks.rb', line 38 def _update_current_input_routing(value) @current_input_routing = value _update_current_input_sub_routing(@current_input_sub_routing) end |
#_update_current_input_sub_routing(value) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/live/tracks.rb', line 43 def _update_current_input_sub_routing(value) @current_input_sub_routing = value effective_midi_voice = nil if @has_midi_input device = @midi_devices.find(@current_input_routing) if device channel = /Ch\. (?<channel>\d+)/.match(@current_input_sub_routing)&.[](:channel) effective_midi_voice = device.channels[channel.to_i - 1] if channel @logger.info "track #{@id} assigned new input: device '#{device.name}' #{effective_midi_voice}" end end @output.receiver = effective_midi_voice end |
#_update_current_output_routing(value) ⇒ Object
62 63 64 |
# File 'lib/live/tracks.rb', line 62 def _update_current_output_routing(value); @current_output_routing = value end |
#_update_current_output_sub_routing(value) ⇒ Object
66 67 68 |
# File 'lib/live/tracks.rb', line 66 def _update_current_output_sub_routing(value); @current_output_sub_routing = value end |
#_update_has_audio_input(value) ⇒ Object
31 32 33 |
# File 'lib/live/tracks.rb', line 31 def _update_has_audio_input(value); @has_audio_input = value == 1; end |
#_update_has_audio_output(value) ⇒ Object
34 35 36 |
# File 'lib/live/tracks.rb', line 34 def _update_has_audio_output(value); @has_audio_output = value == 1; end |
#_update_has_midi_input(value) ⇒ Object
25 26 27 |
# File 'lib/live/tracks.rb', line 25 def _update_has_midi_input(value); @has_midi_input = value == 1; end |
#_update_has_midi_output(value) ⇒ Object
28 29 30 |
# File 'lib/live/tracks.rb', line 28 def _update_has_midi_output(value); @has_midi_output = value == 1; end |
#_update_name(value) ⇒ Object
20 21 22 23 |
# File 'lib/live/tracks.rb', line 20 def _update_name(value) @name = value @logger.info "track #{@id} assigned name #{@name}" end |
#out ⇒ Object
16 17 18 |
# File 'lib/live/tracks.rb', line 16 def out @output end |