Skip to main content

Drawing waveform with AVAssetReader



I reading song from iPod library using assetUrl (in code it named audioUrl) I can play it many ways, I can cut it, I can make some precessing with this but... I really don't understand what I gonna do with this CMSampleBufferRef to get data for drawing waveform! I need info about peak values, how I can get it this (maybe another) way?







AVAssetTrack * songTrack = [audioUrl.tracks objectAtIndex:0];

AVAssetReaderTrackOutput * output = [[AVAssetReaderTrackOutput alloc] initWithTrack:songTrack outputSettings:nil];

[reader addOutput:output];

[output release];



NSMutableData * fullSongData = [[NSMutableData alloc] init];

[reader startReading];



while (reader.status == AVAssetReaderStatusReading){



AVAssetReaderTrackOutput * trackOutput =

(AVAssetReaderTrackOutput *)[reader.outputs objectAtIndex:0];



CMSampleBufferRef sampleBufferRef = [trackOutput copyNextSampleBuffer];



if (sampleBufferRef){/* what I gonna do with this? */}







Please help me!



Source: Tips4all

Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?