Table of Contents

 
AddMusic
 

Purpose

Loads a music clip to stream from disk

 

Protoype

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

Parameters

id the unique ID to assign the new music object
filename the path or name of the file to stream
vol the initial clip volume level
priority the initial clip priority level
pan the initial clip pan setting
 

Description

This function takes a unique ID and uses it to create a new music object. The filename or path of the music object is passed in and stored and the file is streamed in from disk when it is played. Supported file types: .WAV, .MP2, .MP3, .OGG, .RAW

NOTE: Don't forget that these sound files are streamed in from disk, which means playing a lot of them a lot of times will be a huge drag in performance.

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.AddMusic("my_music", "music/background.mp3", VOLUME_MAX*0.5f, 0, PAN_MID);
 

Prev: Table of Contents
Next: AddSFX