int SoundAdd(char *filename);

 

Loads a .snd sound file for no latency playback automatically mixed with other sounds.

 

Return Value

 

Returns in handle to the file loaded.

 

Parameters

 

filename

File name of the sound to add.  Sounds must be converted to .snd files using the Wav2Snd.exe utility located at C:\DragonFireSDK. Simply drag .wav files to Wav2Snd and .snd files will be created in the same folder where your .wav files are. For conversion to the .snd format, .wav files must be uncompressed 16 bit PCM (standard WAV) format.  Files may be 44kHz or 22kHz, and may be either mono or stereo.

 

The path to the file named in this parameter must be in the Assets folder where your application resides.  (Typically, your project's Debug or Release folder.  For example, if your project is in C:\DragonFireSDK\, your Assets folder will be C:\DragonFireSDK\Debug\Assets or C:\DragonFireSDK\Release\Assets.)

 

You may also specify a sound file that is in your application's Documents folder by adding "Documents/" in front of the rest of the path.  This is especially useful if your application uses NetSend() to download new sounds.

 

NOTE: The file system used by iOS is case sensitive, so be sure to match the case of the file name in your code to that of the file on your computer.

 

Remarks

 

SoundAdd() loads a sound file and returns an integer handle that can be used by SoundPlay(), SoundLoop() and SoundStop().

 

Availability

 

Available in DragonFireSDK 1.0 and later.

 

Example

 

The example below loads a file called "Boom.snd" and calls SoundLoop() to play back the sound infinitely. SoundStop() is called in AppExit() to halt playback.

 

#include "DragonFireSDK.h"

 

int SoundHandle;

 

void AppMain()

{

  SoundHandle = SoundAdd("Boom.snd");

  SoundLoop(SoundHandle);

}

 

void AppExit()

{

  SoundStop(SoundHandle);

}

 

void OnTimer()

{

 

}