class NuWav::FmtChunk
Attributes
block_align[RW]
byte_rate[RW]
compression_code[RW]
extra[RW]
extra_size[RW]
head_bit_rate[RW]
head_emphasis[RW]
head_flags[RW]
head_layer[RW]
head_mode[RW]
head_mode_ext[RW]
number_of_channels[RW]
pts_high[RW]
pts_low[RW]
sample_bits[RW]
sample_rate[RW]
Public Instance Methods
parse()
click to toggle source
# File lib/nu_wav/chunk.rb, line 75 def parse NuWav::WaveFile.log "@raw.size = #{@raw.size}" @compression_code = read_word(0) @number_of_channels = read_word(2) @sample_rate = read_dword(4) @byte_rate = read_dword(8) @block_align = read_word(12) @sample_bits = read_word(14) @extra_size = read_word(16) if (@compression_code.to_i == MPEG_COMPRESSION) @head_layer = read_word(18) @head_bit_rate = read_dword(20) @head_mode = read_word(24) @head_mode_ext = read_word(26) @head_emphasis = read_word(28) @head_flags = read_word(30) @pts_low = read_dword(32) @pts_high = read_dword(36) end end
to_binary(options={})
click to toggle source
# File lib/nu_wav/chunk.rb, line 97 def to_binary(options={}) out = '' out += write_word(@compression_code) out += write_word(@number_of_channels) out += write_dword(@sample_rate) out += write_dword(@byte_rate) out += write_word(@block_align) out += write_word(@sample_bits) out += write_word(@extra_size) if (@compression_code.to_i == MPEG_COMPRESSION) out += write_word(@head_layer) out += write_dword(@head_bit_rate) out += write_word(@head_mode) out += write_word(@head_mode_ext) out += write_word(@head_emphasis) out += write_word(@head_flags) out += write_dword(@pts_low) out += write_dword(@pts_high) end "fmt " + write_dword(out.size) + out end
to_s()
click to toggle source
# File lib/nu_wav/chunk.rb, line 120 def to_s extra = if (@compression_code.to_i == MPEG_COMPRESSION) ", head_layer:#{head_layer}, head_bit_rate:#{head_bit_rate}, head_mode:#{head_mode}, head_mode_ext:#{head_mode_ext}, head_emphasis:#{head_emphasis}, head_flags:#{head_flags}, pts_low:#{pts_low}, pts_high:#{pts_high}" else "" end "<chunk type:fmt compression_code:#{compression_code}, number_of_channels:#{number_of_channels}, sample_rate:#{sample_rate}, byte_rate:#{byte_rate}, block_align:#{block_align}, sample_bits:#{sample_bits}, extra_size:#{extra_size} #{extra} />" end