LoginSignup
1
2

More than 3 years have passed since last update.

メモ イヤホン抜き差し

Posted at

iOSでAudioKitを利用して音を入力する機能を実装する際、本体とイヤホンのマイクを考慮する必要がある。
本体とマイクとでは、サンプルレートが異なることがあり、本体は44.1kHz、iPhone同梱のLightningイヤホンは48kHzとなる。
抜き差しは、AVAudioSessionRouteChangeNotificationを利用するのではなく、AVAudioEngineConfigurationChangeNotificationをトリガーにして、AKMicrophoneを再インスタンス化しつなげ直し、AVAudioEngineを再開させる(AKManager.engine.start())。
また、AudioKitAVAudioEngineConfigurationChangeNotificationをハンドリングしているので、事前に無効にしておく (AKSettings.enableCategoryChangeHandling = false)。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2