Class: AudioPlayback::Playback::Mixer
- Inherits:
-
Object
- Object
- AudioPlayback::Playback::Mixer
- Defined in:
- lib/audio-playback/playback/mixer.rb
Overview
Mix sound data
Class Method Summary collapse
-
.mix(sounds_data) ⇒ Array<Array<Integer>>
Mix multiple sounds at equal amplitude.
Instance Method Summary collapse
-
#initialize(sounds_data) ⇒ Mixer
constructor
A new instance of Mixer.
-
#mix ⇒ Array<Array<Integer>>
Mix multiple sounds at equal amplitude.
Constructor Details
#initialize(sounds_data) ⇒ Mixer
Returns a new instance of Mixer.
17 18 19 20 |
# File 'lib/audio-playback/playback/mixer.rb', line 17 def initialize(sounds_data) @data = sounds_data populate end |
Class Method Details
.mix(sounds_data) ⇒ Array<Array<Integer>>
Mix multiple sounds at equal amplitude
11 12 13 14 |
# File 'lib/audio-playback/playback/mixer.rb', line 11 def self.mix(sounds_data) mixer = new(sounds_data) mixer.mix end |
Instance Method Details
#mix ⇒ Array<Array<Integer>>
Mix multiple sounds at equal amplitude
24 25 26 |
# File 'lib/audio-playback/playback/mixer.rb', line 24 def mix (0..@length-1).to_a.map { |index| mix_frame(index) } end |