Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound entities can be heard everywhere in level despite the distance being set
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: Sound entities can be heard everywhere in level despite the distance being set

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]

<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: (Select All)
//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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 01-03-2016, 01:45 PM by Romulator.)
01-03-2016, 12:58 PM
Find


Messages In This Thread
RE: Sound entities can be heard everywhere in level despite the distance being set - by Romulator - 01-03-2016, 12:58 PM



Users browsing this thread: 1 Guest(s)