s4rge Registered User |
Quote
|
2012-06-26 18:19:46 |
|
I have a little problem. I am all new to Irrlicht and Irrklang but I played around a little bit and now I am trying to implement the IrrKlangSceneNode. Like you can see here. This is a hit sound for when a bullet hits an object.
IrrKlangDev* soundDev = IrrKlangDev::getInstance(); irrklang::ISoundEngine* soundEngine = soundDev->getSoundEngine(); IrrKlangSceneNode* soundNode = new IrrKlangSceneNode(soundEngine, smgr->getRootSceneNode(), smgr, 112); soundNode->setSoundFileName("../media/soundfiles/buttonsounds/button-21 select.mp3"); soundNode->setPlayOnceMode(); soundNode->setMinMaxSoundDistance(0.2f,0.5f); soundNode->setVolume(0.2f); soundNode->OnAnimate(timeMs); soundNode->drop();
Right now I am trying to get the sound to play in 3D but I don't here a difference if I hit a nearby object or if I hit an object a bit further away.
|
niko Moderator |
Quote
|
2012-06-27 07:47:51 |
|
Maybe you also need to set the camera listener position and direction for the audio?
|
s4rge Registered User |
Quote
|
2012-07-02 11:09:11 |
|
I thought the OnAnimate function will do that for me
ISceneNode::OnAnimate(timeMs); // play the sound core::vector3df pos = getAbsolutePosition();
if (Sound) Sound->setPosition(pos); . . . . if (SoundFileName.size()) Sound = SoundEngine->play3D(SoundFileName.c_str(), pos, false, true, true);
if (Sound) { if (MinDistance > 0 ) Sound->setMinDistance(MinDistance); if (MaxDistance > 0 ) Sound->setMaxDistance(MaxDistance);
Sound->setIsPaused(false); . . }
|
niko Moderator |
Quote
|
2012-07-03 05:50:10 |
|
That sets the position of the sound, but not your position, the one of the listener.
|
s4rge Registered User |
Quote
|
2012-07-09 14:58:49 |
|
So I have to give the SceneNode somehow the cameraposition of the player.
Like I get the irr::scene::ICameraSceneNode* and give over the SceneNode the vectors of it to the engine.
If I am right I have to update the position with this method or not?
engine->setListenerPosition(position, lookDirection, velPerSecond, upVector);
|
niko Moderator |
Quote
|
2012-07-09 18:30:45 |
|
Yes, that's correct.
|
s4rge Registered User |
Quote
|
2012-07-10 18:22:56 |
|
great thx. I will try it then ^^
|