cari

Rumah  >  Soal Jawab  >  teks badan

objective-c - AVAudioSession AVAudioRecorder 录音之后再播放的时候,在刚播放的时候有段杂音

有哪位大神遇见过?具体代码如下:

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中文网2758 hari yang lalu398

membalas semua(0)saya akan balas

Tiada jawapan
  • Batalbalas