【问题标题】:Using AVAudioRecorder on Mac在 Mac 上使用 AVAudioRecorder
【发布时间】:2012-08-08 15:12:29
【问题描述】:

此处的 AVAudioRecorder 类参考:

https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008238

说AVAudioSession可以用来配置音频会话

要配置适当的音频会话进行录制,请参阅 AVAudioSession 类参考和 AVAudioSessionDelegate 协议参考。

但 AVFoundation 框架在 OS X 上缺少 AVAudioSession。

所以我们得到了错误,use of undeclared identifier AVAudioSession

所以我查看了 OS X AVFoundation Framework,发现 AVAudioSession.h 不见了!

对此有什么想法吗?

【问题讨论】:

  • 看起来 OSX 中没有 AVAudioSession。我只是开始录制并暂停它。如果我需要播放它,我使用 AVExportSession 将暂停的录音文件导出到 m4a。
  • 我在 Mac 上使用命令行工具制作了录音机。但是当我使用 [AVAudioRecorder record] 录制时,总是显示错误“[plugin] AddInstanceForFactory: No factory registered for id

标签: objective-c macos avaudiorecorder avaudiosession


【解决方案1】:

使用来自AudioToolboxAudio Hardware Services 而不是AVAudioSession。这是可能的解决方案:AVAudioSession alternative on OSX to get audio driver sample rate

我做了一些小的修改,比如线条:

AudioDeviceID deviceID;
OSStatus err = AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &addr, 0, NULL, &size, &deviceID);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    • 1970-01-01
    • 2016-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多