Question

i have issues with using TPAACAudioConverter once i updated my iPhone to iOS 7.

error given “setup session category result 560557673 21696E69 ini!” error given “initialise audio session result 1768843636 696E6974 tini”

how can i fix it ? and sometimes it works.

-(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];
}

cheers

des

Was it helpful?

Solution

i ended up using AVAssetWriter and AVAssetReader to do the job

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top