mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
21 lines
No EOL
543 B
JavaScript
21 lines
No EOL
543 B
JavaScript
define(["Tone/core/Tone", "Tone/core/Offline", "helper/BufferTest", "Tone/core/Master"],
|
|
function (Tone, Offline, BufferTest, Master) {
|
|
|
|
return function(callback, duration, channels){
|
|
duration = duration || 0.1;
|
|
channels = channels || 1;
|
|
return Offline(function(Transport){
|
|
var testFn = callback(Transport);
|
|
if (testFn){
|
|
Transport.context.on("tick", function(){
|
|
testFn(Transport.now());
|
|
});
|
|
}
|
|
}, duration).then(function(buffer){
|
|
if (channels === 1){
|
|
buffer.toMono();
|
|
}
|
|
return buffer;
|
|
});
|
|
};
|
|
}); |