-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Here's an example:
raylib-ruby/examples/audio/audio_mixed_processor-broken.rb
Lines 33 to 60 in 8491d2d
| ProcessAudio = FFI::Function.new(:void, [:pointer, :uint]) do |buffer, frames| | |
| # samples = buffer.to_a | |
| # average = 0.0 # Temporary average volume | |
| # | |
| # frames.times do |frame| | |
| # left = samples[frame * 2] | |
| # right = samples[frame * 2 + 1] | |
| # | |
| # left = (left.abs ** $exponent) * (left < 0.0 ? -1.0 : 1.0) | |
| # right = (right.abs ** $exponent) * (right < 0.0 ? -1.0 : 1.0) | |
| # | |
| # average += (left.abs / frames) + (right.abs / frames) | |
| # end | |
| # | |
| # # Moving history to the left | |
| # $average_volume.shift(399) | |
| # $average_volume << average # Adding last average value | |
| end | |
| # Initialization | |
| # -------------------------------------------------------------------------------------- | |
| SCREEN_WIDTH = 800 | |
| SCREEN_HEIGHT = 450 | |
| Raylib.init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [audio] example - processing mixed output") | |
| Raylib.init_audio_device # Initialize audio device | |
| # Raylib.attach_audio_mixed_processor(ProcessAudio) # FIXME: Uncomment when callbacks are supported |
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed