Class: RoadToRubykaigi::Audio::WavSource
- Inherits:
-
Object
- Object
- RoadToRubykaigi::Audio::WavSource
- Includes:
- WaveFile
- Defined in:
- lib/road_to_rubykaigi/audio/wav_source.rb
Instance Method Summary collapse
Instance Method Details
#finished? ⇒ Boolean
31 32 33 |
# File 'lib/road_to_rubykaigi/audio/wav_source.rb', line 31 def finished? @position >= @buffer.size end |
#gain ⇒ Object
12 13 14 |
# File 'lib/road_to_rubykaigi/audio/wav_source.rb', line 12 def gain 0.3 end |
#generate ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/road_to_rubykaigi/audio/wav_source.rb', line 16 def generate if @position < @buffer.size sample = @buffer[@position] @position += 1 sample else 0.0 end end |
#rewind ⇒ Object
26 27 28 29 |
# File 'lib/road_to_rubykaigi/audio/wav_source.rb', line 26 def rewind @position = 0 self end |
#sample_rate ⇒ Object
8 9 10 |
# File 'lib/road_to_rubykaigi/audio/wav_source.rb', line 8 def sample_rate 44_100 end |