|
Post by alexrousseau on Mar 16, 2016 14:44:59 GMT
Hi guys, First of all, nice job with Master Audio. It's not that easy to apprehend but it's a very powerful tool. I'm currently slowly replacing all my old sounds managers by Master Audio. I've got a tricky situation here and I'm sure it'll be faster to ask you the best way to solve the problem. I have multiple creatures talking to each other. I have two groups of sounds. (Short sound and long sound) I want to play a random sound in one of those groups. Pretty easy for the moment. Then I want a few other creatures to answer the first one. I want to choose a random sound from one of the groups for each creatures. But I don't want two creatures to say the same thing. So the idea would be to choose randomly a sound and then to be sure that this sound isn't played again until the next conversation. (Probably 2 minutes) I've got this working my way without MA. Is there a way to do that with Master Audio? Thanks guys
|
|
|
Post by DarkTonic Dev on Mar 16, 2016 19:50:54 GMT
You'll need to write your own code for "pick a random Sound Group between these 2" (short and long).
Then, if you can make sure that there are enough Variations in both Groups to last the entire conversation, you should be good. You can optionally refill their Variation pools at the end of each Conversation to start over with all Variations for the next conversation. With code:
MasterAudio.RefillSoundGroupPool("SoundGroupName");
If you're creating 2 different Sound Groups just for organizational purposes, you really could just have one Sound Group with all of it, then you wouldn't need to write the random Group-picking code.
|
|
|
Post by alexrousseau on Mar 17, 2016 8:36:23 GMT
Thanks for the answer. I'm doing two groups because I have a few rules. For example, I don't want an answer to be a long sound. It's long or short for the first one. Then only shorts. That's why I did that. Coding isn't a problem You didn't say it but I supposed I could find an option concerning Variation doing what I asked. I'm gonna look closely. Thanks for the line of code. I'm sure I'll need it soon enough ^^ I'll come back if I didn't find what I was looking for.
|
|
|
Post by alexrousseau on Mar 17, 2016 11:34:13 GMT
Here I am back again I've completed my random problems pretty easily with the variation parameters. So thanks for that. I'm now stuck on a very stupid problem. I'm trying to find the line of code to play one specific sound in a group of multiple sound. Like I want to play the first sound multiple times (not loop though) and then go on the second one. Everything in my code is ready. I just need to know how to play one sound. Looks like every PlaySound function takes the group and never just a sound or an additional index. Any idea? EDIT: MasterAudio.GetGroupInfo ("Vf_L1_Pu_Pulse").Group.transform.FindChild (soundName).GetComponent<SoundGroupVariation> ().Play () ; I could do something like that. But I'm sure there is a better way to do it.
|
|
|
Post by DarkTonic Dev on Mar 17, 2016 19:25:35 GMT
Wow, that code looks terrible. There's no way I would force people to use code like that. Intelli-sense, C# comments and the Master Audio API website are your friend.
There's a parameter for VariationName in all PlaySound methods. It's an optional parameter if you use C# (UnityScript doesn't have a concept of optional parameters).
For example:
MasterAudio.PlaySoundAndForget("Vf_L1_Pu_Pulse", 1f, 1f, 1f, "YourVariationName");
|
|
|
Post by alexrousseau on Mar 18, 2016 7:24:19 GMT
Oh ok. That's far far better ^^ Thanks a lot!
I've got one last question with this function. If I put volumePercentage let's say to 0.5f. Is the volume half of the original sound volume or half of what's left after removing the volume(Db) parameters in the editor?
Just in case I'm not clear here. Let's say my sound is 30Db and my volume parameters is -10;
Am I gonna get 30*0.5 = 15 or (30-10)*0.5f = 10 by using this function?
I'm sorry for asking so much question. You probably have better things to do ^^
|
|
|
Post by DarkTonic Dev on Mar 18, 2016 15:35:23 GMT
Not sure what you mean by "volume parameter" of -10.
But your volumePercentage set to .5 you can calculate like this.
See what the non dB value of -30 dB is. Then set your value to half of that. Then switch back to dB.
|
|
|
Post by alexrousseau on Mar 19, 2016 8:04:58 GMT
I was talking about the Volume(Db) parameter in this image. Is this also used when you call the PlayAndForgetFunction and if so, what's happening with the volume parameters in this function?
|
|
|
Post by DarkTonic Dev on Mar 19, 2016 21:33:37 GMT
As stated on this page of the docs: dl.dropboxusercontent.com/u/40293802/DarkTonic/MA_OnlineDocs/MasterAudioGO.htmThe volume for an individual sound effect being played is calculated as: (audio clip volume) X (group volume) X (bus volume - if any) X (master mixer volume). Then, convert that to dB if you like. If you pass in a volume for PlaySound methods, that will additional reduce the volume of the calculation by multiplying the result by what you pass in.
|
|