首页 > 解决方案 > 如何在 iOS 14 Objective C 中录制立体声

问题描述

如何在 iOS 14 Objective C 中录制立体声

这是我的代码我现在不知道如何将AVAudioSessionPolarPatternStere o 添加到我的代码中 我找到了 Swift 的简单代码,但我需要在我的目标 c 代码中添加

    AVAudioSession * audioSession = [AVAudioSession sharedInstance];
    const AVAudioSessionPolarPattern AVAudioSessionPolarPatternStereo;
        
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
    [audioSession setActive:YES error:nil];
    
    NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
    
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
        
    

标签: objective-cnsmutablearrayavaudiosessionios14avaudiorecorder

解决方案


推荐阅读