Commit ebbc2053 authored by Jakub Fiala's avatar Jakub Fiala

removed old loadSample implementation

parent efdb9bd5
......@@ -33367,8 +33367,10 @@ maximJs.maxiTools.loadSample = function(url, samplePlayer, contextIn) {
var data = [];
var context;
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if(!contextIn){
context = new (window.AudioContext || window.webkitAudioContext)();
context = new AudioContext();
} else {
context = contextIn;
}
......@@ -33471,37 +33473,37 @@ maximJs.maxiTools.loadSample = function(url, samplePlayer, contextIn) {
};
maximJs.maxiTools.loadSample = (function(url, samplePlayer, contextIn) {
var data = [];
var context;
if (!contextIn) {
context = new (window.AudioContext || window.webkitAudioContext);
} else {
context = contextIn;
}
samplePlayer.clear();
var request = new XMLHttpRequest;
request.addEventListener("load", (function(evt) {
console.log("The transfer is complete.");
}));
request.open("GET", url, true);
request.responseType = "arraybuffer";
request.onload = (function() {
context.decodeAudioData(request.response, (function(buffer) {
data = buffer.getChannelData(0);
if (data) {
var myBufferData = new Module.VectorDouble;
for (var n = 0; n < data.length; n++) {
myBufferData.push_back(data[n]);
}
samplePlayer.setSample(myBufferData);
}
}), (function(buffer) {
console.log("Error decoding source!");
}));
});
request.send();
});
// maximJs.maxiTools.loadSample = (function(url, samplePlayer, contextIn) {
// var data = [];
// var context;
// if (!contextIn) {
// context = new (window.AudioContext || window.webkitAudioContext);
// } else {
// context = contextIn;
// }
// samplePlayer.clear();
// var request = new XMLHttpRequest;
// request.addEventListener("load", (function(evt) {
// console.log("The transfer is complete.");
// }));
// request.open("GET", url, true);
// request.responseType = "arraybuffer";
// request.onload = (function() {
// context.decodeAudioData(request.response, (function(buffer) {
// data = buffer.getChannelData(0);
// if (data) {
// var myBufferData = new Module.VectorDouble;
// for (var n = 0; n < data.length; n++) {
// myBufferData.push_back(data[n]);
// }
// samplePlayer.setSample(myBufferData);
// }
// }), (function(buffer) {
// console.log("Error decoding source!");
// }));
// });
// request.send();
// });
maximJs.maxiAudio = (function() {
var numChannels = 2;
var output = 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment