Jump to content


Photo

Looping Sounds


6 replies to this topic

#1 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37376 posts

Posted 22 April 2012 - 12:47 PM

Hopefully someone knows this and can save me some testing.

If you have a soundshader that is set as a looping sound, but it lists more than one sound file:

tdm_sound
{
looping 1

sound A
sound B
sound C

}


does the engine pick either A, B, or C on map start and loop that one sound over and over, or does it play A, B or C once, then select A, B or C to play for the next loop, and continue picking randomly from the list each time it loops?
TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#2 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12679 posts

Posted 22 April 2012 - 04:41 PM

I looked at the code, but can't understand it. Couldn't find any comments to help, either.

Have you tried setting up a speaker that uses this type of shader? Unless someone soon admits to already knowing the sound code, it might be the quickest way to get an answer.

#3 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37376 posts

Posted 22 April 2012 - 07:21 PM

Did some testing, and it appears to work like this:

On the first round of playing the sound, code chooses A, B, or C at random.

For the second round, code plays sound A.

Sound A is looped indefinitely thereafter.


Not the most useful way of doing things. Having multiple soundshaders on looping sounds is essentially pointless.
TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#4 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12679 posts

Posted 22 April 2012 - 08:09 PM

Some sounds have lead-ins.

I suspect that, for looping shaders, when there's two sounds, the engine is supposed to play the first one once, then loop the second one from there on.

Perhaps the presence of three sounds is screwing up this design.

#5 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7501 posts

Posted 23 April 2012 - 03:08 AM

I suspect that, for looping shaders, when there's two sounds, the engine is supposed to play the first one once, then loop the second one from there on.


There's an actual "leadin" keyword though, which identifies which of the two is the lead-in sound.

Having multiple sounds in a loop doesn't really make sense, because multiple sounds are intended to be selected in a random fashion to avoid too much repetition, whereas a looped sound is continuous and hence repetitive by nature. I guess the code could be modified to choose one loop at random, but I'm not sure what the benefit would be since the only way you would hear the different loop is by restarting the game (at which point you're probably not going to notice the change anyway).

#6 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37376 posts

Posted 23 April 2012 - 07:46 AM

I guess the code could be modified to choose one loop at random, but I'm not sure what the benefit would be since the only way you would hear the different loop is by restarting the game


It would be good when there are lots of copies of the same thing, like fire flames, so that different flames in the map wouldn't sound exactly the same.
TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#7 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7501 posts

Posted 23 April 2012 - 10:54 AM

It would be good when there are lots of copies of the same thing, like fire flames, so that different flames in the map wouldn't sound exactly the same.


Good point, I didn't think of that.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users