我使用assetUrl从iPod库中读取歌曲(在代码中命名为audioUrl)我可以用很多方式播放,我可以剪掉它,我可以用它来做一些但是......我真的不明白我要用这个做什么CMSampleBufferRef获取绘制波形的数据!我需要有关峰值的信息,我怎么能得到这个(也许是另一种)方式?
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? */}
Run Code Online (Sandbox Code Playgroud)
请帮我!