Table of Contents

 
AddSFX
 

Purpose

Adds a sound effect clip to the manager

 

Protoype

void CSoundMngr::AddSFX (string str_id, string str_filename, int i_vol, int i_priority, int i_pan)
 

Parameters

id the unique ID of the sound clip
filename the name or path of the file load the clip from
vol the initial clip volume level
priority the initial clip priority level
pan the initial clip pan setting
 

Description

This function adds a sound clip to the manager. All clips must have a unique ID that will be used to later reference them in the program. You must also specify the name or path of the file that you wish to load into the manager to play. Supported file types: .WAV, .MP2, .MP3, .OGG, .RAW

NOTE: These clips are loaded into memory, which means they should not be big files unless they are played a lot

Audio Settings

Each music clip can have it's own unique audio settings for volume, pan, and priority. Volume levels can range from 0-255 (you can also use the predefined values of VOLUME_MIN and VOLUME_MAX, respectively). The priority level of a clip tells the sound engine which clip to bump first when all channels are full. The higher the priority, the less likely the clip will be bumped due to channel overflow. Priorities range from 0-255, with 0 being the lowest and 255 being the highest (you can also use the predefined values of PRIORITY_MIN and PRIORITY_MAX, repsectively).

 

Use

CSoundMngr sound;
sound.AddSFX("my_sfx", "bullet_shot.mp3", VOLUME_MAX*0.5f, 0, PAN_MID);
 

Prev: AddMusic
Next: Assign