有人可以解释我们如何在iPhone上合并2个mp3文件吗?有可能吗?
答案 0 :(得分:0)
尝试以下代码,它用于连接而不是混合。 没有测试过自己,但我很快就会
NSMutableData *part1=[NSMutableData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"part1" ofType: @"mp3"]];
NSMutableData *part2=[NSMutableData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"part2" ofType: @"mp3"]];
[part1 appendData: part2];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *mp3file = [documentsDirectory stringByAppendingPathComponent: @"test.mp3"];
[part1 writeToFile: mp3file atomically:YES];
我认为应该有效