/usr/share/faust/webaudio/webaudio-asm-footer.html 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 | <script>
var isWebKitAudio = (typeof (webkitAudioContext) !== "undefined");
var audio_context = (isWebKitAudio) ? new webkitAudioContext() : new AudioContext();
var audio_input = null;
var DSP = null;
var faustsvg = null;
var dsp_code = null;
function changeBufferSize(buffer_size)
{
var new_buffer_size = buffer_size.options[buffer_size.selectedIndex].value;
console.log(new_buffer_size);
startNewDSP(new_buffer_size);
}
// Audio input handling
function activateAudioInput()
{
if (!navigator.getUserMedia) {
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
}
if (navigator.getUserMedia) {
navigator.getUserMedia({audio:true}, getDevice, function(e) {
alert('Error getting audio input');
console.log(e);
});
} else {
alert('Audio input API not available');
}
}
function getDevice(device)
{
// Create an AudioNode from the stream.
audio_input = audio_context.createMediaStreamSource(device);
// Connect it to the destination.
audio_input.connect(DSP.getProcessor());
}
function startDSPAux(buffer_size)
{
console.log("startDSP %d", buffer_size);
if (DSP) {
if (audio_input) {
audio_input.disconnect(DSP.getProcessor());
}
_f4u$t.hard_delete(faustsvg);
DSP.stop();
DSP.destroy();
}
DSP = faust.DSP(audio_context, buffer_size);
if (DSP.getNumInputs() > 0) {
activateAudioInput();
}
DSP.start();
console.log(DSP.json());
console.log(DSP.controls());
// kludge...ideally, this needs to not be part of the imported JS
_f4u$t.main_loop = function() {}
faustsvg = $('<div />');
$('body').append(faustsvg);
var handler = _f4u$t.main(DSP.json(), faustsvg, DSP.setParamValue);
DSP.setHandler(handler);
}
function startDSP()
{
startDSPAux(1024);
}
function startNewDSP(buffer_size)
{
startDSPAux(buffer_size);
}
// To activate audio on iOS
window.addEventListener('touchstart', function() {
// create empty buffer
var buffer = audio_context.createBuffer(1, 1, 22050);
var source = audio_context.createBufferSource();
source.buffer = buffer;
// connect to output (your speakers)
source.connect(audio_context.destination);
// play the file
source.noteOn(0);
}, false);
// General
$(startDSP);
</script>
<P>
<center>
<form method="POST" name="menu" >
<select name="selectedBuffer"
onChange="changeBufferSize(this.form.selectedBuffer)">
<option value = 256> 256 </option>
<option value = 512> 512 </option>
<option selected value = 1024> 1024 </option>
<option value = 2048> 2048 </option>
<option value = 4096> 4096 </option>
<option value = 8192> 8192 </option>
</select>
</form>
</center>
|