/usr/share/faust/webaudio/ExportLib.js is in faust-common 0.9.95~repack1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /************************************************************
***************** Interface to FaustWeb *********************
************************************************************/
//--- Send asynchronous GET request to faustweb to get the list of available targets
// @exportUrl : url of FaustWeb service to target
// @callback : function called once request succeeded
// - @param : the available targets as a JSON application
// json = {"platform1":["arch1", "arch2", ..., "archn"], ... , "platformn":["arch1", "arch2", ..., "archn"]}
function getTargets(exportUrl, callback, errCallback){
var getrequest = new XMLHttpRequest();
getrequest.onreadystatechange = function() {
if(getrequest.readyState == 4 && getrequest.status == 200)
callback(getrequest.responseText);
else if(getrequest.readyState == 4 && getrequest.status == 400)
errCallback(getrequest.responseText);
}
var targetsUrl = exportUrl + "/targets";
getrequest.open("GET", targetsUrl, true);
getrequest.send(null);
}
//--- Send asynchronous POST request to faustweb to compile a faust DSP
// @exportUrl : url of FaustWeb service to target
// @name : name of DSP to compile
// @source_code : faust code to compile
// @callback : function called once request succeeded
// - @param : the sha key corresponding to source_code
function getSHAKey(exportUrl, name, source_code, callback, errCallback){
var filename = name+".dsp";
var file = new File([source_code], filename);
var newRequest = new XMLHttpRequest();
var params = new FormData();
params.append('file', file);
var urlToTarget = exportUrl + "/filepost";
newRequest.open("POST", urlToTarget, true);
newRequest.onreadystatechange = function() {
if(newRequest.readyState == 4 && newRequest.status == 200)
callback(newRequest.responseText);
else if(newRequest.readyState == 4 && newRequest.status == 400)
errCallback(newRequest.responseText);
}
newRequest.send(params);
}
//--- Send asynchronous GET request to precompile target
// @exportUrl : url of FaustWeb service to target
// @sha : sha key of DSP to precompile
// @platform/architecture : platform/architecture to precompile
// @callback : function called once request succeeded
// - @param : the sha key
function sendPrecompileRequest(exportUrl, sha, platform, architecture, callback){
var getrequest = new XMLHttpRequest();
getrequest.onreadystatechange = function() {
if(getrequest.readyState == 4)
callback(sha);
}
var compileUrl = exportUrl + "/" + sha + "/" + platform + "/" + architecture + "/precompile" ;
getrequest.open("GET", compileUrl, true);
getrequest.send(null);
}
//--- Transform target
// WARNING = THIS FUNCTION REQUIRES QRCODE.JS TO BE INCLUDED IN YOUR HTML FILE
// @exportUrl : url of FaustWeb service to target
// @sha : sha key of DSP
// @platform/architecture/target : platform/architecture/target compiled
// @cote : width and height of the returned QrCode
function getQrCode(url, sha, plateform, architecture, target, size){
var downloadString = url + "/" + sha + "/" + plateform + "/" + architecture + "/" + target;
var whiteContainer = document.createElement('div');
whiteContainer.style.cssText = "width:" + size.toString() + "px; height:" + size.toString() + "px; background-color:white; position:relative; margin-left:auto; margin-right:auto; padding:3px;";
var qqDiv = document.createElement('qrcode');
var qq = new QRCode(qqDiv, {
text: downloadString,
width: size,
height: size,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
whiteContainer.appendChild(qqDiv);
return whiteContainer;
}
// Return the array of available platforms from the json description
function getPlatforms(json){
var platforms = [];
var data = JSON.parse(json);
var index = 0;
for (var p in data) {
platforms[index] = p;
index++;
}
return platforms;
}
// Return the list of available architectures for a specific platform
// from the json description
function getArchitectures(json, platform){
var architectures = [];
var data = JSON.parse(json);
return data[platform]
// var archs = data[platform];
// for (var i =0; i<archs.length; i++)
// architectures[i] = archs[i];
//
// return architectures;
}
|