|
Post by di on Dec 1, 2014 6:14:48 GMT
Any way to start playing sfx at the same time when i call MasterAudio.PlaySound? Right now, after calling MasterAudio.PlaySound, it starts playing sfx on next update call (next frame).
|
|
|
Post by DarkTonic Dev on Dec 1, 2014 6:34:42 GMT
Are you playing a resource file or an Audio clip? What version of Unity are you on? I thought that Audio clips play the same frame. Resource files have to load first, so that will take 1-6 frames or more depending on the file size and device speed.
Lastly, I need to ask: how do you know that it's waiting 1 frame? What tells you that?
|
|
|
Post by di on Dec 1, 2014 7:07:51 GMT
Are you playing a resource file or an Audio clip? What version of Unity are you on? I thought that Audio clips play the same frame. Resource files have to load first, so that will take 1-6 frames or more depending on the file size and device speed. Lastly, I need to ask: how do you know that it's waiting 1 frame? What tells you that? I'm playing audio clip. Unity 4.6. AudioSource starts playing on SoundGroupVariationUpdater.cs, right? As i understand, when i call MasterAudio.PlaySound, it just marks GroupVaritation that it should be played, and it starts playing inside Update method of SoundGroupVariationUpdater.cs. Since order of calling this method is unpredictable (no execute order specified), most probably it will be called next frame. It gives one frame delay. Changing the Update method to LateUpdate gives 0.003s delay instead of 0.033s (for 60 fps).
|
|
|
Post by DarkTonic Dev on Dec 1, 2014 7:18:56 GMT
Are you playing a resource file or an Audio clip? What version of Unity are you on? I thought that Audio clips play the same frame. Resource files have to load first, so that will take 1-6 frames or more depending on the file size and device speed. Lastly, I need to ask: how do you know that it's waiting 1 frame? What tells you that? I'm playing audio clip. Unity 4.6. AudioSource starts playing on SoundGroupVariationUpdater.cs, right? As i understand, when i call MasterAudio.PlaySound, it just marks GroupVaritation that it should be played, and it starts playing inside Update method of SoundGroupVariationUpdater.cs. Since order of calling this method is unpredictable (no execute order specified), most probably it will be called next frame. It gives one frame delay. Changing the Update method to LateUpdate gives 0.003s delay instead of 0.033s (for 60 fps). Good info! Would you suggest I change the method to LateUpdate then? I don't want people to have to mess with Script Execution Order. Is there anything bad about using LateUpdate? I've never used it before. I'm still not sure how you discovered that it was playing with a delay that short without investigating just for the heck of it though. I don't think I would hear that short of a delay.
|
|
|
Post by di on Dec 1, 2014 7:36:29 GMT
I'm playing audio clip. Unity 4.6. AudioSource starts playing on SoundGroupVariationUpdater.cs, right? As i understand, when i call MasterAudio.PlaySound, it just marks GroupVaritation that it should be played, and it starts playing inside Update method of SoundGroupVariationUpdater.cs. Since order of calling this method is unpredictable (no execute order specified), most probably it will be called next frame. It gives one frame delay. Changing the Update method to LateUpdate gives 0.003s delay instead of 0.033s (for 60 fps). Good info! Would you suggest I change the method to LateUpdate then? I don't want people to have to mess with Script Execution Order. Is there anything bad about using LateUpdate? I've never used it before. I'm still not sure how you discovered that it was playing with a delay that short without investigating just for the heck of it though. I don't think I would hear that short of a delay. You can hear difference if you start playing sound with standard unity method, and using master audio at the same time. Master audio's sound starts a little later. It depends on execution order of course. Changing Update to LateUpdate is easiest way to fix the problem. Nothing bad about LateUpdate, LateUpdates are same as Updates, they just get called after all Updates. We are already losing about 1/2 frame time on responding to touches, don't want to lose another 1 frame on sounds
|
|
|
Post by DarkTonic Dev on Dec 1, 2014 7:48:57 GMT
Ok I'll make that change in the next version. Thanks!
|
|