Bork3D Games

Personal tools
From Bork3D
Jump to: navigation, search

Sound Effects

Sound effects in the Bork3D Game Engine are initialized statically in the RudeSound class. It's kinda lame, but it works for 99% of games out there. The iPhone OS does a good job handling the resource management for you.

In RudeSound.h, enumerate all the sound effects you want to use:

typedef enum {
	kSoundNone = -1,
	kSoundCheer,
	kSoundClaps,
	kSoundUIStart,
	kNumSounds,
} eSoundEffect;

In RudeSound.cpp, modify the list of sound effects filenames to match the enumeration:

const char * kSoundFilenames[kNumSounds] = {
	"sfx_cheer.wav",
	"sfx_claps.wav",
	"sfx_start.wav",
};

And then to use a sound effect just call PlayWave() with a value from the enumeration:

RudeSound::GetInstance()->PlayWave(kSoundCheer);