Page 1 of 1

3D Sound in a level

Posted: Sat Mar 03, 2007 10:50 am
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 :(

is it stereo?

Posted: Sun Mar 04, 2007 3:39 am
by lonesock
is there a chance your wav file is in stereo? stereo wav files in play3d behave differently than you would expect.

Posted: Sun Mar 04, 2007 9:47 am
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.