Class: LiveAudioTrack
- Inherits:
-
Object
- Object
- LiveAudioTrack
- Defined in:
- lib/live_set/live_set_audio_track.rb
Instance Attribute Summary collapse
-
#frozen ⇒ Object
readonly
Returns the value of attribute frozen.
-
#track_size ⇒ Object
readonly
Returns the value of attribute track_size.
Instance Method Summary collapse
-
#initialize(audio_track) ⇒ LiveAudioTrack
constructor
A new instance of LiveAudioTrack.
- #show_clips ⇒ Object
- #show_track(all_frozen) ⇒ Object
Constructor Details
#initialize(audio_track) ⇒ LiveAudioTrack
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/live_set/live_set_audio_track.rb', line 5 def initialize(audio_track) @audio_track = audio_track @id = @audio_track['Id'] @frozen = @audio_track.Freeze['Value'].to_bool @clip_slots = @audio_track.DeviceChain.MainSequencer.ClipSlotList @audio_clips = @clip_slots.ClipSlot.map do |clip_slot| clip_slot_id = clip_slot['Id'] need_refreeze = clip_slot.NeedRefreeze['Value'].to_bool inner_clip_slot = clip_slot.ClipSlot LiveAudioClip.new clip_slot_id, need_refreeze, inner_clip_slot if inner_clip_slot.respond_to?(:Value) && !inner_clip_slot.Value.children.empty? end @audio_clips.compact! @track_size = @audio_clips.sum(&:file_size) || 0 end |
Instance Attribute Details
#frozen ⇒ Object (readonly)
Returns the value of attribute frozen.
2 3 4 |
# File 'lib/live_set/live_set_audio_track.rb', line 2 def frozen @frozen end |
#track_size ⇒ Object (readonly)
Returns the value of attribute track_size.
2 3 4 |
# File 'lib/live_set/live_set_audio_track.rb', line 2 def track_size @track_size end |
Instance Method Details
#show_clips ⇒ Object
28 29 30 31 32 33 |
# File 'lib/live_set/live_set_audio_track.rb', line 28 def show_clips return '' if @track_size.zero? result = @audio_clips.map(&:show_clip) result.columnize ' ' end |
#show_track(all_frozen) ⇒ Object
22 23 24 25 26 |
# File 'lib/live_set/live_set_audio_track.rb', line 22 def show_track(all_frozen) name = @audio_track.Name.EffectiveName['Value'] frozen = !all_frozen && @audio_track.frozen? ? ' **frozen**' : '' "Track '#{name}'#{frozen} (#{@audio_clips.length} clips, totaling #{human_file_size @track_size})\n" + show_clips end |