|
Post by artaka on Dec 16, 2014 19:16:26 GMT
Hey Brian, When I activate Gapless Music Switching in the Advanced section, it causes a huge performance issue on IOS - framerate drops from 60 to 20 fps. I'm on Unity build 4.6.1 and MasterAudio build 3.5.6.9 on Mac. Here is a screenshot of the profiler. The blue at graph at the top corresponds to PlaylistController.CoUpdate() time.
|
|
|
Post by artaka on Dec 16, 2014 19:21:43 GMT
BTW: I'm not sure if this is related but I do get the warning about my MasterAudio being a child of another GameObject. However, the way my scenes are organized, I do need it to be a child of another GameObject.
|
|
|
Post by DarkTonic Dev on Dec 17, 2014 1:55:09 GMT
BTW: I'm not sure if this is related but I do get the warning about my MasterAudio being a child of another GameObject. However, the way my scenes are organized, I do need it to be a child of another GameObject. I'm not sure either, but I can't offer full support for that unsupported scenario. We can't test every configuration unfortunately. Your picture shows very high milliseconds for CoUpdate, and you have Deep Profile turned on, but I don't see any actual deep profiling happening (maybe doesn't work when deployed to I-device?). Can you get a more detailed profiler screen shot? A few questions to try and narrow down the slow part: 1) Is that Resource file music or an Audio Clip? 2) Do you have Ignore Time Scale turned on or not? 3) What iOS device were you using? Would like to know if it's very old or not (regardless, I still don't consider this an acceptable code speed). 4) Also take a profiler screen shot of the exact same thing running on your computer in Unity please and expand the CoUpdate part all the way down so I see what code is slow. 5) Do you have Load Resources Async turned on or not?
|
|
|
Post by DarkTonic Dev on Dec 17, 2014 2:33:54 GMT
I did a quick test I did on my PC with Gapless song transitions, 2 Audio Clips, Ignore Time Scale off. It shows CoUpdate taking only 0.03 seconds. So I'm pretty sure you have some weird setting that I don't have. I'm not seeing any slowness whatsoever. I would consider it extremely bizarre for iOS to execute the same code thousands of times slower.
I can't do anything else without more information from you.
-Brian
|
|
|
Post by artaka on Dec 17, 2014 2:42:03 GMT
The editor is a whole another story. The fps visibly degrates, but nothing shows up in the profiler showing what is causing it. If I turn that option off, all goes back to normal and I still seem to be getting gapless playback. There is definitely more depth in the profiler regarding under <CoUpdate>, but they all show 0 to minimal ms times. In fact there are a few instances of <CoUpdate> in the profile. See attached image. Unfortunately, for the iOS, I cannot get a deeper profile. Answers to your questions are below. 1. The resource is a Music file. The first half of the profile with solid blue is a looping 2 second music. The spiky area is another track that's longer than a minute. 2. No, I do not have Ignore Time Scale turned on. 3. iPad Retina 4. see attached
|
|
|
Post by DarkTonic Dev on Dec 17, 2014 3:37:54 GMT
First off, your game inside Unity will take a (sometimes big, depending on how many Sound Groups you have) hit to the FPS whenever the Master Audio prefab is selected. I didn't see much (if any) of a difference selecting Gapless in my Unity though. When you turn off Gapless in the editor, and you still get Gapless behavior, that's just because you're lucky enough that your frame rate is still high enough that it doesn't matter.
I'll do some more testing, but I have no idea why that speed is so slow. I don't know which line of code it is so it's either going to take awhile, or is not fixable for that platform. I'd have to recommend against using Gapless on iOS for the time being. The code is solid. It's not doing anything unnecessary.
Let me know if you can narrow it down at all. I assume you tried the same setup without Gapless on iOS? If so, how does it fare performance-wise?
|
|
|
Post by artaka on Dec 17, 2014 5:54:56 GMT
You are correct. Whenever framerate drops, it's no longer gapless without the "Gapless" option.
I did try to unparent MasterAudio so it no longer is a child of a gameObject. But that did not help either. Without Gapless, everything seems to work great, the game runs at 60fps. I'll keep you informed of any developments on this issue. For now, I'm going to have to set this a side to work on other more pressing issues. Thanks for looking into it.
|
|
|
Post by DarkTonic Dev on Dec 17, 2014 5:56:24 GMT
Ok, I'll try and see if I can reproduce with some sample musics on my iOS game.
|
|
|
Post by DarkTonic Dev on Dec 18, 2014 3:02:19 GMT
I just tested a 2-song Resource file Playlist with auto-advance and Gapless on my much older iPad2, and I'm seeing no large slowdown. PlaylistController.CoUpdate is taking 0.24 ms according to my profiler. Game is still getting 60 FPS.
So it appears to not be a problem with gapless in general but something specific (and maybe peculiar) on your setup. I don't think I can be of any more assistance unless you gather more information for me. If you could send me a stripped down project that reproduces the problem I can try and debug further. Sorry I can't be of more help.
-Brian
|
|
|
Post by artaka on Dec 18, 2014 3:25:27 GMT
Thanks for digging further. When I get back to it, I'll look at it in more detail and see if I can pinpoint the issue. Meanwhile, how do you have your music files set up? Are they compressed, native, loaded in memory or streaming or does that even matter? Thanks
|
|
|
Post by DarkTonic Dev on Dec 18, 2014 3:33:38 GMT
Thanks for digging further. When I get back to it, I'll look at it in more detail and see if I can pinpoint the issue. Meanwhile, how do you have your music files set up? Are they compressed, native, loaded in memory or streaming or does that even matter? Thanks Resources are always loaded fully into memory, so they can't stream. So even if the clips are marked as streaming, they will not stream. We have our music as compressed in memory. I don't think any of that will matter with Resource files though, at least as far as CoUpdate is concerned. However you might want to try every different file format. Ours were imported as wav files. Possible that an mp3 might take a lot more time to initialize - I know that's true of sound effects. Let me know what you find out.
|
|