gpt4 book ai didi

iPhone AVCaptureDeviceInput 如何设置音频捕获的质量?

转载 作者:行者123 更新时间:2023-12-03 21:18:25 25 4
gpt4 key购买 nike

以下代码在 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];

最佳答案

这应该可以解决问题。

这里有更多内容

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

关于iPhone AVCaptureDeviceInput 如何设置音频捕获的质量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7796263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com