Class: NuWav::MextChunk

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

#ancillary_data_defObject

Returns the value of attribute ancillary_data_def.



148
149
150
# File 'lib/nu_wav/chunk.rb', line 148

def ancillary_data_def
  @ancillary_data_def
end

#ancillary_data_lengthObject

Returns the value of attribute ancillary_data_length.



148
149
150
# File 'lib/nu_wav/chunk.rb', line 148

def ancillary_data_length
  @ancillary_data_length
end

#frame_sizeObject

Returns the value of attribute frame_size.



148
149
150
# File 'lib/nu_wav/chunk.rb', line 148

def frame_size
  @frame_size
end

#reservedObject

Returns the value of attribute reserved.



148
149
150
# File 'lib/nu_wav/chunk.rb', line 148

def reserved
  @reserved
end

#sound_informationObject

Returns the value of attribute sound_information.



148
149
150
# File 'lib/nu_wav/chunk.rb', line 148

def sound_information
  @sound_information
end

Instance Method Details

#parseObject



150
151
152
153
154
155
156
# File 'lib/nu_wav/chunk.rb', line 150

def parse
  @sound_information =      read_word(0)
  @frame_size =             read_word(2)
  @ancillary_data_length =  read_word(4)
  @ancillary_data_def =     read_word(6)
  @reserved =               read_char(8,4)
end

#to_binary(options = {}) ⇒ Object



162
163
164
165
166
167
168
169
170
# File 'lib/nu_wav/chunk.rb', line 162

def to_binary(options={})
  out = "mext" + write_dword(12)
  out += write_word(@sound_information)
  out += write_word(@frame_size)
  out += write_word(@ancillary_data_length)
  out += write_word(@ancillary_data_def)
  out += write_char(@reserved, 4)
  out
end

#to_sObject



158
159
160
# File 'lib/nu_wav/chunk.rb', line 158

def to_s
  "<chunk type:mext sound_information:(#{sound_information}) #{(0..15).inject(''){|s,x| "#{s}#{sound_information[x]}"}}, frame_size:#{frame_size}, ancillary_data_length:#{ancillary_data_length}, ancillary_data_def:#{(0..15).inject(''){|s,x| "#{s}#{ancillary_data_def[x]}"}}, reserved:'#{reserved}' />"
end