Sound Limitations

BlackRose

Forum User
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
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
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
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
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
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
*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.
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
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
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.
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
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
 

Troll-Brain

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

Troll-Brain

You can change this now in User CP.
> 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
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.
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 !!!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    Hmm, about the Headline News, I noticed threads are being moved into the subforum (Health News, Environmental News, etc.). When that happens, the TH Forum Home page loses the articles, and instead would show old articles posted 1 or 2 weeks ago.
  • tom_mai78101 tom_mai78101:
    What do we do with the Home page?
  • Ghan Ghan:
    I added those forums to the filter for that widget.
    +1
  • tom_mai78101 tom_mai78101:
    Oh nice. They're back. Thanks.
  • tom_mai78101 tom_mai78101:
    Now I think it makes more sense for me to put news in their own subforums, without worry.
  • The Helper The Helper:
    Awesome Ghan thanks! I was purposely not moving the first 15 news articles in Headline news to the different subforums but I guess I don't have to do that now?
  • tom_mai78101 tom_mai78101:
    Question: Is there a way to remove thread redirects? It creates a copy of the moved thread and takes up space, and I am leaning towards wanting to remove them in the Headline News. But if they have an expiration date, I guess I'm fine with it.
  • The Helper The Helper:
    If you move a thread please leave a permanent redirect. You can delete any redirects after 6 months. The redirects are left to help Search Engines find the moved content.
  • tom_mai78101 tom_mai78101:
    What if you move the permanent redirect, not the thread?
  • The Helper The Helper:
    I think that works but I have not messed with it. You can delete redirects though if you have to that will not delete the original thread
  • The Helper The Helper:
    if a redirect ends up in the same forum as the post it goes to though I think the redirect drops or fails or something but they are not bugged out and when you are working on an indirect the original post is safe.
  • The Helper The Helper:
    Happy Early Friday :)
    +1
  • V-SNES V-SNES:
    Happy Friday :)
  • tom_mai78101 tom_mai78101:
    Fun Friday for me
  • tom_mai78101 tom_mai78101:
    Happy Fun Friday to all.
    +2
  • The Helper The Helper:
    Happy Sunday everyone!!!
  • V-SNES V-SNES:
    Happy Sunday!!!
    +1
  • jonas jonas:
    Happy monday :p
  • jonas jonas:
    Everyone hates mondays?
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • jonas jonas:
    Happy belated tuesday
  • tom_mai78101 tom_mai78101:
    I found out you can't delete nor hide redirect links to existing threads. It will just stay there. I have no choice now but to start moving thread redirects to News Archive.
  • The Helper The Helper:
    That is not the way that it works for me I can delete redirects you just have to hit refresh sometimes big deletes will take a while as long as moves\
  • The Helper The Helper:
    You don't have to do that you can just leave stuff there in headline news for up to a year it was already down to like 8 months there is no rush.

    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