Tech Session: FMOD Ex API

Useful Tools for Making Video
Games
Part IV
An overview of
1
Features









Built-in DSP effects
PS3, Xbox 360, Wii, PS2, PSP, Xbox,
Gamecube, Windows, Linux, Mac OS
support
Sound designer tools (FMOD Designer)
3D sound
Thousands of sounds at once
Multi-speaker support
Supports over 20 file formats
C++, C#, Visual Basic API
…
2
FMOD Hot Games









Guitar Hero III
BioShock
Stranglehold
Metroid Prime 3
Heavenly Sword
Call of Duty 4
Crysis
StarCraft II, World of Warcraft
…
3
Startup Sequence
// create system
FMOD::System* system;
FMOD_RESULT result = FMOD::System_Create(&system);
// set speaker mode, 3D settings, configuration options etc.
// …
// load sound
FMOD::Sound* sound;
result = system->createSound(“sound.mp3",…, &sound);
// play sound
FMOD::Channel* channel = 0;
result = system->playSound(…, sound, …, &channel);
// release resources
Result = sound->release();
Result = system->release();
4
Configuration options






if you desire behaviour differing from the default
such as:
System::setOutput(FMOD_OUTPUTTYPE_[AUTOD
ETECT/XBOX/XBOX360/PS2/PS3/PSP/WII/…])
System::set3DSettings(float dopplerscale, float
distancefactor, float rolloffscale)
System::setHardwareChannels : specify min
number of hardware channels before falling to
software
System::setSpeakerMode : Surround, 5.1, 7.1 etc
…
5
Channels


A channel is an instance of a sound. You
can play a sound many times at once, and
each time you get a new channel handle.
Channels can be grouped eg:
FMOD::Channel *channels[NUM_CHANNELS];
FMOD::ChannelGroup *group;
result = system->createChannelGroup("Group", &group);
result = channel[i]->setChannelGroup(group); // i:0..NUM_CHANNELS
result = groupA->setVolume(…);
group->setMute(…); // etc.
6
3D Sound
FMOD_RESULT result =
fmodSystem->set3DListenerAttributes(int listener,
const FMOD_VECTOR* pos, const FMOD_VECTOR * vel,
const FMOD_VECTOR * forward, const FMOD_VECTOR *up);
 Pos: Address of a variable that receives the position of
the listener in world space.
 Vel: Address of a variable that receives the velocity of the
listener.
 Forward: unit length and perpendicular to the up vector.
up
 Update these vectors every so many milliseconds, not
every frame, since frame rate can vary.

7
Effects
Can create chains of digital sound processing effects by adding
existing filters one after the other eg:
FMOD::DSP* dspDistortion = 0;
FMOD_RESULT result =
system->createDSPByType(FMOD_DSP_TYPE_LOWPASS,
&dspDistortion );
result = system->addDSP(dspDistortion);


DSP types:
FMOD_DSP_[CHORUS/COMPRESSOR/
DISTORTION/ECHO/FLANGE/NORMALI
ZE/PITCHSHIFT/REVERB/…]
8
References

www.fmod.org
9