Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 5fcfcb7517038d1f44ab4e478e6e61fa > files > 1818

csound-doc-6.10.0-1.mga7.noarch.rpm

<!doctype html>
<html>
    <head>
        <title>WebSocket</title>
    </head>
    <body>
        <div>
            <h4>Slider Output</h4>
            <div id="sliderValue">slider value: 50</div>
            <input type="range" id="slider"></input>

        </div>
         <div>
             <h4>Csound Input</h4>
            <div id="inputValue">input value: ?</div>
        </div>
 <script>
var sliderValue = document.getElementById("sliderValue");
var inputValue = document.getElementById("inputValue");
var slider = document.getElementById("slider");
slider.oninput = function() {
    sliderValue.innerHTML = "slider value:" + slider.value;
    websocketOut.send(new Float64Array([slider.value]));
}
var websocketIn = new WebSocket("ws://127.0.0.1:8888", "klfo");
var websocketOut = new WebSocket("ws://127.0.0.1:8888", "kinput");
websocketIn.binaryType = 'arraybuffer';

websocketIn.onmessage = function(message){

    messageData = new Float64Array(message.data);
    inputValue.innerHTML = messageData[0];

}
        </script>
    </body>
</html>