在Mac上使用AVAudioRecorder

在Mac上使用AVAudioRecorder

问题描述:

可在此处找到AVAudioRecorder类参考:

The AVAudioRecorder Class Reference found here:

说AVAudioSession可用于配置音频会话

says that AVAudioSession can be used to configure the audio session

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

To configure an appropriate audio session for recording, refer to AVAudioSession Class Reference and AVAudioSessionDelegate Protocol Reference.

但是AVFoundation框架在OS X上缺少AVAudioSession.

But the AVFoundation Framework lacks the AVAudioSession on OS X.

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

因此,我调查了OS X AVFoundation框架,发现AVAudioSession.h丢失了!

So I looked into OS X AVFoundation Framework and found out that AVAudioSession.h is missing!

对此有何想法?

使用音频硬件服务来自 AudioToolbox 而不是AVAudioSession.以下是可能的解决方案:在OSX上 AVAudioSession替代音频驱动程序采样率

Use Audio Hardware Services from AudioToolbox instead of AVAudioSession. Here is the possible solution: AVAudioSession alternative on OSX to get audio driver sample rate

我做了一些小的修改,例如:

I made some small modifications like the lines:

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