Last active
December 15, 2015 19:49
-
-
Save alexey-dc/5314165 to your computer and use it in GitHub Desktop.
Sound API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- cached, sound played based on the name for the sound effect, rather than the file name | |
SoundManager.map("dropped_bass", "dropped_bass.ogg") | |
SoundManager.map("explosion", "explosion.ogg") | |
SoundManager.preload("dropped_bass") | |
-- Assume a script that does mapping and preloading for each game (based on a data file) | |
-- volume is in [0, 1], pitch is in [0, inf) | |
SoundManager.playSound("explosion", volume, pitch) -- Sounds that aren't preloaded are loaded automatically, does not loop | |
SoundManager.playMusic("dropped_bass", volume, loops) -- Streamed, loops = -1 means loop forever, 0 = loops once and don't repeat | |
SoundManager.stopMusic() | |
-- Will probably need extensions for volume control, stopping arbitrary sounds, etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment