views:

374

answers:

2

I find Apple's documentation quite limited on AudioFileStreamSeek and I cannot find any examples of actual usage anywhere. I have a working streaming audio player, but I just can't seem to get AudioFileStreamSeek to work as advertised...

Any help tips or a little example would be greatly appreciated!

A: 

Unless I'm mistaken, this is only available in the 3.0 SDK, and therefore under NDA. Maybe you should take this to the Apple Beta forums?

I stand corrected. AudioFileStreamSeek doesn't show up if you do a search in the online 2.2.1 documentation. You have to manually dig into the docs to find it.

Shawn Craver
No. I just check the XCode docs for AudioFileStreamSeek and it says: Available in iPhone OS 2.0 and later.
Paul
I stand corrected. AudioFileStreamSeek doesn't show up if you do a search in the online 2.2.1 documentation. You have to manually dig into the docs to find it.
Shawn Craver
A: 

I am told this works

AudioQueueStop( audioQueue, true ); UInt32 flags = 0; err = AudioFileStreamParseBytes(audioFileStream, length, bytes, kAudioFileStreamParseFlag_Discontinuity);

OSStatus status = AudioFileStreamSeek( audioFileStream, framePacket.mPacket, &currentOffset, &flags );
NSLog(@"Setting next byte offset to: %qi, flags: %d", (long long)currentOffset, flags);

// then read data from the new offset set by AudioFileStreamSeek
[fileHandle seekToFileOffset:currentOffset];
NSData * data = "" readDataOfLength:4096];

flags = kAudioFileStreamParseFlag_Discontinuity;
status = AudioFileStreamParseBytes( stream, [data length], [data bytes], flags );
if( status != noErr )
 NSLog(@"Error parsing bytes: %d", status);

}