| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>debug @csound/browser</title> |
| 5 |
</head> |
| 6 |
<body> |
| 7 |
<script type="module"> |
| 8 |
const url = "/csound.dev.esm.js"; |
| 9 |
|
| 10 |
const test = ` |
| 11 |
<CsoundSynthesizer> |
| 12 |
<CsOptions> |
| 13 |
-odac -iadc --daemon |
| 14 |
</CsOptions> |
| 15 |
<CsInstruments> |
| 16 |
0dbfs=1 |
| 17 |
nchnls_i=1 |
| 18 |
nchnls=2 |
| 19 |
|
| 20 |
instr 1 |
| 21 |
ain = inch(1) |
| 22 |
al, ar reverbsc ain, ain, 0.85, 10000 |
| 23 |
out(al, ar) |
| 24 |
endin |
| 25 |
|
| 26 |
schedule(1, 0, -1) |
| 27 |
|
| 28 |
</CsInstruments> |
| 29 |
<CsScore> |
| 30 |
</CsScore> |
| 31 |
</CsoundSynthesizer> |
| 32 |
`; |
| 33 |
|
| 34 |
const runIt = async () => { |
| 35 |
const { Csound } = await import(url); |
| 36 |
const csoundObj = await Csound({ |
| 37 |
useWorker: true, |
| 38 |
useSPN: false, |
| 39 |
useSAB: true, |
| 40 |
outputChannelCount: 2 |
| 41 |
}); |
| 42 |
|
| 43 |
const compileReturn = await csoundObj.compileCsdText(test); |
| 44 |
// console.log(csoundObj); |
| 45 |
await csoundObj.enableAudioInput(); |
| 46 |
const startReturn = await csoundObj.start(); |
| 47 |
const n = await csoundObj.getNode(); |
| 48 |
const ctx = await csoundObj.getAudioContext(); |
| 49 |
}; |
| 50 |
|
| 51 |
const triggerEvent = "ontouchstart" in document.documentElement ? "touchend" : "click"; |
| 52 |
document.querySelector("#all_tests").addEventListener(triggerEvent, async function () { |
| 53 |
await runIt(); |
| 54 |
}); |
| 55 |
</script> |
| 56 |
<button id="all_tests">Run All Tests</button> |
| 57 |
</body> |
| 58 |
</html> |