3

since Apple anounced that every app has to support 64-bit starting February 1rst, I can't use Dirac3LE anymore. So I found Superpowered which seems to do the same. The only problem I currently see is, that I can't get it to play songs from the iPod Library.

I've tried importing the song via AVAssetExportSession but can't get it to work. This is the code I've tried so far:

NSURL *url = [playingSong valueForProperty:MPMediaItemPropertyAssetURL];

AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL:url options:nil];
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName: AVAssetExportPresetPassthrough];
exporter.outputFileType = @"com.apple.coreaudio-format";
NSString *fname = [[NSString stringWithFormat:@"tmp"] stringByAppendingString:@".mp3"];
NSString *tempPath = NSTemporaryDirectory();
NSString *exportFile = [tempPath stringByAppendingPathComponent: fname];
exporter.outputURL = [NSURL fileURLWithPath:exportFile];
[exporter exportAsynchronouslyWithCompletionHandler:^{
    self.player = [[SuperpoweredAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:exportFile]];
    [self.player play];
}];

With opening the file via:

player->open([[url path] fileSystemRepresentation]);

Even if this would work, I'm kind of concerned if this would be fast enough for a music player. Importing a song, as soon as the other finished.

Are there any other options?

Thanks!

Jan
  • 1,827
  • 2
  • 16
  • 29
  • I was also using superpowered sdk but I am not able to do time stretching. Could you please help me? Thanks in advance – Jasmeet Singh Feb 05 '15 at 13:24
  • since I didn't get the import working in an appropriate time, I don't use superpowered. If it's only about time stretching avaudioplayer would be sufficient. otherwise you could consider MTAudioProcessingTap and corresponding AudioUnits. – Jan Feb 05 '15 at 14:22
  • @Dimitri: Did you find any solution for this? – Sunil Chauhan Nov 03 '16 at 13:10

1 Answers1

3

if you have a MPMediaItem *item got from iTunes Library, you can use:

player->open([[item assetURL].absoluteString UTF8String]);
Mariano
  • 330
  • 1
  • 4
  • 13