tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 18, 2016 16:34:49 GMT
Hello,
First off, thanks a lot for making MasterAudio! I've been enjoying working with so far.
I have a specific scenario with multiple instances of a looping sound playing at the same time and I'm wondering how to implement it in the best way:
I have some wheels in the level. These wheels can be turned, and while they are turned, a looping sound should play until they stop. I want a maximum of 5 wheels to make a sound at the same time, so I set voices to 5.
Right now, I just use PlaySound3DAtTransform whenever a wheel starts, keep the returned reference to the PlaySoundResult and then call result.ActingVariation.Stop() and discard the reference when the wheel stops.
This works fine, but in some cases it seems that PlaySound3DAtTransform returns an instance that is still used by a different wheel.
Is it possible to only get unused instances from PlaySound3DAtTransform and mark them back as unused when I'm done with them?
Thanks, Tobias
|
|
|
Post by DarkTonic Dev on Aug 18, 2016 17:28:16 GMT
Set your "retrigger percentage" for the Sound Group to zero so Variations can't be stolen from other wheels. To verify it's stealing, look at the active voice count of that Sound Group in the Group Mixer of Master Audio. It probably is not 5.
You don't have to store the references to the variation because you can call MasterAudio.StopSoundGroupOfTransform to stop the sound.
|
|
tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 30, 2016 15:16:04 GMT
I've set the "retrigger percentage" to 0, yet I still experiencing the problem. My testing process: - I have a looping WheelTurning sound set to voices=2 and retriggerPercentage=0.
- I made two wheels, one bound to they key "1" and the other to the key "2".
- When I press the respective key, I call "PlaySound3DAtTransform"; when I release it, I call "StopSoundGroupOfTransform".
- I start the game and hold key 1 while repeatedly pressing and releasing 2.
Result: - For the first few seconds, the behaviour is as expected: Wheel 1 emits a continuous sound, while Wheel 2 starts and stops. The active voice count displays 1 and 2 respectively.
- At some point when I press 2 (while still holding 1), Wheel 1 suddenly stops emitting sound, the sound switches to Wheel 2, the active voice count displays 1 - and when I release 2 (while still holding 1), the sound stops and the voice count displays 0.
It usually takes a while until the problem appears. Maybe it has something to do with the sound being on loop and it's only protected in the first loop?
|
|
tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 30, 2016 15:23:09 GMT
Correction - I had the voices set to 10. If I set the voices to 2, the problem appears REALLY early, usually on my second or third press of 2.
I also just realized that varation mode was set to "Randomized". If it set it to "Top To Bottom", the sound gets stolen like explained in my previous post on every second press of 2.
|
|
|
Post by DarkTonic Dev on Aug 30, 2016 15:32:48 GMT
You're going to need to send me an example project that reproduces what you're seeing. It didn't happen in my tests.
|
|
tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 30, 2016 15:56:26 GMT
Sure. I'll send you a PM in a moment.
|
|
|
Post by DarkTonic Dev on Aug 30, 2016 18:59:51 GMT
Will check it out in the next day or 2. Thanks!
|
|
|
Post by DarkTonic Dev on Aug 30, 2016 19:12:02 GMT
Gawd, I gave you the wrong suggestion. Set retrigger percentage too 100, not zero to not allow stealing. Let me know if that takes care of the problem for you. I'm going to change the default for that field to 100 for the next update.
|
|
tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 31, 2016 11:05:24 GMT
Thanks for checking it so fast! Setting the retrigger percentage to 100 fixes the stealing, but under certain circumstances it seems to still try to play the clip; and since it can't steal it, it just plays nothing, despite other clips being free. You can reproduce the problem by: - Press and hold 1: First instance is playing
- Release 1: Nothing is playing
- Press and hold 1: Second instance is playing
- Press and hold 2: Second and third instances are playing
- Release 2: Second instance is playing
- Press and hold 2: Second and first instances are playing
- Release 2: Second instance is playing
- Press and hold 2: Second instance is playing, but not third
Note that steps 1. and 2. are necessary - if Wheel1 is bound to the first instance, everything is working fine! If it's the second or third instance, it sooner or later stops to additional calls to "PlaySound3DAtTransform".
|
|
|
Post by DarkTonic Dev on Aug 31, 2016 16:12:20 GMT
Turn on "log sounds" in advanced settings and let me know what gets printed to the console window on the time that it doesn't play anything please. It will probably say a few helpful things.
|
|
tobiasw
New Member
Posts: 10
Posts: 10
|
Post by tobiasw on Aug 31, 2016 17:12:48 GMT
When my first wheel uses the second instance and the second wheel tries to play that one:
T: 13.95489 - MasterAudio Cueing child 1 of Wheel T: 13.95489 - MasterAudio Child was busy. Cueing child {Wheel1} of Wheel T: 13.95489 - MasterAudio All children of Wheel were busy. Will not play this sound for this instance.
When my first wheel uses the first instance and the second wheel tries to play that one:
T: 25.21806 - MasterAudio Cueing child 0 of Wheel T: 25.21806 - MasterAudio Child was busy. Cueing child {Wheel1} of Wheel
|
|
|
Post by DarkTonic Dev on Aug 31, 2016 21:20:35 GMT
Yes, you've found a bug. I've fixed it for the next update. I'll send you the MasterAudio.cs file in your PM.
|
|
neyjay
New Member
Posts: 1
Posts: 1
|
Post by neyjay on Oct 11, 2016 15:24:05 GMT
Hey, we are having the same problem. Is it possible to have a fix for this or is the new update released soon?
|
|
|
Post by DarkTonic Dev on Oct 12, 2016 3:31:21 GMT
Email us with your asset store invoice PDF asking for the latest.
|
|