| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>debug @csound/browser</title> |
| 5 |
</head> |
| 6 |
<body> |
| 7 |
<script type="module"> |
| 8 |
const url = "/dist/csound.js"; |
| 9 |
|
| 10 |
const testMono = ` |
| 11 |
<CsoundSynthesizer> |
| 12 |
<CsOptions> |
| 13 |
-odac |
| 14 |
</CsOptions> |
| 15 |
<CsInstruments> |
| 16 |
0dbfs=1 |
| 17 |
nchnls=1 |
| 18 |
|
| 19 |
instr 1 |
| 20 |
out oscili(.5, 440) * linen:a(1, 0, p3, 0.1) |
| 21 |
endin |
| 22 |
</CsInstruments> |
| 23 |
<CsScore> |
| 24 |
i1 0 4 |
| 25 |
</CsScore> |
| 26 |
</CsoundSynthesizer> |
| 27 |
`; |
| 28 |
|
| 29 |
const testStereo = ` |
| 30 |
<CsoundSynthesizer> |
| 31 |
<CsOptions> |
| 32 |
-odac |
| 33 |
</CsOptions> |
| 34 |
<CsInstruments> |
| 35 |
0dbfs=1 |
| 36 |
nchnls=2 |
| 37 |
|
| 38 |
instr 1 |
| 39 |
asig = oscili(.5, 440) * linen:a(1, 0, p3, 0.1) |
| 40 |
a0, a1 pan2 asig, line:k(0, p3, 1) |
| 41 |
out(a0, a1) |
| 42 |
endin |
| 43 |
</CsInstruments> |
| 44 |
<CsScore> |
| 45 |
i1 0 4 |
| 46 |
</CsScore> |
| 47 |
</CsoundSynthesizer> |
| 48 |
`; |
| 49 |
|
| 50 |
const runIt = async () => { |
| 51 |
const { Csound } = await import(url); |
| 52 |
const csoundObj = await Csound({ |
| 53 |
useWorker: false, |
| 54 |
useSPN: false, |
| 55 |
outputChannelCount: 2 |
| 56 |
}); |
| 57 |
|
| 58 |
const compileReturn = await csoundObj.compileCsdText(testMono); |
| 59 |
const startReturn = await csoundObj.start(); |
| 60 |
const n = await csoundObj.getNode(); |
| 61 |
const ctx = await csoundObj.getAudioContext(); |
| 62 |
}; |
| 63 |
|
| 64 |
const triggerEvent = "ontouchstart" in document.documentElement ? "touchend" : "click"; |
| 65 |
document.querySelector("#all_tests").addEventListener(triggerEvent, async function () { |
| 66 |
await runIt(); |
| 67 |
}); |
| 68 |
</script> |
| 69 |
<button id="all_tests">Run All Tests</button> |
| 70 |
</body> |
| 71 |
</html> |