【发布时间】:2014-04-03 19:26:33
【问题描述】:
试图将两个缓冲区合并为一个; 我已经能够从音频文件创建两个缓冲区并加载和播放它们。现在我需要将两个缓冲区合并为一个缓冲区。它们如何合并?
context = new webkitAudioContext();
bufferLoader = new BufferLoader(
context,
[
'audio1.mp3',
'audio2.mp3',
],
finishedLoading
);
bufferLoader.load();
function finishedLoading(bufferList) {
// Create the two buffer sources and play them both together.
var source1 = context.createBufferSource();
var source2 = context.createBufferSource();
source1.buffer = bufferList[0];
source2.buffer = bufferList[1];
source1.connect(context.destination);
source2.connect(context.destination);
source1.start(0);
source2.start(0);
}
现在这些源分别加载并同时播放;但是如何将这两个源合并为一个缓冲区源?我不想附加它们,我想覆盖/合并它们。
解释和/或 sn-ps 会很棒。
【问题讨论】:
标签: javascript html audio html5-audio web-audio-api