Class: LiveAudioClip

Inherits:
Object
  • Object
show all
Defined in:
lib/live_set/live_set_audio_clip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, need_refreeze, clip_slot) ⇒ LiveAudioClip

Returns a new instance of LiveAudioClip.

Parameters:

  • audio_clip

    is an inner <ClipSlot/> element from an Ableton Live .als file as parsed by Nokogiri



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/live_set/live_set_audio_clip.rb', line 7

def initialize(id, need_refreeze, clip_slot)
  @id                 = id
  @need_refreeze      = need_refreeze

  @audio_clip         = clip_slot.Value.AudioClip
  @file_ref           = @audio_clip.SampleRef.FileRef
  @last_modified      = Time.at(@audio_clip.SampleRef.LastModDate['Value'].to_i).utc.to_datetime

  @absolute_path      = @file_ref.Path['Value']
  @file_size          = @file_ref.OriginalFileSize['Value'].to_i
  @file_type          = @file_ref.Type['Value'] # What do these values mean?
  @live_pack_name     = @file_ref.LivePackName['Value']
  @relative_path      = @file_ref.RelativePath['Value']
  @relative_path_type = @file_ref.RelativePathType['Value'] # What do these values mean?
end

Instance Attribute Details

#file_sizeObject (readonly)

Returns the value of attribute file_size.



4
5
6
# File 'lib/live_set/live_set_audio_clip.rb', line 4

def file_size
  @file_size
end

Instance Method Details

#show_clipObject



23
24
25
# File 'lib/live_set/live_set_audio_clip.rb', line 23

def show_clip
  ["    #{@relative_path}", human_file_size(@file_size).rjust(8, ' '), @last_modified.strftime('%Y-%m-%d %H:%M:%S')]
end