Issue with sound

Level 7
Joined
Feb 3, 2013
Messages
277
In my arena map, I switch sounds in the game - when in arena battle music and when in shop different music; I get rid of the map music at map init - but what the f, it comes back later when I never called it to play. The issue is that sound is SO buggy, sometimes it'll not play - sometimes it'll overlap with the music... Does anyone know the foundations of how sound works in wc3?

And don't ask me to try setting the files as music files, it just makes the game lag hard - using files as sound makes it much more versatile in game.

EDIT: After a very long time..... with experimenting with music/sound files, I have found a consistent method to controlling in game music/sound files for those who want to be able to play different multiple sounds/musics and stop them whenever you want. THis is jass btw.

1st. At map init call ClearMapMusic() - TheDefaultMapMusic is very glitchy/buggy in my past experiences - it'll play without being told to whenever a sound is finished - Throw it away.
2nd. In the sound editor, for every music/sound you want to use in your map - USE AS SOUND FILE
3rd. If the sound/music file you want to play is like background and should be playing consistently - check the 'Looping' box in the sound variable's properties - else just leave all the boxes blank, it will play one shot and be done.
4th. When playing sound/music, use the PlaySoundBJ(gg_snd_'YourSoundVariableName') function and when stopping it use theStopSound(gg_snd_'YourSoundVariableName', false, true)
The second parameter boolean - KillSoundWhenDone - is set as false. You dont want to kill the sound because that will prevent you from being able to play it after the stopping it the first time. That's it

You can use music files, but for something huge like the wc3 ingame music - pausing the previous one and playing a new one periodically causes bursts of lag and its not something I like seeing in my game and I don't recommend it to others. I hope this helps anyone making maps.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,242
Here is how you can loop music

  • Untitled Trigger 089
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Sound - Stop music After fading
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Execution count of (This trigger)) mod 2) Equal to 1 // Just a test condition
        • Then - Actions
          • Sound - Play 1 <gen>
          • Sound - Set the music list to 1 <gen>, starting with song 0
        • Else - Actions
          • Sound - Play 2 <gen>
          • Sound - Set the music list to 2 <gen>, starting with song 0

But they are set as music, not sound...
 
Level 7
Joined
Feb 3, 2013
Messages
277
Here is how you can loop music

  • Untitled Trigger 089
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Sound - Stop music After fading
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Execution count of (This trigger)) mod 2) Equal to 1 // Just a test condition
        • Then - Actions
          • Sound - Play 1 <gen>
          • Sound - Set the music list to 1 <gen>, starting with song 0
        • Else - Actions
          • Sound - Play 2 <gen>
          • Sound - Set the music list to 2 <gen>, starting with song 0

But they are set as music, not sound...

Lol - so what am i supposed to do with this I don't understand.

To clarify the issue - what's supposed to happen is this. During battle mode play sound a, when not in battle mode play sound b, during boss mode play sound c and i also have different sounds playing for different units and etc.. The ones that always glitch are the sound files that were originally 'music' files but I've 'used as sound file' in the sound editor to prevent lag.

EDIT: Read first post ^^
 
Last edited:
Level 7
Joined
Feb 3, 2013
Messages
277
To prevent overlapping, you should always stop previously played music before playing another one.

You can only play one music at a time lol.

is the music you use as sound custom music or one already present in WC?

Present in wc3.

If you want you can store each sound you play into a variable so you can control them better.

Why? Sounds have already been set to a variable through the sound editor. To repeat what the sound editor did in jass would be waste of time.
 
Level 7
Joined
Feb 3, 2013
Messages
277
If you use sound, it will disappear when you tabbed out. (Also it cannot be turned off with warcraft audio settings.)

Meanwhile, music will still keep on playing even if you tabbed out and it can be disabled with warcraft audio settings.

I'm not sure what you mean by both statements. But uh.. if what you're saying is what I think it is - you're wrong.

My response to the first statement is obvious - both sound and music can be disabled in game (ctrl + s and ctrl + m for sound and music respectively). Disabling the sound will hush any sounds played via trigger using methods in my first post (Since they are sounds after all...). As far as alt tabbing goes - I've had all day to mess around with it while alt tabbing and it has not stopped at all. This was both multi and single player.
 
Alright I somehow misunderstood this as 'issue with background music' thread. Also I was replying to MasterTrainer. (I have no idea why I replied in the first place)


What I meant was, if you use a background music as 'sound', the music disappears when you tab out of the game. I tested this a lot of times, and Im sure Im right about it. I've also tested right before I replied this.

And what I meant with the 'warcraft audio settings' is actually the thing where you press F10, options etc etc. I mean that if background music is used as 'sound', players cant turn off the music with the F10 options.

Again, apologies for replying something thats unrelated. My sleepyness must have dulled my thoughts.
 
Top