本文整理汇总了Java中be.tarsos.dsp.AudioEvent.setFloatBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java AudioEvent.setFloatBuffer方法的具体用法?Java AudioEvent.setFloatBuffer怎么用?Java AudioEvent.setFloatBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类be.tarsos.dsp.AudioEvent
的用法示例。
在下文中一共展示了AudioEvent.setFloatBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import be.tarsos.dsp.AudioEvent; //导入方法依赖的package包/类
@Override
public boolean process(AudioEvent audioEvent) {
float[][] input = {audioEvent.getFloatBuffer()};
rbs.process(input, false);
int availableSamples = rbs.available();
while(availableSamples ==0){
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
availableSamples = rbs.available();
}
float[][] output = {new float[availableSamples]};
rbs.retrieve(output);
audioEvent.setFloatBuffer(output[0]);
return true;
}
示例2: process
import be.tarsos.dsp.AudioEvent; //导入方法依赖的package包/类
@Override
public boolean process(AudioEvent audioEvent) {
int i, used;
float[] src = audioEvent.getFloatBuffer();
float[] dest = new float[(int) Math.round(audioEvent.getBufferSize() / rate)];
used = 0;
i = 0;
// Process the last sample saved from the previous call first...
while (slopeCount <= 1.0f) {
dest[i] = (float)((1.0f - slopeCount) * prevSample + slopeCount * src[0]);
i++;
slopeCount += rate;
}
slopeCount -= 1.0f;
end:
while(true){
while (slopeCount > 1.0f) {
slopeCount -= 1.0f;
used++;
if (used >= src.length - 1)
break end;
}
if(i < dest.length){
dest[i] = (float)((1.0f - slopeCount) * src[used] + slopeCount * src[used + 1]);
}
i++;
slopeCount += rate;
}
//Store the last sample for the next round
prevSample = src[src.length - 1];
dispatcher.setStepSizeAndOverlap(dest.length, 0);
audioEvent.setFloatBuffer(dest);
return true;
}
示例3: process
import be.tarsos.dsp.AudioEvent; //导入方法依赖的package包/类
@Override
public boolean process(AudioEvent audioEvent) {
float[] src = audioEvent.getFloatBuffer();
//Creation of float array in loop could be prevented if src.length is known beforehand...
//Possible optimization is to instantiate it outside the loop and get a pointer to the
//array here, in the process method method.
float[] out = new float[(int) (src.length * factor)];
r.process(factor, src, 0, src.length, false, out, 0, out.length);
//The size of the output buffer changes (according to factor).
audioEvent.setFloatBuffer(out);
return true;
}