[Solved]Can't hear anything :V

jonlolo

14-10-2010 13:50:08

Hi guys.
I compiled the lib and added the plugin, etc, so the lib works fine. Added this code in the createScene method of the standart application:

sndMgr = OgreOggSound::OgreOggSoundManager::getSingletonPtr();
OgreOggSound::OgreOggISound* snd = sndMgr->createSound("snd1", "roar.wav", false, true, false, mSceneMgr);
headNode->attachObject(snd);
snd->play();

The applications runs fine, I can see the ogre head and everything, but no sound is heard.
Did I miss something?

Thanks in advance

jonlolo

14-10-2010 14:29:44

Nevermind, solved.
Guided by some examples in the forum. Guess I missed to set up some parameters.
Now have to learn how to use the lib more efficiently.
Thanks

stickymango

14-10-2010 16:45:16

Glad you solved it, was about to ask if the sound was mono/stereo :lol:

Any queries, just shout!

jonlolo

14-10-2010 23:04:25

Well, right now I'm a little confused. Because first time I tryied I couldn't hear the sound, then I added these two lines:

newSound->setRolloffFactor(2.f);
newSound->setReferenceDistance(10.f);

and it worked. But now trying again, I removed those lines, and worked too. So, which are the necesary parameters to set up, if there is any ?

And another thing, I noticed, even though it seems to be a 3D sound, that no matter how far I would go of the node, it will always have the same volume, no attenuation. How can I make it ? Heres my whole code;

mSoundManager = OgreOggSound::OgreOggSoundManager::getSingletonPtr();

if (mSoundManager->init())
{
// Create a static sound, no looping, prebuffered

if (OgreOggSound::OgreOggISound* newSound = mSoundManager->createSound("Sound1", "roar.wav", false, true, false) )
{
// Attach to a SceneNode
headNode->attachObject(newSound);
newSound->setRolloffFactor(2.f);
newSound->setReferenceDistance(10.f);
newSound->play();
}
}

Using the node of the ogre head.

Thanks again ^^

stickymango

15-10-2010 09:36:14

Couple of questions:

* Is your sound definitely single channel?
* You don't appear to attach the listener to anything, it will therefore default to (0,0,0) and will not move, i.e. attenuation remains constant..
* If the above are fine then there's a couple of things to try, first, depending on your scale,

Tweak setMaxDistance()
Tweak setRolloffFactor()
Tweak setReferenceDistance()

see the following for reference about how these values work: attenuation

I've found that these can be a pain to work out using a reallife attenuation model, the easier option would be to change the attenuation model from the default to:
OgreOggSoundManager::setDistanceModel(AL_DISTANCE_LINEAR);
You should be able to pass in intuitive distances to the above and have smooth attenuation between your min/max distance values.

jonlolo

18-10-2010 15:06:39

Oh thanks, that's what I was missing, the Listener Class, didn't know about it.
Now it is heard as a 3D sound.

I'll read later about the attenuation.

Thanks once again.

stickymango

18-10-2010 21:22:42

No Problem.