sound.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void InitSound (void)
 load music & sound samples from disk
void PlaySound (int sound_id)
 play a sound effect
void PlayMusic (int music_id)
 play a music stream
void PlayLevelMusic (char *file)
 load and play a tracked music file (.mod, .it, etc.)
void StopMusic (int music_id)
 stop a music stream
void SetSFXVolume (int volume)
 set the sound effects volume level
void SetBGMVolume (int volume)
 set the background music volume level


Function Documentation

void InitSound ( void   ) 

Loads all sound samples from disk and associates their handles with entries in the sound ID array. Also gets handles for music to be streamed from disk and associates them with entries in the music ID array. Finally this function configures certain sound system parameters such as channel / stream volume control.

Todo:
Implement support for sound samples to be looped and stopped, for example an 'engine running' sound.

Definition at line 44 of file sound.cpp.

References DEFAULT_BGM_VOLUME, DEFAULT_SFX_VOLUME, music, MUSICID_MENU, samples, SetBGMVolume(), SetSFXVolume(), SOUNDID_BOUNCE, SOUNDID_BURNING, SOUNDID_CLICK, SOUNDID_CRUNCH, SOUNDID_ENGINE, SOUNDID_EXPLOSION, SOUNDID_FIRE_BS, SOUNDID_FIRE_HS, SOUNDID_FIRE_LM, SOUNDID_FIRE_PS, SOUNDID_FIRE_SB, SOUNDID_GO, SOUNDID_HIT, SOUNDID_MENUSELECT, SOUNDID_POWERUP, SOUNDID_POWERUP_HEALTH, SOUNDID_READY, SOUNDID_REFLECT, SOUNDID_SCREAM, SOUNDID_SET, and SOUNDID_VICTORY.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void PlayLevelMusic ( char *  file  ) 

Load and play a tracked music file. The file is played from memory once loaded. Note: tracked music and streamed music share a channel, so playing a stream will disable a currently playing tracker song and vice-versa.

Definition at line 112 of file sound.cpp.

References track.

Referenced by PlayGame().

Here is the caller graph for this function:

void PlayMusic ( int  music_id  ) 

Play a music stream from disk starting from the beginning, given it's music ID. Note: tracked music and streamed music share a channel, so playing a stream will disable a currently playing tracker song and vice-versa.

Definition at line 98 of file sound.cpp.

References music.

Referenced by main().

Here is the caller graph for this function:

void PlaySound ( int  sound_id  ) 

Play a sound effect through the sound effects audio channel, given it's sound ID. This function is used for playing one-shot sound effects, not for streaming large sound files from disk.

Definition at line 83 of file sound.cpp.

References hMainFX, and samples.

Referenced by Collide(), Credits(), GameLogicDamage(), GameLogicDamageVal(), GameLogicEquip(), GameLogicFire(), HighScoreMenu(), MainMenu(), OptionsMenu(), PlayGame(), ProcessTileCollisions(), and RemoveDeadObjects().

Here is the caller graph for this function:

void SetBGMVolume ( int  volume  ) 

Set the background music volume level in a percentage rage (0-100)%. Passing a value of zero will mute the background music.

Definition at line 156 of file sound.cpp.

Referenced by InitSound(), and OptionsMenu().

Here is the caller graph for this function:

void SetSFXVolume ( int  volume  ) 

Set the sound effect volume level in a percentage rage (0-100)%. Passing a value of zero will mute the sound effects.

Definition at line 143 of file sound.cpp.

Referenced by InitSound(), and OptionsMenu().

Here is the caller graph for this function:

void StopMusic ( int  music_id  ) 

Stop a music stream from playing. This function does not reset it's playing position, so it can be thought of as a 'pause' function.

Todo:
Implement an 'unpause' function for music streams.

Definition at line 131 of file sound.cpp.

References music, and track.

Referenced by main(), and PlayGame().

Here is the caller graph for this function:

 

Copyright Windsor Schmidt 2006 - All rights reserved.