Class: LiveAudioTrack
- Inherits:
-
Object
- Object
- LiveAudioTrack
- Defined in:
- lib/live_set/live_set_audio_track.rb
Instance Attribute Summary collapse
-
#audio_clips ⇒ Object
readonly
Returns the value of attribute audio_clips.
-
#clip_slots ⇒ Object
readonly
Returns the value of attribute clip_slots.
-
#frozen ⇒ Object
readonly
Returns the value of attribute frozen.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#track_size ⇒ Object
readonly
Returns the value of attribute track_size.
Instance Method Summary collapse
- #clips_collected? ⇒ Boolean
-
#initialize(audio_track) ⇒ LiveAudioTrack
constructor
A new instance of LiveAudioTrack.
- #show_clips ⇒ Object
- #show_track(all_frozen) ⇒ Object
Constructor Details
#initialize(audio_track) ⇒ LiveAudioTrack
Returns a new instance of LiveAudioTrack.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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
#audio_clips ⇒ Object (readonly)
Returns the value of attribute audio_clips.
2 3 4 |
# File 'lib/live_set/live_set_audio_track.rb', line 2 def audio_clips @audio_clips end |
#clip_slots ⇒ Object (readonly)
Returns the value of attribute clip_slots.
2 3 4 |
# File 'lib/live_set/live_set_audio_track.rb', line 2 def clip_slots @clip_slots end |
#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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/live_set/live_set_audio_track.rb', line 2 def id @id 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
#clips_collected? ⇒ Boolean
23 24 25 |
# File 'lib/live_set/live_set_audio_track.rb', line 23 def clips_collected? @audio_clips.all?(&:collected?) end |
#show_clips ⇒ Object
34 35 36 37 38 39 |
# File 'lib/live_set/live_set_audio_track.rb', line 34 def show_clips return '' if @track_size.zero? result = @audio_clips.map(&:show_clip) result.columnize ' ' end |
#show_track(all_frozen) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/live_set/live_set_audio_track.rb', line 27 def show_track(all_frozen) name = @audio_track.Name.EffectiveName['Value'] frozen = @audio_track.frozen? ? ' frozen'.green : ' **not frozen**'.red unless all_frozen || @audio_clips.empty? size = ", totaling #{human_file_size @track_size}" unless @audio_clips.empty? "Track '#{name}'#{frozen} (#{@audio_clips.length} clips#{size})\n" + show_clips end |