Class: Zappa::WaveData
- Inherits:
-
Object
- Object
- Zappa::WaveData
- Defined in:
- lib/zappa/wave/wave_data.rb
Instance Attribute Summary collapse
-
#chunk_id ⇒ Object
readonly
Returns the value of attribute chunk_id.
-
#chunk_size ⇒ Object
readonly
Returns the value of attribute chunk_size.
-
#samples ⇒ Object
readonly
Returns the value of attribute samples.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize ⇒ WaveData
constructor
A new instance of WaveData.
- #set_samples(samples) ⇒ Object
Constructor Details
#initialize ⇒ WaveData
Returns a new instance of WaveData.
5 6 7 8 9 |
# File 'lib/zappa/wave/wave_data.rb', line 5 def initialize @chunk_id = 'data' @chunk_size = 0 @samples = [] end |
Instance Attribute Details
#chunk_id ⇒ Object (readonly)
Returns the value of attribute chunk_id.
3 4 5 |
# File 'lib/zappa/wave/wave_data.rb', line 3 def chunk_id @chunk_id end |
#chunk_size ⇒ Object (readonly)
Returns the value of attribute chunk_size.
3 4 5 |
# File 'lib/zappa/wave/wave_data.rb', line 3 def chunk_size @chunk_size end |
#samples ⇒ Object (readonly)
Returns the value of attribute samples.
3 4 5 |
# File 'lib/zappa/wave/wave_data.rb', line 3 def samples @samples end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/zappa/wave/wave_data.rb', line 17 def ==(other) other.chunk_size == @chunk_size && other.chunk_id == @chunk_id end |
#set_samples(samples) ⇒ Object
11 12 13 14 15 |
# File 'lib/zappa/wave/wave_data.rb', line 11 def set_samples(samples) @samples = samples frame_size = samples[1].size @chunk_size = @samples.size * frame_size * 2 end |