summaryrefslogtreecommitdiffhomepage
path: root/samples/01_rendering_basics/06_audio_mixer
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-11-13 01:29:16 -0600
committerAmir Rajan <[email protected]>2020-11-13 01:29:16 -0600
commit128fa1d90cea6289605a49daf56a0cbb72e2dd28 (patch)
tree5cfdb499d275e2b43075e4d6a076365fc58ff0f7 /samples/01_rendering_basics/06_audio_mixer
parent05cbef7fb8224332795e5685be499d81d20e7d93 (diff)
downloaddragonruby-game-toolkit-contrib-128fa1d90cea6289605a49daf56a0cbb72e2dd28.tar.gz
dragonruby-game-toolkit-contrib-128fa1d90cea6289605a49daf56a0cbb72e2dd28.zip
synced from DRGTK 1.27
Diffstat (limited to 'samples/01_rendering_basics/06_audio_mixer')
-rw-r--r--samples/01_rendering_basics/06_audio_mixer/app/main.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/samples/01_rendering_basics/06_audio_mixer/app/main.rb b/samples/01_rendering_basics/06_audio_mixer/app/main.rb
index a09c7f1..ce48d3f 100644
--- a/samples/01_rendering_basics/06_audio_mixer/app/main.rb
+++ b/samples/01_rendering_basics/06_audio_mixer/app/main.rb
@@ -93,6 +93,9 @@ def render_panel args
end
def spawn_new_sound args, num
+ input = nil
+ input = "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}"
+
# Spawn randomly in an area that won't be covered by UI.
screenx = (rand * 600.0) + 200.0
screeny = (rand * 400.0) + 100.0
@@ -102,7 +105,7 @@ def spawn_new_sound args, num
# you can hang anything on the audio hashes you want, so we store the
# actual screen position in here for convenience.
args.audio[args.state.next_sound_index] = {
- filename: "sounds/#{num}.#{(num == 6) ? 'ogg' : 'wav'}",
+ input: input,
screenx: screenx,
screeny: screeny,
x: ((screenx / 1279.0) * 2.0) - 1.0, # scale to -1.0 - 1.0 range
@@ -155,4 +158,3 @@ def tick args
render_sources args
render_ui args
end
-