Audio can be loaded in two different ways as follows:
loadSound()
preloads an entire sound into memoryloadStream()
prepares the sound to be played by reading small chunks at a time to save memory
Loads an entire file completely into memory and returns a reference to the audio data. Files that are loaded completely into memory can be reused, played, and shared simultaneously on multiple channels so you only need to load one instance of the file. Sounds that you would use as sound effects in your game would fit in this category.
Syntax:
audio.loadSound(audiofileName [, baseDir ])
Parameters:
audiofileName
- Specifies the name of the audio file you want to load. Supported file formats are determined by the platform you are running the audio file on.baseDir
- By default, sound files are expected to be in the application resources directory. If the sound file is in the application documents directory, usesystem.DocumentsDirectory
.
Example:
tapSound = audio.loadSound("tap...