client/annotviz/app/annotsroll.html
author rougeronj
Wed, 21 Jan 2015 20:16:31 +0100
changeset 103 123a611c7903
parent 100 0d7dac03c1a0
child 104 685c5ebc59d0
permissions -rw-r--r--
minor update of options and add annotsvizview

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="I.R.I">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>AnnotsRoll</title>

    <!-- Custom styles for this template -->
    <link href="/css/annotviz.css" rel="stylesheet">
</head>

<body>
    <h1>Piano Roll vertical</h1>
    <noscript>You must enable JavaScript</noscript>
    <div id="canvasContainer"></div>
    <p>
        <a href="#" onclick="stop(); return false;">stop intervals</a> -
        <a href="#" onclick="start(); return false;">start intervals</a> -
        temps écoulé : <span id="timeStarted"></span>
    </p>
    <!--pre id="log"></pre-->
    <script src="/js/libs-annotviz.js"></script>
    <script src="/js/annotviz.js"></script>
    <script>
        var pianorollChannel  = 'PIANOROLL';
        var annotationChannel = 'ANNOT';
        var eventCode = 'test_1';
        var wsUri;
        if (window.location.protocol === 'file:') {
            wsUri = 'ws://127.0.0.1:8090/broadcast';
        }
        else {
            wsUri = 'ws://' + window.location.hostname + ':8090/broadcast';
        }
        wsUriPianoroll = wsUri + '?channel=' + pianorollChannel + '&event_code=' + eventCode;
        wsUriAnnotation = wsUri + '?channel=' + annotationChannel + '&event_code=' + eventCode;

        var logger = new annotviz.ConsoleLogger(true);
        
        var stageView = new annotviz.StageView({
        	logger: logger
        });

        var doubleroll = new annotviz.DoubleRoll({
            stageView : stageView,
        	logger: logger,
            ws: new annotviz.WsWrapper(wsUriPianoroll, logger),
            orientation: 'vertical',
            sceneHeight: 1080,
            pianorolls : [
                {
                    height: 435,
                    timeWidth: 60,
                    lineInterval: 5000,
                    noteHeight: undefined
                },
            ]
        });

        var annotsroll = new annotviz.AnnotsRoll({
        	stageView : stageView,
            logger: logger,
            ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
            parentContainer: doubleroll.stage,
            xInit: 1920 - 435 - 300,
            yInit: 1080,
            width: 435 + 300,
            height: 1080,
            widthRoll: 300,
            framerate: doubleroll.framerate,
            pixelsPerSecond: Math.floor(1920 / 60),
            annotColors: [{ts: 0, colors: {'ntm' : '#cdc83f'}}],
        });

        function stop() {
        	stageView.stop();
        }
        function start() {
        	stageView.start();
        }

        window.onload = function() {
        	stageView.init();
            start();
        }
    </script>
</body>
</html>