小编iFr*_*man的帖子

使用AVAssetReader绘制波形

我使用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)

请帮我!

iphone waveform ipod objective-c core-audio

78
推荐指数
2
解决办法
4万
查看次数

标签 统计

core-audio ×1

iphone ×1

ipod ×1

objective-c ×1

waveform ×1