0

将 iPhone 更新到 iOS 7 后,我在使用 TPAACAudioConverter 时遇到问题。

给出错误“设置会话类别结果 560557673 21696E69 ini!” 错误给出“初始化音频会话结果 1768843636 696E6974 tini”</p>

我该如何解决?有时它会起作用。

-(void)convertToLowBWM4A
{
    [self.statusLine setText:@"Converting to 8Khz Audio..."];
    if ( ![TPAACAudioConverter AACConverterAvailable] ) {
        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Converting audio", @"")
                                     message:NSLocalizedString(@"Couldn't convert audio: Not supported on this device", @"")
                                    delegate:nil
                           cancelButtonTitle:nil
                           otherButtonTitles:NSLocalizedString(@"OK", @""), nil] show];
        return;
    }

//    // Initialise audio session, and register an interruption listener, important for AAC conversion
//    if ( !checkResult(AudioSessionInitialize(NULL, NULL, interruptionListener, (__bridge void *)(self)), "initialise audio session"))
//        {
//        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Converting audio", @"")
//                                     message:NSLocalizedString(@"Couldn't initialise audio session!", @"")
//                                    delegate:nil
//                           cancelButtonTitle:nil
//                           otherButtonTitles:NSLocalizedString(@"OK", @""), nil] show];
//        return;
//    }


    // Set up an audio session compatible with AAC conversion.  Note that AAC conversion is incompatible with any session that provides mixing with other device audio.
    UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;
    if ( !checkResult(AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(audioCategory), &audioCategory), "setup session category") ) {
        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Converting audio", @"")
                                     message:NSLocalizedString(@"Couldn't setup audio category!", @"")
                                    delegate:nil
                           cancelButtonTitle:nil
                           otherButtonTitles:NSLocalizedString(@"OK", @""), nil] show];
        return;
    }

    NSString *filenameStr = [NSString stringWithFormat:@"audio%@.m4a",[self.saveSongID lastObject]];

    NSString *convertedFilenameStr = [NSString stringWithFormat:@"converted%@",filenameStr];
    [self.convertedSongName addObject:convertedFilenameStr];
    NSLog(@"filenameStr %@",filenameStr);
    NSLog(@"convertedFilenameStr %@",convertedFilenameStr);
    audioConverter = [[TPAACAudioConverter alloc] initWithDelegate:self
                                                             source:[[self.docFolders objectAtIndex:0]stringByAppendingPathComponent:filenameStr]
                                                        destination:[[self.docFolders objectAtIndex:0] stringByAppendingPathComponent:convertedFilenameStr]];
   [audioConverter start];
}

干杯

德斯

4

1 回答 1

0

我最终使用 AVAssetWriter 和 AVAssetReader 来完成这项工作

于 2013-09-20T06:45:06.663 回答