Load wav
Jump to navigation
Jump to search
Definition
INT load_wav ( <STRING filename>, [ <POINTER id>] )
Loads a sound effect in the WAV format for later use with play_wav().
Parameters
STRING filename | - The WAV file to be loaded, including a possible path. |
POINTER id | - Optional parameter, for loading a wav in the background. |
Returns
INT : WaveID
-2 | - Waiting for the file to be loaded, see notes. |
-1 | - There was an error loading the file. |
>=0 | - The waveID of the newly created sound. |
the following applies for versions prior rc282:
INT : WaveID
-1 | - Error: sound inactive; opening file |
0 | - Could not load wave file. |
>0 | - The WaveID. |
Notes
The optional parameter id was introduced in version rc282 and allows you to load resources in the background. It used with the Offset operator. See example below:
load_wav("archivo_gordo.wav", &idwav); while(idwav==-2) say("Big File Loading ...."); frame; end if(idwav==-1) say("Something went wrong!!"); exit(); // o return end say("Big file loaded ok!!");
Example
Program Private int wave; Begin wave = load_wav("my_wav.wav"); play_wav(wave,0); Loop frame; End End
Used in example: play_wav()