wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-01-2009, 12:12 AM   #31
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 703

Submissions (1)

Fledermaus is a jewel in the rough (190)Fledermaus is a jewel in the rough (190)Fledermaus is a jewel in the rough (190)

Send a message via MSN to Fledermaus
Default

Quote:
Originally Posted by Rising_Dusk
I dunno, if TimerUtils red can get away with an H2I-MIN_HANDLE_ID approach, I don't think it's a problem. I do see your point here, though, but I'm just not sure.
Red does this though:

Expand JASS:
Fledermaus is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-01-2009, 12:15 AM   #32
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Or you could just use Table for all your hashing needs.

Anyway, is using timers really that much of an issue? In all cases, the timer will either match the sound perfectly or take longer than the sound, it will never finish faster than the sound (the ratio is 1:1 at fastest game speed). As such, the sound may not get recycled immediately when it finishes, but will recycle eventually. As such, it is a non-issue unless it's a looping sound, but why would you call ReleaseWhenDone on a non-looping sound?

Also, local player sounds should be a non-issue. You play a sound once, either for all players or a specific player. If you need to play it for another player later, you get a new sound for that; so, the sound will get recycled for all players the moment it finishes for whoever it was played (or later, as mentioned in the above paragraph).

I think the interface for this system could be simplified: a few functions could be merged, since I don't think anyone would ever use them separately anyway (Why would you ask for a sound if you weren't immediately planning on using it?): NewSound, RunSound and RecycleSoundWhenDone. Something like function RunSound takes soundhelper refSound, force playFor returns sound with completely automated recycling.

By the way, what's the point of starting a sound in a new thread?
__________________
Anitarf is offline   Reply With Quote
Old 09-01-2009, 12:35 AM   #33
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Anitarf
By the way, what's the point of starting a sound in a new thread?
Well, it's kind of redundant, I just realized. You can start a sound in a new thread to avoid having to initialize the sound by running it first, but since I run it on creation anyways, starting in a new thread is repetitive.

Hrm, you're right about the merging of all of those functions into a single function.. Personally, I like having access to the sound. Sometimes, I will call SetSoundVolume(MySound, 64) for a more quiet sound, and if I merged it all together I'd lose the ability to do that. I could certainly merge RunSound and RecycleSoundWhenDone, that one would make sense.
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-01-2009, 12:37 AM   #34
ToukoAozaki
extends net.wc3c.Jasser
 
Join Date: Jun 2008
Posts: 336

Submissions (5)

ToukoAozaki will become famous soon enough (60)ToukoAozaki will become famous soon enough (60)ToukoAozaki will become famous soon enough (60)

Send a message via MSN to ToukoAozaki
Default

Quote:
In all cases, the timer will either match the sound perfectly or take longer than the sound, it will never finish faster than the sound (the ratio is 1:1 at fastest game speed).

I didn't know that. I might have inferred the thing from Starcraft... Thx for the info.

Quote:
By the way, what's the point of starting a sound in a new thread?

AIK the sound won't play for the first time on the thread where it is created.

Last edited by ToukoAozaki : 09-01-2009 at 12:42 AM.
ToukoAozaki is offline   Reply With Quote
Old 09-01-2009, 12:47 AM   #35
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Rising_Dusk
Hrm, you're right about the merging of all of those functions into a single function.. Personally, I like having access to the sound. Sometimes, I will call SetSoundVolume(MySound, 64) for a more quiet sound, and if I merged it all together I'd lose the ability to do that. I could certainly merge RunSound and RecycleSoundWhenDone, that one would make sense.
Note that my version did return the sound for you to manipulate. I'm pretty sure you can modify the volume as the sound is already playing.
__________________

Last edited by Anitarf : 09-01-2009 at 12:48 AM.
Anitarf is offline   Reply With Quote
Old 09-01-2009, 12:57 AM   #36
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Oh, I didn't notice that yours returned the sound. Hrm... Maybe I'll try that..
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-03-2009, 02:04 AM   #37
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Okay, updated per Anitarf's suggestions. I tested the returned sound on RunSound for edit-ability with the standard sound API and it seems that he was right. You can edit a sound's settings while it is running. Because of that, NewSound, RecycleSoundWhenDone, ReleaseSound, and RunSound have been merged together into just RunSound, simplifying the API greatly. If you want to stop your sound prematurely (before the duration expires), StopSound works for that.
__________________

Last edited by Rising_Dusk : 09-03-2009 at 02:04 AM.
Rising_Dusk is offline   Reply With Quote
Old 09-03-2009, 02:55 AM   #38
fX_
User
 
fX_'s Avatar
 
Join Date: Jan 2007
Posts: 528

Submissions (2)

fX_ will become famous soon enough (38)fX_ will become famous soon enough (38)

Default

well about those settings, pitch is weird. you should be able to effectively pause a sound by setting its pitch to 0.0, and you can make all sorts of new sounds out of a sound file by changing its pitch, and freaky sounds by playing with the ptich as the sound is playing.

but i did some testing with changing pitch (coz i wanted to be able to pause sounds) and the result is sometihng like:
(result may be different but its somewhat like this as i remember)
you can decrease a sound's pitch before it plays, then increase it;
you cant decrease a sound's pitch when it is playing, then increase it;
you can keep increasing sound a sound's pitch (to the max (2.00?));
you can keep decreasing a sound's pitch.
- something buggy with either decreasing-then-increasing or increasing-then-decreasing (both as a sound is playing), can't remember. the subsequent part doesnt succeed.
fX_ is offline   Reply With Quote
Old 09-03-2009, 02:58 AM   #39
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Uh... an 8190 sized array in that struct means you can only have one sound type ever, no?
Bobo_The_Kodo is offline   Reply With Quote
Old 09-03-2009, 03:09 AM   #40
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Bobo_The_Kodo
Uh... an 8190 sized array in that struct means you can only have one sound type ever, no?
No, because it is static.
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-03-2009, 04:06 AM   #41
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Oo /fail
Bobo_The_Kodo is offline   Reply With Quote
Old 09-04-2009, 09:31 PM   #42
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,186

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Won't the current code recycle sounds even if they are looping sounds?

Another issue is the pitch, if it's set to a lower value by the user then the sound could get recycled before it even finishes. You'd need to do some hooking magic to SetSoundPitch as well as attaching timers to sounds to avoid that, though.
__________________
Anitarf is offline   Reply With Quote
Old 09-04-2009, 10:15 PM   #43
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Anitarf
Won't the current code recycle sounds even if they are looping sounds?
Haha, that's silly, I guess it will. To fix that, I'll need to bring back ReleaseSound. No big deal, I guess.
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-05-2009, 01:11 AM   #44
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

Collapse JASS:
    string  fileName           = ""
    integer duration           = 0
    boolean looping            = false
    boolean is3D               = false
    boolean stopwhenoutofrange = false
    integer fadeInRate         = 0
    integer fadeOutRate        = 0
    string  eaxSetting         = ""
Initializing them there is unnecessary when you're setting them all on creation
->
Collapse JASS:
    string  fileName
    integer duration
    boolean looping
    boolean is3D
    boolean stopwhenoutofrange
    integer fadeInRate
    integer fadeOutRate
    string  eaxSetting

Same with soundhelper struct

edit: Also, what does eaxSetting do?

Last edited by Bobo_The_Kodo : 09-05-2009 at 01:13 AM.
Bobo_The_Kodo is offline   Reply With Quote
Old 09-05-2009, 06:56 AM   #45
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

Quote:
AIK the sound won't play for the first time on the thread where it is created.

Didnt blizzard fix that with patch 1.23b or something?
Mr.Malte is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:38 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services