【问题标题】:Set Recording Format for AVAudioEngine in Objective-C在 Objective-C 中为 AVAudioEngine 设置录制格式
【发布时间】:2019-05-15 19:38:30
【问题描述】:

在 Swift 中,您可以使用以下方法设置录制格式:

let format = AVAudioFormat(commonFormat: AVAudioCommonFormat.pcmFormatInt16, sampleRate: hwSampleRate, channels: 1, interleaved: false)

我正在为如何在 Objective C 中做到这一点而苦苦挣扎,并且自动完成功能也没有通过:

AVAudioFormat *newFormat = ??? 

(我需要以设置只读属性的 sampleRate 的方式创建它。)

【问题讨论】:

    标签: ios objective-c avaudiosession avaudioengine


    【解决方案1】:

    试试

    AVAudioFormat *newFormat = ((AVAudioFormat alloc) initWithCommonFormat:(AVAudioCommonFormat)format sampleRate:(double)sampleRate channels:(AVAudioChannelCount)channels interleaved:(BOOL)interleaved); 
    

    您可以在docs 中找到它。您只需在顶部栏中选择 Objective-C 作为语言。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多