Class: NuWav::BextChunk

Inherits:
Chunk
  • Object
show all
Defined in:
lib/nu_wav/chunk.rb

Instance Attribute Summary collapse

Attributes inherited from Chunk

#id, #pad_byte, #raw, #size

Instance Method Summary collapse

Methods inherited from Chunk

#initialize, parse, #read_char, #read_dword, #read_word, #write_char, #write_dword, #write_word

Constructor Details

This class inherits a constructor from NuWav::Chunk

Instance Attribute Details

#coding_historyObject

Returns the value of attribute coding_history.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def coding_history
  @coding_history
end

#descriptionObject

Returns the value of attribute description.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def description
  @description
end

#origination_dateObject

Returns the value of attribute origination_date.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def origination_date
  @origination_date
end

#origination_timeObject

Returns the value of attribute origination_time.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def origination_time
  @origination_time
end

#originatorObject

Returns the value of attribute originator.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def originator
  @originator
end

#originator_referenceObject

Returns the value of attribute originator_reference.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def originator_reference
  @originator_reference
end

#reservedObject

Returns the value of attribute reserved.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def reserved
  @reserved
end

#time_reference_highObject

Returns the value of attribute time_reference_high.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def time_reference_high
  @time_reference_high
end

#time_reference_lowObject

Returns the value of attribute time_reference_low.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def time_reference_low
  @time_reference_low
end

#umidObject

Returns the value of attribute umid.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def umid
  @umid
end

#versionObject

Returns the value of attribute version.



174
175
176
# File 'lib/nu_wav/chunk.rb', line 174

def version
  @version
end

Instance Method Details

#parseObject



177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/nu_wav/chunk.rb', line 177

def parse
  @description =            read_char(0,256)
  @originator =             read_char(256,32)
  @originator_reference =   read_char(288,32)
  @origination_date =       read_char(320,10)
  @origination_time =       read_char(330,8)
  @time_reference_low =     read_dword(338)
  @time_reference_high =    read_dword(342)
  @version =                read_word(346)
  @umid =                   read_char(348,64)
  @reserved =               read_char(412,190)
  @coding_history =         read_char(602)
end

#to_binary(options = {}) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/nu_wav/chunk.rb', line 195

def to_binary(options={})
  out = "bext" + write_dword(602 + @coding_history.length )
  out += write_char(@description, 256)
  out += write_char(@originator, 32)
  out += write_char(@originator_reference, 32)
  out += write_char(@origination_date, 10)
  out += write_char(@origination_time, 8)
  out += write_dword(@time_reference_low)
  out += write_dword(@time_reference_high)
  out += write_word(@version)
  out += write_char(@umid, 64)
  out += write_char(@reserved, 190)
  out += write_char(@coding_history)
  # make sure coding history ends in '\r\n'
  out
end

#to_sObject



191
192
193
# File 'lib/nu_wav/chunk.rb', line 191

def to_s
  "<chunk type:bext description:'#{description}', originator:'#{originator}', originator_reference:'#{originator_reference}', origination_date:'#{origination_date}', origination_time:'#{origination_time}', time_reference_low:#{time_reference_low}, time_reference_high:#{time_reference_high}, version:#{version}, umid:#{umid}, reserved:'#{reserved}', coding_history:#{coding_history} />"
end