以下代码在44100深度2处工作正常(一些检查和代码消除),这似乎是默认值。由于此界面可用,但未记录良好,任何人都知道如何更改默认质量?
audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
captureSession = [[AVCaptureSession alloc] init];
audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:&error];
[captureSession addInput:audioInput];
audioOutput = [[AVCaptureAudioDataOutput alloc] init];
[audioOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
[captureSession addOutput:audioOutput];
答案 0 :(得分:1)
这应该可以解决问题。
更多信息
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);