AudioKit Lifecyle confusion

ⅰ亾dé卋堺 提交于 2019-12-11 10:16:15

问题


I can't wrap my head around this. I read everywhere (rightly) that Audiokit lifecyle should be managed in a singleton and kept away from the View Controllers lifecyle. Then I checked all the example project's code and found a bit confusing that

AudioKit.start() 

is always called in ViewDidload. But anyway thats not my real issue..

I have multiple ViewControllers that uses the AKMicrophone in a different way. For instance they need different categories, different AKSettings, and some must be plain microphones while some needs a long chain of initialization with effects and mixers (Just like the "Recorder" example project).

I have two related questions here:

  • I read on Github that when we change the routing or category, we need to reinitialize the AudioKit. But in this case where do we really do it? In my case I really only can think of "ViewWillAppear". (if Mic needs to start listening without needing a button click, with a different setup)

  • And real question is how do I do this correctly at all? For example in my project AKMicrophone is set up just like the "Recorder" example but in a Singleton class. And when I switch to another ViewController which requires a "plain" AKMicrohone right after view appears. How do I remove all those mixers and delays from the chain? This is not only a matter of changing some AKSetting and restarting the engine.

来源:https://stackoverflow.com/questions/55722923/audiokit-lifecyle-confusion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!