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
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
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
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
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?
 

BlackRose

Forum User
Reaction score
239
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.
 

Tyrulan

Ultra Cool Member
Reaction score
37
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.
 

BlackRose

Forum User
Reaction score
239
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 .__.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
*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.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
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.
 

Tyrulan

Ultra Cool Member
Reaction score
37
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).
 

BlackRose

Forum User
Reaction score
239
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]
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
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.
 

BlackRose

Forum User
Reaction score
239
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
 

Tyrulan

Ultra Cool Member
Reaction score
37
That's what I had in mind BlackRose. I'm not sure it will work but I think it's worth a try. Results?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
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.
 
Reaction score
456
> 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.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
> 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.
 

tooltiperror

Super Moderator
Reaction score
231
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, "" )
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
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 !!!
 

tooltiperror

Super Moderator
Reaction score
231
So Sounds have to be nulled first?

That's annoying.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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