Frictional Games Forum (read-only)
Sound entities can be heard everywhere in level despite the distance being set - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Sound entities can be heard everywhere in level despite the distance being set (/thread-35853.html)



Sound entities can be heard everywhere in level despite the distance being set - Reminiscity - 01-01-2016

As the title reads. The distance is set and is not covering the whole map. KeepPlayingOutOfRange is set to false in the .snt. STILL it can be heard everywhere.

Has anyone had the same problem?


RE: Sound entities can be heard everywhere in level despite the distance being set - Romulator - 01-01-2016

Can you post the text of your .snt? Maybe your ranges are too large or there is something else which may need tinkering~


RE: Sound entities can be heard everywhere in level despite the distance being set - CarnivorousJelly - 01-02-2016

Any sound with "ambient" in the name will play throughout the level regardless of distance from the source. I haven't found a solution to that specific issue, but there's usually a non-ambient version if you're using TDD's sounds.

If it's not ambience, try checking for map_cache files in appdata/roaming. It could be that your settings haven't been updated in-game because of a cache file.

Also definitely post the .snt for Romulator. I'm no expert in this and he'll be able to help you more Smile


RE: Sound entities can be heard everywhere in level despite the distance being set - Newsman Waterpaper - 01-02-2016

Put this in the .snt file
KeepPlayingOutOfRange="false" and Use3D="True" and mess around the volume and distance should help.


RE: Sound entities can be heard everywhere in level despite the distance being set - Reminiscity - 01-03-2016

Here's the content of the .snt. It's an amfp sound that I copied to my isolated full conversion with the goal of making it only heard inside the area I set on the sound entity.

I have double checked my resources.cfg and my mod directory is above the default sound directory so it can't be that the original sound file is loaded. Or can it? xD

<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="amb_sewer_largearea" />
</Main>
</SOUNDS>
<PROPERTIES FadeStart="False" FadeEnd="False" Loop="True" Use3D="true" Stream="True" Blockable="True" Volume="0.35" MinDistance="1" MaxDistance="5" BlockVolumeMul="0.0" Random="1" Interval="0" Priority="0" KeepPlayingOutOfRange="false" />
</SOUNDENTITY>


RE: Sound entities can be heard everywhere in level despite the distance being set - Romulator - 01-03-2016

Alright, this seems to work for some reason. As Newsman Waterpaper above said, you'll need to play around with the Min and MaxDistance. The Min is the distance between the sound's origin and, in Level Editor units*, how far away the sound will be its loudest. The Max Distance is the maximum distance the sound can be heard - at least, until the sound reaches 0 volume. Between Max and Min, the sound will fade depending on distance.

Have a graphic I drew in Paint in a few minutes to show what I mean. This is based on the .snt I have in the code below. Volume can be changed (but 0.8 is pretty loud, since I am pretty sure 1.0 is the cap) and the distances should be changed to suit your environment.
[Image: a2cca15d86.png]

Code:
<SOUNDENTITY>
  <SOUNDS>
    <Main>
      <Sound File="amb_sewer_largearea.ogg" />
    </Main>
  </SOUNDS>
  <PROPERTIES FadeStart="False" FadeEnd="False" Loop="True" Use3D="True" Stream="True" Blockable="True" Volume="0.8" MinDistance="1" MaxDistance="5" BlockVolumeMul="0.5" Random="0" Interval="0" Priority="0" KeepPlayingOutOfRange="False" />
</SOUNDENTITY>

This worked for me - but if it still doesn't work, I'll post my poorly created map for you Smile

*Level Editor units being, the standard sized wall is 4 wide and 4 tall. Therefore, a distance of 20 wide would be about 5 default walls.


Previous Post
Spoiler below!
Since I still cannot figure out exactly why it doesn't adjust itself, are you able to take an approach similar to this?

[Image: 2ebbe73a7f.jpg]
The idea is this:
- Blue: The Player cannot hear the sound
- Green The Player can hear the sound (it's within the area, but unfortunately, still as loud as the volume (0.8f))
- Red The Sound Location, which is technically still green, since it plays around.

I set up a ScriptArea around the green area, which, when entered and exited, plays and stops the sound respectably using conditionals. The sound plays at a ScriptArea at the end of the corridor.
PHP Code:
//Sound Test

void OnStart()
{
    
AddEntityCollideCallback("Player""ScriptArea_2""fade_sound"false0);
}

void fade_sound(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
    {
    
PlaySoundAtEntity("ambience_sewer""amb_sewer_largearea.snt""ScriptArea_1"0false);
    }
    else if(
alState == -1)
    {
    
StopSound("ambience_sewer"3.0f);   //3 second fade out when out of area
    
}


I'll keep looking into this though if this isn't possible - it's really getting me thinking :3