Download presentation
Presentation is loading. Please wait.
Published byNasir Tibbett Modified over 9 years ago
1
Sound Engine Evaluation for Computer Games Case Study: fmod Jyun-Ming Chen
2
Fall 20102 Typical Game Loop Roles of music/sound BGM (background music) Sound effect
3
Fall 20103 Microsoft SDK BGM (Midi) mciSendCommand ( … ) Sound (Wave) sndPlaySound See msdn for detailsmsdn Ex: midi_wav.zip on webhd2/game-ex Need more sophisticated tools!
4
Fall 20104 Check List BGM File formats supported: mid, mp3, mod, … Looping Early termination Volume control Sound effects File formats supported Trigger mechanism Reverb and other DSP FX (e.g., room effects) Pre-load to avoid delay in first play General Mixing capability (how many sounds can be mixed at one time) Spatial sound Position: 3D vs. panning Velocity: Doppler supported? Occlusion?! Sync capability sound to action Action to sound Others CPU overhead
5
Fall 20105 Case Study: fmod Cross platform audio library (Win32, Linux, mac, WinCE, PS2, Xbox, … ) Free unless for commercial use
6
Fall 20106 Documentation FSOUND: for sound effect FMUSIC: for bgm
7
Fall 20107 FSOUND API
8
Fall 20108 Initialization Required for both FMUSIC & FSOUND
9
Fall 20109 FSOUND_Sample Load, Free SetMode: LOOP normal | bidi | off Get/SetLoopPoints GetLength Get/SetMinMaxDistance (min is the distance where the sound starts to attenuate) increase the min_distance of a sound to make it 'louder' in a 3d world, and decrease it to make it 'quieter' in a 3d world.
10
Fall 201010 FSOUND_Stream If the PCM data (wav) or compressed file (ogg, mp3, … ) is too big to be read in as a sample, we can use stream functions to read it (decompress it on- the-fly) Certain functionalities are restricted
11
Fall 201011 Channel Functions FSOUND_PlaySound, PlaySoundEx FSOUND_FREE: Choose a free channel to play in Returns the channel selected Extended version can play paused (allow attributes to be changed, then play) FSOUND_SetFrequency (channel, 11025); FSOUND_SetVolume(channel, 255); FSOUND_SetPan(channel, 255); FSOUND_SetPaused(channel, FALSE); FSOUND_StopSound
12
Fall 201012 FMUSIC (mid, mod; mp3) LoadSong PlaySong: can play more than one music (yes, but why?) SetPaused SetLooping: default TRUE SetPanSeparation, SetMasterSpeed, SetMasterVolume StopSong, StopAllSongs FreeSong SetReverb (midi only)
13
OpenGL Tests Webhd2/game- ex/fmod_opengl_tests
14
Fall 201014 Basics
15
Fall 201015 Bgmusic FMUSIC PLAYS S3M AND MID; NOT MP3 (sequenced file, not PCM-type) OK for mod files
16
Fall 201016 Stream Works for mp3, ogg, wav Only wav can store cue point (for sync)
17
Fall 201017 3dsound FSOUND_Update(): This updates the 3d sound engine, and should be called whether sound source or listener changes position
18
Fall 201018 Listener Attributes Float *pos Float *Vel (per second) NULL to ignore Fx, fy, fz (forward orientation unit vector) Tx, ty, tz (top-up orientation unit vector) x y z Global Axes in Fmod Left-handed
19
Fall 201019 Doppler FSOUND_3D_SetDopplerFactor (4.0);
20
Commonly Used APIs Fall 201020 Init and Close Load and Free sample
21
Sound API Fall 201021
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.