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.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      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