Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
3D Sound never out of range (never 100% silent)

mindcalamity
Registered User
Quote
2013-01-26 08:48:08

Hello, irrKlang community :)

As described in the title, I'm having some troubles with 3D sound.

I have this code:

source = engine->addSoundSourceFromFile(soundFile.c_str(), irrklang::ESM_AUTO_DETECT, true);

sound = engine->play3D(source, irrklang::vec3df(pos.x, pos.y, pos.z), mLoop, false, true, true);
sound->setSoundStopEventReceiver(this);
sound->setMinDistance(mMinDist);
sound->setMaxDistance(mMaxDist);


Where the mMinDist and mMaxDist are 10 and 20 respectively. Even if the listener is at 200 units away from the sound position, it's not completely silent, it's not as loud as it is at, say 5 units away, but it's still noticeable.

Any way I can make the range effect the volume absolutely ? I.e. to be completely silent after the listener is mMaxDist units away from the source.


niko
Moderator
Quote
2013-01-27 06:51:23

Yes, the maxDistance doesn't do what you think it is doing. Just use the minDistance for adjusting your sound, and leave the max distance as it is. See this from the documentation about the maxdistance for an explanation:

Changing this value is usually not necessary. Use setMinDistance() instead. Don't change this value if you don't know what you are doing: This value causes the sound to stop attenuating after it reaches the max distance. Most people think that this sets the volume of the sound to 0 after this distance, but this is not true. Only change the minimal distance (using for example setMinDistance()) to influence this. The maximum distance for a sound source is the distance beyond which the sound does not get any quieter. The default minimum distance is 1, the default max distance is a huge number like 1000000000.0f.



mindcalamity
Registered User
Quote
2013-02-03 13:14:34

Thanks, and sorry for the late reply.

Is there a way to calculate the distance where the sound would be completely quiet ?


niko
Moderator
Quote
2013-02-04 21:31:10

Hm, probably. Not sure how exactly, tough.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (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