Sound Limitations

BlackRose

Forum User
Reaction score
239
Are there like sound limitations? I've tried playing the FaerieDragonSound every 0.075 second but it will not work. Only 3 instances are played at once.

It's blargh. Other sounds such as: [ljass]"Sound\\Units\\Combat\\MetalLightSliceMetal2.wav"[/ljass] will play without limits...

Here's the method I am using:
JASS:
            method createBladeSound takes nothing returns nothing
                local integer r = GetRandomInt( 0, 2 )
                local sound   s = null

                //if r == 0 then
                    set s = CreateSound( SOUND_ONE, false, true, true, 10, 10, "" )
                    //call SetSoundParamsFromLabel( s, "FaerieDragonLaunch")

                /*elseif r == 1 then
                    set s = CreateSound( SOUND_TWO, false, true, true, 10, 10, "" )
                    call SetSoundParamsFromLabel( s, "FaerieDragonLaunch" )
                    call SetSoundDuration( s, SOUND_DUR_2 )
                elseif r == 2 then
                    set s = CreateSound( SOUND_THREE, false, true, true, 10, 10, "" )
                    call SetSoundParamsFromLabel( s, "FaerieDragonLaunch")
                    call SetSoundDuration( s, SOUND_DUR_3 )
                endif*/

                call    SetSoundVolume( s, PercentToInt( 100, 127 ) )
                call  SetSoundPosition( s, GetUnitX( this.caster ), GetUnitY( this.caster ), 100.00 )
                call        StartSound( s )
                call KillSoundWhenDone( s )
                set this.ticks = 0
                set s = null
            endmethod
 
Yes, there is a limittation.
At the sound editor, you can see the sound's 'Duration'

I've tried playing a sound file (Duration:2.001second) once every 2seconds, failed.
So, I tried 2.1 seconds.. Success

It seems that you can only spawn a sound only when that sound handle is done playing =/
Or sth like that.

I haven't tried sth like this, though:

Sound[0] = SameSound
Sound[1] = SameSound
Sound[3] = SameSound

Then, loop and play the sounds, lol
Might work, might not, I duno
 
I know.
It's the same.

I also used that exact same line of code you did.
I'm talking about the duration of the sound, that you can only see in the sound editor (Or if you know it because it's a custom sound file and you imported it =x)
There isn't a GetSoundDuration.. Is there?
 
I've tried with setting sound duration and without. Actually, you just gave me an idea of reimporting the sound and seeing if it work. I might test that later.

Hmm.. same sound handle? I'm creating new ones to play, not using same.
 
You are using the same handle...

A new handle would be by creating a struct specifically for the sound and moving your method into there.
 
You are using the same handle...

A new handle would be by creating a struct specifically for the sound and moving your method into there.

What is meant by handle?

Isn't the decleration of a 'local sound' a new handle? By the way, if I am doing it wrong, why does it work on other sounds but not some .__.
 
*Ahem* Duration *Ahem* Of *Ahem* Sound *Cough*

Maybe =/
I think he meant that actually creating a new handle everytime would actually work.
(Even though I have not tested it)

Something like that SameSound Array thingy, but local and not global.
 
Try without KillSoundWhenDone, and if it works then use a timer or a wait, to destroy the sound / recycle it after playing done.

Also be sure this.caster is a valid unit, and more the one expected (debug message).
And ofc display also X/Y.
 
The construction of a struct creates an "instance" of handles. In this case you need your handles to be separate so they will play at the same time. Local variables are overwritten each time the code is run regardless of local vs. global. Hence the need for structs in MUI. (Multi-Unit Instanceability). I am however, curious whether the sounds may be played at the same time over the same output stream.. (Wc3's sound stream).
 
Try without [ljass]KillSoundWhenDone[/ljass], and if it works then use a timer or a wait, to destroy the sound / recycle it after playing done.

Also be sure this.caster is a valid unit, and more the one expected (debug message).
And ofc display also X/Y.

Everything is valid...

I'll just attach the map.
This is my 'spell in working :D', so please don't ninja me in submission :O

Notice, when you cast Blade Barrier, there will be a 'metal ticking' with a few Faerie Dragon projectile launch sounds, if you set the sounds to the metal sounds, they'll play correctly and without limits. But change all to Faerie, and you will only hear like 3 per second....

[I've tried that new handle / struct thingy, but dunno if I did it right, see map]
 
Are you sure it doesn't work ?
I suppose some sounds "erase" other ones by their nature, and since your function get a random sound, that's not a proper test.

Also forgot this ugly stack of sound, just do like you did before, with the local.
 
Are you sure it doesn't work ?
I suppose some sounds "erase" other ones by their nature, and since your function get a random sound, that's not a proper test.

Also forgot this ugly stack of sound, just do like you did before, with the local.

Ok. Here it is.
JASS:
        private struct SoundData
            static method create takes unit u returns thistype
                local thistype this = thistype.allocate()
                local integer r = GetRandomInt( 0, 2 )
                local sound   s = null

                //if r == 0 then
                    set s = CreateSound("abilities\\Weapons\\FaerieDragonMissile\\FaerieDragonAttack.wav", false, true, true, 10, 10, "" )
                    call SetSoundDuration( s, 1200 )
                //elseif r == 1 then
                    //set s = CreateSound( SOUND_TWO, false, true, true, 10, 10, "" )
                    //call SetSoundDuration( s, SOUND_DUR_2 )
                //elseif r == 2 then
                    //set s = CreateSound( SOUND_THREE, false, true, true, 10, 10, "" )
                    //call SetSoundDuration( s, SOUND_DUR_3 )
                //endif

                call    SetSoundVolume( s, PercentToInt( SOUND_VOLUME, 127 ) )
                call  SetSoundPosition( s, GetUnitX( u ), GetUnitY( u ), 100.00 )
                call        StartSound( s )
                call KillSoundWhenDone( s )
                set s = null
                call this.destroy()
                return 0
            endmethod
            
        endstruct


--

SineCosine:
I think I just did what you did before and still failed :( Setting array's to sound and crap.

--

If ultimately, it's the sounds fault. I'll add that as a warning to the spell header :D
 
That's what I had in mind BlackRose. I'm not sure it will work but I think it's worth a try. Results?
 
Actually i think that each sound is played correctly but you have the impression that it doesn't played, or in other words that's the same sound.
You could try to give a different position for each sound.
But anyway it's obvious that only a sound with a short duration is adapted to be played such frequently.

There is also a rumour where sometimes a sound isn't played the first time you try to play it.
To be sure you can create X sounds in an array, play all of them at map initialization, and then use them in your spell.
 
> There is also a rumour where sometimes a sound isn't played the first time you try to play it.
Not a rumor. It is true. But not for the sounds you have 'created' in the sound editor. Also, it doesn't work at map initialization sometimes. The reason for that in my map is probably that I have cinematic filter on. Dunno.
 
> There is also a rumour where sometimes a sound isn't played the first time you try to play it.
Not a rumor. It is true. But not for the sounds you have 'created' in the sound editor. Also, it doesn't work at map initialization sometimes. The reason for that in my map is probably that I have cinematic filter on. Dunno.
The sound you have created in the sound editor is created on map init.
I have never "heard"/"seen", a such problem of not playing sound, but in an other hand i haven't used that much sounds.

All i can say, is that a sound is not played if wc3 is minimized, or if the player has turn off the sound in his wc3 settings, or if the sound is already playing (hence the reason of the creation of a sound each time you want to play it).
So it's locally dependant, and maybe this bug of not playing sound the first time is fixed in some patch, dunno.

EDIT


Or try that :
http://www.wc3c.net/showthread.php?t=107433
Basically he says that you can't play a sound in the same time (probably same thread) when it was created, but at least it works sometimes.
So it can't be the absolute truth, but it's worth a try.
Basically he recycles sounds, and play 0.001 second after the sound creation, so don't use KillSoundWhenDone if you use it.
 
Just a side note.

JASS:
//this.
                local sound   s = null

                    set s = CreateSound( SOUND_ONE, false, true, true, 10, 10, "" )


---->

JASS:
//to this.

                local sound   s = CreateSound( SOUND_ONE, false, true, true, 10, 10, "" )
 
No.
Because normally the sound is randomly created, but if you want to whine about that we can do that :

JASS:
local sound s // yeah we save a set to null !!!
 
So Sounds have to be nulled first?

That's annoying.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top