¡@

Home 

2014/10/15 ¤U¤È 10:09:26

iphone Programming Glossary: fullsongdata

Extract iPod Library raw PCM samples and play with sound effects

http://stackoverflow.com/questions/4796643/extract-ipod-library-raw-pcm-samples-and-play-with-sound-effects

alloc initWithTrack songTrack outputSettings nil reader addOutput output output release NSMutableData fullSongData NSMutableData alloc init reader startReading while reader.status AVAssetReaderStatusReading AVAssetReaderTrackOutput trackOutput.. CMBlockBufferCopyDataBytes blockBufferRef 0 length buffer NSData data NSData alloc initWithBytes buffer length length fullSongData appendData data data release CMSampleBufferInvalidate sampleBufferRef CFRelease sampleBufferRef if reader.status AVAssetReaderStatusFailed.. went wrong. Handle it. if reader.status AVAssetReaderStatusCompleted You're done. It worked. reader release return fullSongData autorelease I would recommend doing this on a background thread because it's time consuming. A drawback to this method is..

Drawing waveform with AVAssetReader

http://stackoverflow.com/questions/5032775/drawing-waveform-with-avassetreader

alloc initWithTrack songTrack outputSettings nil reader addOutput output output release NSMutableData fullSongData NSMutableData alloc init reader startReading while reader.status AVAssetReaderStatusReading AVAssetReaderTrackOutput trackOutput.. fmtDesc mBytesPerPacket fmtDesc mSampleRate UInt32 bytesPerSample 2 channelCount SInt16 normalizeMax 0 NSMutableData fullSongData NSMutableData alloc init reader startReading UInt64 totalBytes 0 SInt64 totalLeft 0 SInt64 totalRight 0 NSInteger sampleTally.. sampleTally samplesPerPixel left totalLeft sampleTally SInt16 fix abs left if fix normalizeMax normalizeMax fix fullSongData appendBytes left length sizeof left if channelCount 2 right totalRight sampleTally SInt16 fix abs right if fix normalizeMax..