-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio not playing first time through. #3
Comments
Issue turned out to be in GATSoundBank::LoadSampleFromResources. When using Resources.Load to generate a clip, the clips loadType was "Loading" instead of loaded and so the sound data grabbed was empty. |
TechniPoet, I'm running into this problem, is there a correction to issue I can make to correct it? |
Nothing will play for me unless i Load before I play, I've been putting Debug.Logs around trying to figure out what's happening to data, it all seems to be loading into memory but the default player shows no activity unless i Load the Sample Bank before Play. |
Hey guys, I'm really sorry I can't help much here. As I mentioned elsewhere, I can't maintain G-Audio anymore: my current full time job does not use Unity, and 2 small kids tend to eat up any free time that's left ( great feeling by the way ). I'd say you should make sure that the allocator is properly initilaized ( GATDataAllocator ), and that sample banks are loaded ( GATSampleBank and friends, which work with GATSoundBank ). The whole editor audio thing was super shabby in Unity 4. I had a pretty rough time with it... Important question: does it work the first time around in builds? Another tip: add the GATDebug flag to get more info in the console. I really loved working on this project. It's heart-breaking to have abandoned it, but heart warming to see it's being watched and used! Finally. I just had news that Mini Metro won the IGF Award for Excellence in Audio and guess what? It uses G-Audio, albeit a heavily modified version. I'd say it's be worth a shot to get them to make their branch public if it isn't already! |
About that debug flag: GAT_DEBUG should be added to the define symbols |
Thank you gregzo, really appreciate you making the project public and for the direction. With that I will hopefully find the solution to what seems now to be a Unity5.3 issue. Answer: I haven't had it working even the first time around in builds. I really enjoy working with it and I'm glad others are too. :) |
I'm truly not seeing anything not working properly or not loading with all my debugging. Everything happens the same but audio only plays if I hit Load in the editor before I hit play. Hope TechniPoet has a lead on a solution, best I can think is rolling my projects back to 5.2 where everything still works. |
I just saw these messages, sorry for the late response. @gregzo Thanks for responding and for providing opening this project to be open source. Also congratulations on the Mini Metro news! @jackalborn-sean I did indeed solve this issue. My fix is patch work but works for my purposes at the moment though in the next month or so I will probably clean it up for a pull request when I find some free time. I'll post the code changes in the morning but if you are awake and eager, the quick trace explanation for finding the source is to go into the LoadAll() -> soundBank load call -> load clip I think -> loadFromResources -> here it loads the sound into a clip. The sound data is taken from the clip before it is fully loaded and unloaded if your application is playing. Because the data isn't loaded, you don't get any sound but the next time you load from resources the data is actually loaded, so we then have sound on the second attempt. I pretty much changed several of those functions into coroutines so that data isn't read from the clips before they are done being loaded and the sound bank doesn't return data to the sample bank until all the sounds are loaded. Better grammar, explanation, and code tomorrow when I'm less sleep deprived :) |
OK, Here is what I did to fix the problem, it is VERY patchwork to get it working. I use an empty singleton class called CoroutineMaster which is basically empty but allows me to bundle specific coroutines together. In GATSampleBankadd
Replace LoadAll() with
Add this function
GATSoundBankAdd
Change LoadAll() to
In LoadSample()
LoadSampleFromResourcesI commented a bunch of stuff out when searching for the error, sorry for gross commented out stuff
Final notesOnce again I know this is bad but it works and I'm a working student with 4 projects currently so if it compiles I'm happy. Hope this is helpful because it took me HOURS of tearing through this entire codebase. Also I currently am using Active Sample Bank and am not using the allocator so once I start caring about memory, this will probably fall by the wayside. |
@gregzo Any additional un-official documentation, examples, or literally anything else pertaining to this project would be super useful. I will very likely be using and modding this asset for months to come so any help is welcome help. Thanks! |
@TechniPoet Thank you so much for posting all that. I will get another chance to work with it tonight and I'll kick back anything I discover. I too had been digging through the codebase for some time so thanks again. I'll be using GAudio for my next few projects so I'll gladly try to contribute anything I can. |
So I'm running into this issue in both my project and the examples. The first time I hit play or load sample bank, no audio is produced but if I load and unload before hand, everything plays fine...
Any thoughts? I've been digging through the code and can't seem to figure out what's going on.
The text was updated successfully, but these errors were encountered: