objective-c - AVAudioSession AVAudioRecorder 錄音之後再播放的時候,在剛播放的時候有段雜音
PHP中文网
PHP中文网 2017-05-02 09:21:22
0
0
397

有哪位大神遇見過?具體程式碼如下:

AVAudioSession *session = [AVAudioSession sharedInstance];
    [session setCategory:AVAudioSessionCategoryRecord error:nil];
    UInt32 doChangeDefaultRoute = 1;
    AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, sizeof (doChangeDefaultRoute), &doChangeDefaultRoute);
    
    NSDictionary *recordSetting = [NSDictionary
                          dictionaryWithObjectsAndKeys:
                          [NSNumber numberWithInt:AVAudioQualityMin],
                          AVEncoderAudioQualityKey,
                          [NSNumber numberWithInt:16],
                          AVEncoderBitRateKey,
                          [NSNumber numberWithInt: 2],
                          AVNumberOfChannelsKey,
                          [NSNumber numberWithFloat:44100.0],
                          AVSampleRateKey,
                          nil];
    
    
    // Initiate and prepare the recorder
    _recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:NULL];
    _recorder.delegate = self;
    _recorder.meteringEnabled = YES;
    [_recorder prepareToRecord];
PHP中文网
PHP中文网

认证0级讲师

全部回覆(0)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板