Using Pan audio in swift

送分小仙女□ 提交于 2019-12-11 16:53:58

问题


I was wondering if there is a way to set pan audio to play on the right ear only for all music operating in the background. The idea would be to be able to start the app then any song played for example through Spotify or anywhere else would be played on just the right side. I am guessing it is not possible as this seems like too much control however I am wondering if anyone has an idea of how it could work.


回答1:


You can go to Settings > General > Accessibility to pan audio. That is already an iOS feature.

Follow up Question: Are you wanting to hear only the right channel? Stereo audio isn't always the same thing coming through both left and right. You would need to enable Mono Audio then pan to the right.

to Pan from your app:

let audioPlayer = AVAudioPlayer()
audioPlayer.pan = -1.0 // Pans hard Left
audioPlayer.pan = 1.0 // Pans hard Right
audioPlayer.pan = 0.0 // Pans Center


来源:https://stackoverflow.com/questions/55699960/using-pan-audio-in-swift

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