Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Irrklang / irrlicht

rvm
Registered User
Quote
2012-03-12 17:29:15

Hello,

I search to implement Irrklang in Irrlicht.
I have find the irrKlang scene node for Irrlicht 1.5 and use them with Irrlicht 1.7.2. At first look the code is correct.
But I have a problem : when I play a sound is the render loop it crash (in EventReceiver).

And I don't see a source listener and emitter ?
I missed something ?

Thanks,
RVM


niko
Moderator
Quote
2012-03-12 20:14:47

Hm, some more details about the crash maybe?


rvm
Registered User
Quote
2012-03-12 21:25:39

Hello,

I use this function to play a song :

void CPlayer::Play_Sound(char Sound_Name)
{
switch(Sound_Name)
{
case 'C':
//Crash here
Player_Sound_Node->setSoundFileName("./media/son/crier.wav");
break;
case 'T':
Player_Sound_Node->setSoundFileName("./media/son/getout.ogg");
break;
default:
break;
}
}


And in my render loop :
        if(EventReceiver.IsKeyDown(irr::KEY_KEY_Z))
{
Player->Set_Position(Player->Get_Position()+irr::core::vector3df(0,1,0));
Player->Play_Sound('T');
}


Here is my complete class :
http://pastebin.com/rJ071NMR (h)
http://pastebin.com/p3V0LaNr (cpp)

First I was thinking it was a incorrect file but no...

RVM


niko
Moderator
Quote
2012-03-14 13:42:25

By shortly taking a look at this, it looks ok for me. Where exactly does it crash in your event receiver, and why? Are you for example sure that the Player pointer is ok?


rvm
Registered User
Quote
2012-03-15 11:45:18

Normally the pointer is ok.
Here is my render loop :

while(Irr_Device->run())
{
const irr::u32 now = Irr_Device->getTimer()->getTime();
const irr::f32 frameDeltaTime = (irr::f32)(now - then) / 1000.f;
then = now;

VideoDriver->beginScene(true, true, irr::video::SColor(255,100,101,140));
SceneManager->drawAll();
GUIEnv->drawAll();

irr::core::stringw Title = "RhombiWord Driver : ";
Title += VideoDriver->getName();
Title += " FPS : ";
Title += VideoDriver->getFPS();
Irr_Device->setWindowCaption(Title.c_str());

cam->setTarget(node->getPosition());

irr::core::vector3df nodePosition = irr::core::vector3df(0,0,0);

if(EventReceiver.IsKeyDown(irr::KEY_KEY_Z))
{
Player->Set_Position(Player->Get_Position()+irr::core::vector3df(0,1,0));
Player->Play_Sound('T');
//node->setPosition(node->getPosition()+irr::core::vector3df(0,1,0));
}
if(EventReceiver.IsKeyDown(irr::KEY_KEY_S))
{
Player->Set_Position(Player->Get_Position()+irr::core::vector3df(0,-1,0));
//node->setPosition(node->getPosition()+irr::core::vector3df(0,-1,0));
}

if(EventReceiver.IsKeyDown(irr::KEY_KEY_Q))
{

}
if(EventReceiver.IsKeyDown(irr::KEY_KEY_D))
{

}
VideoDriver->endScene();
}

And it crash at line : Player->Play_Sound('T');

If I comment the line, I can move my Player.
I am not a pro in debugging, but when I put a break point at this line, I have a SIGSEGV error...
I will a learn a bit more about debugging.

Just a question, Irrklang use a thread for playing a song ?

RVM


Unknown
Guest
Quote
2016-06-24 09:32:57

hello, I have the same problem.

CIrrKlangSceneNode::CIrrKlangSceneNode* soundNode =
new CIrrKlangSceneNode::CIrrKlangSceneNode(soundEngine, smgr->getRootSceneNode(), smgr, 666);

//soundNode->setSoundFilename
soundNode->setSoundFileName("media/fallout.wav");
soundNode->setMinMaxSoundDistance(30.0f); // influences the distance where the sound can be heard
soundNode->setRandomMode(1000, 5000); // plays sound multiple times with random interval

// other modes would be:
// soundNode->setLoopingStreamMode()
// or
// soundNode->setPlayOnceMode();

soundNode->drop();


When the code:
soundNode->setSoundFileName("media/fallout.wav");

is commented out. all works fine.
//soundNode->setSoundFileName("media/fallout.wav");
So what is the bug?

Cheers
Unknown


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact