Class: Live::Track
- Inherits:
-
Object
- Object
- 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.
5 6 7 8 9 10 11 |
# File 'lib/live/tracks.rb', line 5 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.
13 14 15 |
# File 'lib/live/tracks.rb', line 13 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/live/tracks.rb', line 13 def name @name end |
Instance Method Details
#_update_current_input_routing(value) ⇒ Object
37 38 39 40 |
# File 'lib/live/tracks.rb', line 37 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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/live/tracks.rb', line 42 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
61 62 63 |
# File 'lib/live/tracks.rb', line 61 def _update_current_output_routing(value); @current_output_routing = value end |
#_update_current_output_sub_routing(value) ⇒ Object
65 66 67 |
# File 'lib/live/tracks.rb', line 65 def _update_current_output_sub_routing(value); @current_output_sub_routing = value end |
#_update_has_audio_input(value) ⇒ Object
30 31 32 |
# File 'lib/live/tracks.rb', line 30 def _update_has_audio_input(value); @has_audio_input = value == 1; end |
#_update_has_audio_output(value) ⇒ Object
33 34 35 |
# File 'lib/live/tracks.rb', line 33 def _update_has_audio_output(value); @has_audio_output = value == 1; end |
#_update_has_midi_input(value) ⇒ Object
24 25 26 |
# File 'lib/live/tracks.rb', line 24 def _update_has_midi_input(value); @has_midi_input = value == 1; end |
#_update_has_midi_output(value) ⇒ Object
27 28 29 |
# File 'lib/live/tracks.rb', line 27 def _update_has_midi_output(value); @has_midi_output = value == 1; end |
#_update_name(value) ⇒ Object
19 20 21 22 |
# File 'lib/live/tracks.rb', line 19 def _update_name(value) @name = value @logger.info "track #{@id} assigned name #{@name}" end |
#out ⇒ Object
15 16 17 |
# File 'lib/live/tracks.rb', line 15 def out @output end |