summaryrefslogtreecommitdiff
path: root/Build/index.html
blob: 02c0d3f9492d54c550fcaa9aa554cdd9dcdfe190 (plain) (blame)
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
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
        <pre>
        Wasm audio FIR. Version: 0.1
        </pre>
        <script type='text/javascript'>
          var Module = {};
          fetch('index.wasm')
            .then(response =>
              response.arrayBuffer()
            ).then(buffer => {
              Module.canvas = document.getElementById("canvas");
              Module.wasmBinary = buffer;
              var script = document.createElement('script');
              script.src = "index.js";
              script.onload = function() {
                console.log("Emscripten boilerplate loaded.")
              }
              document.body.appendChild(script);
            });
        </script>
        <div align="center">
        <canvas id="canvas" ></canvas>
        </div>
        
        <button class="setCutoffFrequency" type="button">Set Cutoff(Hz)</button>
        <textarea class="outSetCutoffFrequency"></textarea>
        
        <button class="setNumberTaps" type="button">Set Taps</button>
        <textarea class="outSetNumberTaps"></textarea>
        
        <button class="recalculateFir" id="recalculateFir" type="button">Calc</button>
        <textarea class="outCoeficients">1</textarea>
        
        
        <script>
            get_cutoff_freq = Module.cwrap("get_cutoff_freq","number",[]);
            get_tap_number = Module.cwrap("get_tap_number","number",[]);
            recalculate_fir = Module.cwrap("recalculate_fir",'number',[]);
            
            var setCutoffFrequency = document.querySelector('.setCutoffFrequency')
            var outSetCutoffFrequency = document.querySelector('.outSetCutoffFrequency')
            var setNumberTaps = document.querySelector('.setNumberTaps')
            var outSetNumberTaps = document.querySelector('.outSetNumberTaps')
            var recalculateFir = document.querySelector('.recalculateFir')
            var outCoeficients = document.querySelector('.outCoeficients')
            
            //outSetCutoffFrequency.value = get_cutoff_freq();
            //outSetCutoffFrequency.value = "Hello";
            //outSetNumberTaps.value = get_tap_number();
            
            recalculateFir.addEventListener('click', function(){
                recalculate_fir();
                console.log("Oh noe");
                outCoeficients.value = 2;
            })
            
            document.querySelector("#recalculateFir").onclick = function() {
                console.log("Oh noe");
                outCoeficients.value = 2;
            }
            
        </script>
        

        <pre>
          If no recording, check developer console(Ctrl+Shift+I) or add domain (http://wasm.main.lv) to chrome://flags/#unsafely-treat-insecure-origin-as-secure 
          Run r, listen with s, apply filtr with q and listen again with s
          Supported keys:
          r - record sound buffer
          s - play recorded buffer
          q - applay fir filter
        </pre>

        <pre>
          Changelog:
            v0.1 - initial release
        </pre>
        
        <!--<script src="index.js"></script>-->

    </body>
</html>