本文介绍了在Mac上使用AVAudioRecorder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可在此处找到AVAudioRecorder类参考:

The AVAudioRecorder Class Reference found here:

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

说AVAudioSession可用于配置音频会话

says that AVAudioSession can be used to configure the audio session

但是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);

这篇关于在Mac上使用AVAudioRecorder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 02:17