ooper-shlab/ToneGenerator1.0-Swift

Tone lag in iOS 11

lincbarr opened this issue · 4 comments

ToneGenerator1.0 works perfectly through iOS10. In iOS 11: Play the 440 hz tone then stop. Change the frequency, press start. The 440 Hz signal plays for a moment then the new tone is played. Change the frequency again and the old frequency plays for a moment before the new frequency.

Thanks for reporting. I'll check it when I can make some time for it.

Hi, in the first place I wanted to thank you for the very useful AVTonePlayerUnit subclass! I also had some issues (app hanging randomly) after upgrading to iOS11. (to reproduce this: start the sound and click start/stop about 50 times). It appears this problem sometimes occurs with the tone.stop() (hence AVTonePlayerUnit stop) function in AVFoundation. In iOS11 it seems to lead to concurrency issues, debugging pointed to __psynch_mutexwait. Using tone.pause() instead solved the issue for now.
Also (probably unrelated), the tone lag disappears after turning off and on the engine with engine.stop() / engine.start(). It's a workaround but may be of use if you plan to start/stop the sound regularly.

Sorry to have kept this issue for so long. I have merged ziyaointl's pull request, and the original issue #1 seems to be fixed. I have not tried to reproduce the issue described by tiemenc, but if it still happens and is a big issue, someone please report it as another issue. Thanks to all who has contributed to fix this issue.