Using AVAudioRecorder on Mac

谁说我不能喝 提交于 2020-01-13 16:23:48

问题


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

says that AVAudioSession can be used to configure the audio session

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

But the AVFoundation Framework lacks the AVAudioSession on OS X.

So we get the error, use of undeclared identifier AVAudioSession.

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

Any thoughts on this?


回答1:


Use Audio Hardware Services (https://developer.apple.com/library/mac/documentation/AudioToolbox/Reference/AudioHardwareServicesReference/) 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);


来源:https://stackoverflow.com/questions/11867657/using-avaudiorecorder-on-mac

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