3D Sound in a level

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
RobbyRob
Posts: 21
Joined: Fri Mar 02, 2007 4:30 pm
Location: Germany

3D Sound in a level

Post by RobbyRob »

javascript:emoticon(':(')
Sad

Hello,

as an Irrlicht beginner I make first expierence with this wonderful game engine, which impresses me more and more. Now I work on 3D sound in my project and want to set an alien_engine sound on a certain position in my level. Therefore I used the following code snippet:
------------------------------------------------------------------------
ISoundEngine* engine = createIrrKlangDevice();

if (!engine)
return 0;

audio::ISound* music = engine->play3D("./data/alien_engine.wav", core::vector3df(120,50,300),true,false,true);
if(music)
music->setMinDistance(5.0f);
music->setVolume(0.2f);
if(music)
music->drop();
--------------------------------------------------------------------------

Unfortunately I got only a 2D sound, meaning I hear the sound right after starting my level on any position with constant volume.
I work with Irrklang 04, because 05 gives always an error message and tried this in different variations. There is certainly something missing to get this effect, but I cannot find it. Is there anybody who can help me ? Thanks a lot for your support !!

RobbyRob :(
lonesock
Posts: 9
Joined: Sun Jan 14, 2007 12:54 am
Contact:

is it stereo?

Post by lonesock »

is there a chance your wav file is in stereo? stereo wav files in play3d behave differently than you would expect.
lonesock
Piranha are people too.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

What error message does irrKlang 0.5 print exactly? Would be nice to know so I can fix it.
But btw: irrKlang can also play stereo sounds in 3d, not a problem. Maybe you forgot to let the sound engine know where you are as listener in 3d space? You need to call setListenerPosition() for this (http://www.ambiera.com/irrklang/docu/cl ... e.html#a16). Somehow a paragraph in the 3d sound tutorial, disappeared, I'm going to fix this soon.
Post Reply