Reader small image

You're reading from  Corona SDK Mobile Game Development: Beginner's Guide

Product typeBook
Published inMar 2015
Publisher
ISBN-139781783559343
Edition1st Edition
Tools
Right arrow
Author (1)
Michelle M Fernandez
Michelle M Fernandez
Right arrow

Time to play


Audio can be loaded in two different ways, as follows:

  • loadSound(): This preloads an entire sound into the memory

  • loadStream(): This prepares the sound to be played by reading small chunks at a time to save memory

audio.loadSound()

The audio.loadSound() function loads an entire file completely into the memory and returns a reference to the audio data. Files that are loaded completely into the 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 will fit in this category.

The syntax is audio.loadSound(audiofileName [, baseDir ]).

The parameters are as follows:

  • audiofileName: This specifies the name of the audio file you want to load. The supported file formats are determined by the platform the file is being run on.

  • baseDir: By default, sound files are expected to be in the application resources directory. If the sound file is in the application documents...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Corona SDK Mobile Game Development: Beginner's Guide
Published in: Mar 2015Publisher: ISBN-13: 9781783559343

Author (1)