Debian Codegraph @

src/host-web/webchuck/examples/globals3/index.html

raw symbols SCIP
1 <!doctype html>
2 <html lang="en-us">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>ChucK + JS => ChucKScript</title>
7 <link rel="stylesheet" href="../../css/editor.css">
8 </head>
9 <body onresize="chuckEditor.resize();">
10 <div>
11 <div id="program">// Globals 3: secret replacement dac
12 // This dac is secretly an LPF
13 SawOsc s => dac;
14 while( true )
15 {
16 Math.random2f( 30, 1000 ) => s.freq;
17 130::ms => now;
18 }
19 </div>
20 </div>
21 <div class="buttons">
22 <button class="chuckButton" id="startChuck" disabled="disabled">Start ChucK</button>
23 <button class="chuckButton" id="compileButton" disabled="disabled">Compile and Run</button>
24 <button class="chuckButton" id="replaceButton" disabled="disabled">Replace</button>
25 <button class="chuckButton" id="removeButton" disabled="disabled">Remove</button>
26 <button class="chuckButton" id="clearButton" disabled="disabled">Clear VM and Globals</button>
27 <button class="chuckButton" id="micButton" disabled="disabled">Enable Microphone</button>
28 <button class="chuckButton" id="fileFormButton">Show File Uploader</button>
29 </div>
30 <div id="fileForm" class="hidden">
31 <p>File name to use in ChucK: <input type="text" id="uploadFilename"></p>
32 <p>Local file to upload: <input type="file" id="uploadFile" name="uploadFile"></p>
33 <p><button class="chuckButton" id="fileButton" disabled="disabled">Upload File to Virtual File System</button></p>
34 </div>
35 <div>
36 <textarea id="output"></textarea>
37 <div id="shreds">
38 <table id="shredstable">
39 <col width="60px">
40 <col width="1*">
41 <col width="50px">
42 <col width="60px">
43 <tr><th>shred</th><th>code</th><th>time</th><th>remove</th>
44 </table>
45 </div>
46 <div class="clearfix"></div>
47 </div>
48 <script type="text/javascript" src="../../js/ace-min-noconflict/ace.js" charset="utf-8"></script>
49 <script type="text/javascript" src="../../js/editor.js"></script>
50 <script type="text/javascript" src="../../js/defer.js"></script>
51 <script>
52 // override
53 var whereIsChuck = "../../js";
54 </script>
55 <script type="text/javascript" src="../../js/webchuck_host.js"></script>
56 <script type="text/javascript" src="../../js/host.js"></script>
57 <script>
58 theChuckReady.then( function() {
59 theChuck.runCode( "global LPF secretDac => dac; secretDac.freq( 700 );")
60 compileButton.removeEventListener( "click", chuckCompileButton );
61 compileButton.addEventListener( "click", function() {
62 theChuck.runCodeWithReplacementDac( chuckEditor.getValue(), "secretDac" );
63 });
64 replaceButton.removeEventListener( "click", chuckReplaceButton );
65 replaceButton.addEventListener( "click", function() {
66 theChuck.replaceCodeWithReplacementDac( chuckEditor.getValue(), "secretDac" );
67 });
68 });
69 </script>
70 </body>
71 </html>
72
73