Hypertext Markup "index"

Admin User, erstellt 23. Dez. 2023
         
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title editable="nocomment">Example 04</title>
</head>
<!-- Modern Albufeira Prolog Interpreter -->
<!-- Prolog audio -->
<!-- -->
<!-- Warranty & Liability -->
<!-- To the extent permitted by applicable law and unless explicitly -->
<!-- otherwise agreed upon, XLOG Technologies AG makes no warranties -->
<!-- regarding the provided information. XLOG Technologies AG assumes -->
<!-- no liability that any problems might be solved with the information -->
<!-- provided by XLOG Technologies AG. -->
<!-- -->
<!-- Rights & License -->
<!-- All industrial property rights regarding the information - copyright -->
<!-- and patent rights in particular - are the sole property of XLOG -->
<!-- Technologies AG. If the company was not the originator of some -->
<!-- excerpts, XLOG Technologies AG has at least obtained the right to -->
<!-- reproduce, change and translate the information. -->
<!-- -->
<!-- Reproduction is restricted to the whole unaltered document. -->
<!-- Reproduction of the information is only allowed for non-commercial -->
<!-- uses. Selling, giving away or letting of the execution of the -->
<!-- library is prohibited. The library can be distributed as part of -->
<!-- your applications and libraries for execution provided this comment -->
<!-- remains unchanged. -->
<!-- -->
<!-- Restrictions -->
<!-- Only to be distributed with programs that add significant and primary -->
<!-- functionality to the library. Not to be distributed with additional -->
<!-- software intended to replace any components of the library. -->
<!-- -->
<!-- Trademarks -->
<!-- Jekejeke is a registered trademark of XLOG Technologies AG. -->
<body>
<h1>Example 04: Audio Sequencer</h1>
<p><textarea rows="9" cols="70" id="text" spellcheck="false">play([]).
play([''|L]) :- !, sleep(400), play(L).
play([X|L]) :- note(X), sleep(500), play(L).
?- play(['E','D','C','D','E','E','E','','D','D','D','','E',
'G','G','','E','D','C','D','E','E','E','','D','D',
'E','D','C']).</textarea></p>
<p><button id="launch" style="padding: 0.5em; color: black"></button></p>
<p style="white-space: pre-wrap; word-break: break-all; font-family: monospace" id="demo"></p>
<audio id="C" src="notes/C.mp3"></audio>
<audio id="D" src="notes/D.mp3"></audio>
<audio id="E" src="notes/E.mp3"></audio>
<audio id="F" src="notes/F.mp3"></audio>
<audio id="G" src="notes/G.mp3"></audio>
<audio id="A" src="notes/A.mp3"></audio>
<audio id="B" src="notes/B.mp3"></audio>
<script type="module">
import {init, post, Compound, set_cursor,
clear, consult_async, register, show
} from "../../../01_ciao/lib/player/canned/dogelog.mjs";
function note(key) {
const audio = document.getElementById(key);
audio.currentTime = 0
audio.play();
}
let elem2 = document.getElementById("demo");
elem2.innerHTML = "";
set_cursor(elem2);
register("note", 1, note, 0);
init();
async function main_async() {
let elem = document.getElementById("launch");
if (elem.innerText === "⏵") {
elem.innerText = "⏹";
elem.style.color = "red";
let text = document.getElementById("text").value;
let elem2 = document.getElementById("demo");
elem2.innerHTML = "";
set_cursor(elem2);
clear();
try {
await consult_async(text);
} catch (err) {
show(err);
}
elem.disabled = false;
elem.innerText = "⏵";
elem.style.color = "black";
} else {
elem.disabled = true;
post(new Compound("system_error", ["user_abort"]));
}
}
document.getElementById("launch").addEventListener("click", main_async);
</script>
</body>
</html>