iPhone AVCaptureDeviceInput How to Set Quality of Audio Capture?

橙三吉。 提交于 2019-12-01 01:09:22

This should do the trick.

More here

http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html

 union 
 {
    OSStatus propertyResult;
    char a[4];
 } u;

 Float64 F64sampleRate = 8192.0;

 Float64 F64realSampleRate = 0;
 UInt32 F64datasize = 8;

 u.propertyResult = AudioSessionSetProperty (  kAudioSessionProperty_PreferredHardwareSampleRate ,sizeof(F64sampleRate) , &F64sampleRate );
 NSLog(@"Set Error Set Sample Rate %ld %lx %c%c%c%c",u.propertyResult,u.propertyResult,u.a[3],u.a[2],u.a[1],u.a[0]);

 u.propertyResult = AudioSessionGetProperty ( kAudioSessionProperty_CurrentHardwareSampleRate , &F64datasize, &F64realSampleRate );
 NSLog(@"Get Error Current Sample Rate %ld %lx %c%c%c%c",u.propertyResult,u.propertyResult,u.a[3],u.a[2],u.a[1],u.a[0]);
 NSLog(@"Sample Rate is %f",F64realSampleRate);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!