Class: NuWav::FmtChunk
Instance Attribute Summary collapse
-
#block_align ⇒ Object
Returns the value of attribute block_align.
-
#byte_rate ⇒ Object
Returns the value of attribute byte_rate.
-
#compression_code ⇒ Object
Returns the value of attribute compression_code.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#extra_size ⇒ Object
Returns the value of attribute extra_size.
-
#head_bit_rate ⇒ Object
Returns the value of attribute head_bit_rate.
-
#head_emphasis ⇒ Object
Returns the value of attribute head_emphasis.
-
#head_flags ⇒ Object
Returns the value of attribute head_flags.
-
#head_layer ⇒ Object
Returns the value of attribute head_layer.
-
#head_mode ⇒ Object
Returns the value of attribute head_mode.
-
#head_mode_ext ⇒ Object
Returns the value of attribute head_mode_ext.
-
#number_of_channels ⇒ Object
Returns the value of attribute number_of_channels.
-
#pts_high ⇒ Object
Returns the value of attribute pts_high.
-
#pts_low ⇒ Object
Returns the value of attribute pts_low.
-
#sample_bits ⇒ Object
Returns the value of attribute sample_bits.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
Attributes inherited from Chunk
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
#block_align ⇒ Object
Returns the value of attribute block_align.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def block_align @block_align end |
#byte_rate ⇒ Object
Returns the value of attribute byte_rate.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def byte_rate @byte_rate end |
#compression_code ⇒ Object
Returns the value of attribute compression_code.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def compression_code @compression_code end |
#extra ⇒ Object
Returns the value of attribute extra.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def extra @extra end |
#extra_size ⇒ Object
Returns the value of attribute extra_size.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def extra_size @extra_size end |
#head_bit_rate ⇒ Object
Returns the value of attribute head_bit_rate.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_bit_rate @head_bit_rate end |
#head_emphasis ⇒ Object
Returns the value of attribute head_emphasis.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_emphasis @head_emphasis end |
#head_flags ⇒ Object
Returns the value of attribute head_flags.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_flags @head_flags end |
#head_layer ⇒ Object
Returns the value of attribute head_layer.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_layer @head_layer end |
#head_mode ⇒ Object
Returns the value of attribute head_mode.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_mode @head_mode end |
#head_mode_ext ⇒ Object
Returns the value of attribute head_mode_ext.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def head_mode_ext @head_mode_ext end |
#number_of_channels ⇒ Object
Returns the value of attribute number_of_channels.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def number_of_channels @number_of_channels end |
#pts_high ⇒ Object
Returns the value of attribute pts_high.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def pts_high @pts_high end |
#pts_low ⇒ Object
Returns the value of attribute pts_low.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def pts_low @pts_low end |
#sample_bits ⇒ Object
Returns the value of attribute sample_bits.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def sample_bits @sample_bits end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
72 73 74 |
# File 'lib/nu_wav/chunk.rb', line 72 def sample_rate @sample_rate end |
Instance Method Details
#parse ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# 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 = {}) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/nu_wav/chunk.rb', line 97 def to_binary(={}) 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 ⇒ Object
120 121 122 123 124 125 126 127 |
# 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 |