Thread: [Workaround] Getting background sounds to loop [Obsolete]

Results 1 to 6 of 6
  1. #1
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [uk]
    Posts
    8,487

    [Workaround] Getting background sounds to loop [Obsolete]

    I should have published this back in August 2008 when I first did this, but never mind...

    As you all know ambient sounds that start on and loop don't play. However there is a trick to get them working which should suffice for you to test out how they would really sound so you can make adjustments, tweaks, etc.

    This only effects ambient_generic's that you want to start switched on. Looping ambient_generic's work just fine if they are started later, so we can use this to get background sounds working.

    I also assume you're using wav sound files. Apparently other sound formats behave differently.

    IMPORTANT: Whichever workaround you decide to use, you must give every ambient_generic entity that you intend to have looping and starting on a targetname of sound_auto. Also ensure that the start silent flag is enabled. Do that now.


    Workaround 1
    Simple, but only works for quick joiners.

    1. Wrap a trigger_once block around your info_player_deathmatch's
    2. IMPORTANT: Set the delay of this trigger_once to 1 second, also ensure you set the target to sound_auto
    3. Compile your map and start it on a listen server. There will be a tiny delay, but your ambient sound effects will work. It will also work if you're the first person to join the map on a dedicated server.

    No other players that join will be able to hear them. They'd need to join before the sounds are triggered to start.

    An example of this in action is my water works map. I've noticed that the sounds sort of change as time progresses though, as if there is slight echo or reverb being added, or something. However, I've never experienced a crash because of this - so it's fine for now I guess.

    If you really want other players to hear them too you can either increase the delay of your trigger_once to say 3 to 5 seconds, to ensure they join before the delay finishes. However the first one in would notice silence, then sound all of a sudden.

    Remember that a player will not hear the background sounds unless they are present in game at the moment they are switched on.


    Workaround 2
    More complicated, but works for all players including late joiners.

    Set up a multi_manager and two trigger_relay's as follows:
    1. Both trigger_relay's need to target sound_auto
    2. Give one of them the name sound_auto_off, and set it's target state mode to off
    3. Give the other one the name sound_auto_on, and set it's target state mode to on
    4. Give your multi_manager the name sound_auto_reset
    5. Set the multi_manager to target sound_auto_off in 1.00 second, and sound_auto_on in 1.05 seconds
    6. Set all your info_player_deathmatch's to target sound_auto_reset

    Bare in mind that using this approach would result in all ambient sound effects resetting every time someone spawns. There will also be a 0.05 second delay while the sounds are resetting. This is hardly noticeable unless you listen out for it specifically. You probably won't care if you do notice it anyway.

    This example works perfectly in my fail mountain map. Try it if you don't believe me.


    Workaround 3 (for Sven Co-op 4.1 or later only)
    This is similar to workaround 2, but much simpler as it uses a new multi_manager feature from Sven Co-op 4.1.

    Set up a multi_manager called sound_auto_reset with the following trigger entries:
    1. Key sound_auto with a value of 1#0
    2. Key sound_auto#1 with a value of 1.05#1

    Set all your info_player_deathmatch's to target sound_auto_reset.

    Bare in mind that using this approach would result in all ambient sound effects resetting every time someone spawns. There will also be a 0.05 second delay while the sounds are resetting. This is hardly noticeable unless you listen out for it specifically. You probably won't care if you do notice it anyway.

    This example works perfectly in my polar rescue map. You can't try it yet though!


    Got a better idea?

    I'd love to hear it
    Last edited by AdamR; 17-09-2009 at 06:35 AM.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  2. #2
    Donated 15NS$ for Sven's Holiday at the Bahamas Puchi's Avatar  
    Artist
    Join Date
    Nov 2002
    Location
    Akihabara, Bochum or Sailune
    Posts
    5,608

    Re: [Workaround] Getting background sounds to loop

    The HL/OpFor SP Map uses a trigger_auto to start all sounds, and a multimanager named game_playerjoin, triggering the sounds at 0 and 0.1 seconds to disable and enable them for the new player.
    Do it with passion, or not at all.
    Do not say everything you know. Know everything you say.
    [ MarySP ][ nacl-h2o ][ The next SC Version ♥♥♥♥ing pwns! ][Puchis Maps ]

  3. #3
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [uk]
    Posts
    8,487

    Re: [Workaround] Getting background sounds to loop

    The problem with using game_playerjoin is the reverb/distortion effect background sounds will be subject to as they play for longer and longer. You can avoid this by having your spawn points trigger a multi_manager instead.

    In Sven Co-op 4.1 with the multi_manager explicit on/off feature, you will be able to do:
    1. Set all ambient_generic's a name of sound_auto
    2. Set all info_player_deathmatch's to target sound_auto_reset
    3. Make a multi_manager called sound_auto_reset with these key pairs:
      • Key sound_auto, value 0.01#0 to switch all sounds off
      • Key sound_auto#1, value 0.02#1 to switch all sounds on

    (added this as workaround 3)
    Last edited by AdamR; 17-09-2009 at 06:36 AM.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  4. #4
    Donated 15NS$ for Sven's Holiday at the Bahamas Puchi's Avatar  
    Artist
    Join Date
    Nov 2002
    Location
    Akihabara, Bochum or Sailune
    Posts
    5,608

    Re: [Workaround] Getting background sounds to loop

    Quote Originally Posted by AdamR View Post
    The problem with using game_playerjoin is the reverb/distortion effect background sounds will be subject to as they play for longer and longer. You can avoid this by having your spawn points trigger a multi_manager instead.
    i do not expect anyone to play the portal map for longer than 10-20 minutes anyway so its fine till the sound engine is done.
    Do it with passion, or not at all.
    Do not say everything you know. Know everything you say.
    [ MarySP ][ nacl-h2o ][ The next SC Version ♥♥♥♥ing pwns! ][Puchis Maps ]

  5. #5
    a person RNG's Avatar  
    Contributor
    Join Date
    Sep 2006
    Posts
    3,842

    Re: [Workaround] Getting background sounds to loop

    mp3s tend to always loop

  6. #6
    Donated 15NS$ for Sven's Holiday at the Bahamas Puchi's Avatar  
    Artist
    Join Date
    Nov 2002
    Location
    Akihabara, Bochum or Sailune
    Posts
    5,608

    Re: [Workaround] Getting background sounds to loop

    technically they're played once by the entity: you can trigger it any time and it starts. this is a not yet implemented feature.
    Do it with passion, or not at all.
    Do not say everything you know. Know everything you say.
    [ MarySP ][ nacl-h2o ][ The next SC Version ♥♥♥♥ing pwns! ][Puchis Maps ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •