感谢阅读,我有以下代码来阅读m4a音频文件,我有点迷失下一步是什么。我知道我需要实现SampleGrabber来获取样本。理想情况下,我希望能够获得峰值和当前音频,就像单击屏幕顶部的箭头时简单的itunes可视化器一样。现在,我主要担心将sampleGrabber添加到我的图表中,并调用SampleCB。这是我的图形构造:
public class Player
{
private IGraphBuilder graphbuilder;
private IMediaControl imc;
private IMediaEventEx imex;
private IMediaPosition imp;
private IBasicAudio iba;
private ISampleGrabber isg;
public Player(string file)
{
graphbuilder = (IGraphBuilder)new FilterGraph();
graphbuilder.RenderFile(location, null);
imc = (IMediaControl)graphbuilder;
imex = (IMediaEventEx)graphbuilder;
imp = (IMediaPosition)graphbuilder;
iba = (IBasicAudio)graphbuilder;
}
}
我在类中有其他方法可以播放,音量等等。并且扩展了所有属性以使它们具有动画效果,WPF风格,呵呵。现在我只是不知道在GraphBuilder中添加SampleGrabber的位置,以及如何使其转到SampleCB方法。另外,我是否必须使整个类继承自ISampleGrabberCB?我尝试过这些不同的组合,但无法做任何事情......