我正在尝试使用EQ制作一个播放器,获取Sound对象中的数据,但出于某种原因需要播放它,我无法从音轨的开头播放。
_out_snd.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound);
_channel = _out_snd.play(pos);
function processSound(event:SampleDataEvent):void {
_samples = new ByteArray();
var len:Number = buf[trackDesc].sound.extract(_samples, BUFFER_SIZE);
var i:int=0;
var l:Number;
var r:Number;
if ( len < BUFFER_SIZE ) { // If end of MP3, start over
len += buf[trackDesc].sound.extract(_samples,BUFFER_SIZE-len,0);
}
_samples.position = 0;
while (i < BUFFER_SIZE) {
event.data.writeFloat(_eqL.compute(_samples.readFloat()));
event.data.writeFloat(_eqR.compute(_samples.readFloat()));
i++;
}
}
请帮助,提前谢谢:)
答案 0 :(得分:0)
在我获得了赛道的位置之后
var len:Number = buf[trackDesc].sound.extract(_samples, BUFFER_SIZE,event.position);