- Joined
- May 2, 2015
- Messages
- 109
.RATORY-BUNDLE.
I do not need a GUI system.I have to use JASS as long as this system handles sound and I think JASS is better when creating a system for GUI user.
This system may not a GUI, but it supports GUI (GUI-friendly)
EDIT: If you really want a pure GUI system, just give me one or two system and I will try to convert it. (vJass > GUI)
Owh... . I'll update
Ow! I forgot. Thanks for reminding meIt should include a little guide only for GUI users /it's variables.
So, I have to use loop to get the instance, right?The user has to keep track of the sounds by himself at the moment which isn't really flexible and can be bothering to destinguish in GUI if one have lots of sounds.
I believe the system would be able to take take some workload from this aspect. The idea is that you internaly store the created sounds and bind them to the sound name (string).
Then when the user wants to play the sound:
Init:
Init
Events
Map initialization Conditions Actions
Set HolyBoltPath = test\HolyBolt.wav .... ....
And on use:
Set gRSParam_fileName = HolyBoltPath Set gRSParam_Which = gRS_Play ... Trigger - Run GUI RapidSound <gen> (ignoring conditions)
... is because my example didn't make much sense. When the user bothers to create a string variable for each sound, he also can bother to create an integer variable (with same descriptive name) for each sound which will be the sound instance/index.Forget my idea with the strings.
Why I meant this:
... is because my example didn't make much sense. When the user bothers to create a string variable for each sound, he also can bother to create an integer variable (with same descriptive name) for each sound which will be the sound instance/index.
Add in creating the sound on unknown string and I would approve it (but I'm just a spell reviewer so take that as you will).
Could you elaborate what you mean by example?But if you want to see the performance difference, create thousands of RapidSound instance and test using both method (integer, string), you'll see. When using string, the system will search any instance that match with the string. If 5000 instance exist, the system will loop 5000 time.
function RSStack_Create takes nothing returns integer
local integer this
if (udg_gRSStack_Recycle[0] == 0) then
set udg_gRSStack_InstanceCount = udg_gRSStack_InstanceCount + 1
set this = udg_gRSStack_InstanceCount
else
set this = udg_gRSStack_Recycle[0]
set udg_gRSStack_Recycle[0] = udg_gRSStack_Recycle[this]
set udg_gRSStack_First[this] = 0
endif
return this
endfunction
udg_gRSStack_InstanceCount
will increase by +1function gRS_GetRapidSound takes string fileName returns integer
local integer i = udg_gRSStack_InstanceCount
loop
exitwhen udg_gRS_SoundName[i] == fileName or i == 0
set i = i - 1
endloop
return i
endfunction
udg_gRSStack_InstanceCount
is 5000. The function will work like thisfunction gRS_GetRapidSound takes string fileName returns integer
local integer i = 5000
//loops until finished decreasing 5000 to 0 or when it found matching instance
loop
exitwhen udg_gRS_SoundName[i] == fileName or i == 0
set i = i - 1
endloop
return i
endfunction
Any answer?EDIT: I've been thinking (hardly), how to make system rejects invalid sound path when creating or playing?
I already said thatActually, I decided to replace the loop with hashtable in the next update.
Solved!Any answer?
function CreateRapidSound
then just function GRS_Create
, and so on.Wanted to update something else, or only because of the naming?I'll update
function StopRapidSound takes integer this, boolean fadeOut returns nothing
local integer i
loop
exitwhen i == MAX_COUNT()
call StopSound(udg_gRS_Sound[udg_gRS_List[udg_gRS_First[this] + i]], false, fadeOut)
set i = i + 1
endloop
endfunction
i
isn't initialisized, and would crash the running thread.There already exists vjass version. Maybe you want to suggest something at Quilnez thread if it's not good enough.Next update v2.0
- add vJass version
This system works just like you say.I thought it's very obvious, unless you don't even understand how it works.
0. Initial state
sound 1 | sound 2 | sound 3 | sound 4
1. call play function => dequeue and enqueue sound 1
sound 2 | sound 3 | sound 4 | sound 1
2. call play function again => dequeue and enqueue sound 2
sound 3 | sound 4 | sound 1 | sound 2
and so on.. If a sound is about to be dequeued and it's still playing, stop it first then replay.
That's the sole reason why it sounds like the sound is played rapidly (more than 4 handles at once).
Please download the test map and rapidly press Esc when you test it.1. call play function => pop and push sound 1
(after pop) sound 2 | sound 3 | sound 4
(after push) sound 1 | sound 2 | sound 3 | sound 4 => back to initial state again thus the rapid playing effect isn't achieved because you are only playing 1 sound handle all the time.