client/annotviz/app/annotsroll.html
changeset 98 72d767c5142d
child 100 0d7dac03c1a0
equal deleted inserted replaced
97:545803e685e0 98:72d767c5142d
       
     1 <!DOCTYPE html>
       
     2 <html lang="en">
       
     3 <head>
       
     4     <meta charset="utf-8">
       
     5     <meta name="viewport" content="width=device-width,initial-scale=1">
       
     6     <meta name="description" content="">
       
     7     <meta name="author" content="I.R.I">
       
     8     <link rel="shortcut icon" href="/img/favicon.ico">
       
     9 
       
    10     <title>AnnotsRoll</title>
       
    11 
       
    12     <!-- Custom styles for this template -->
       
    13     <link href="/css/annotviz.css" rel="stylesheet">
       
    14 </head>
       
    15 
       
    16 <body>
       
    17     <h1>Piano Roll vertical</h1>
       
    18     <noscript>You must enable JavaScript</noscript>
       
    19     <div id="canvasContainer"></div>
       
    20     <p>
       
    21         <a href="#" onclick="stop(); return false;">stop intervals</a> -
       
    22         <a href="#" onclick="start(); return false;">start intervals</a> -
       
    23         temps écoulé : <span id="timeStarted"></span>
       
    24     </p>
       
    25     <!--pre id="log"></pre-->
       
    26     <script src="/js/libs-annotviz.js"></script>
       
    27     <script src="/js/annotviz.js"></script>
       
    28     <script>
       
    29         var pianorollChannel  = 'PIANOROLL';
       
    30         var annotationChannel = 'ANNOT';
       
    31         var eventCode = 'test_1';
       
    32         var wsUri;
       
    33         if (window.location.protocol === 'file:') {
       
    34             wsUri = 'ws://127.0.0.1:8090/broadcast';
       
    35         }
       
    36         else {
       
    37             wsUri = 'ws://' + window.location.hostname + ':8090/broadcast';
       
    38         }
       
    39         wsUriPianoroll = wsUri + '?channel=' + pianorollChannel + '&event_code=' + eventCode;
       
    40         wsUriAnnotation = wsUri + '?channel=' + annotationChannel + '&event_code=' + eventCode;
       
    41 
       
    42 
       
    43 
       
    44         var logger = new annotviz.ConsoleLogger(true);
       
    45 
       
    46         var doubleroll = new annotviz.DoubleRoll({
       
    47             logger: logger,
       
    48             externalRefresh: true,
       
    49             ws: new annotviz.WsWrapper(wsUriPianoroll, logger),
       
    50             orientation: 'vertical',
       
    51             sceneHeight: 1080,
       
    52             pianorolls : [
       
    53                 {
       
    54                     height: 435,
       
    55                     timeWidth: 60,
       
    56                     lineInterval: 5000,
       
    57                     noteHeight: undefined
       
    58                 },
       
    59             ]
       
    60         });
       
    61 
       
    62 
       
    63         var annotsroll = new annotviz.AnnotsRoll({
       
    64             logger: logger,
       
    65             externalRefresh: true,
       
    66             ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
       
    67             parentContainer: doubleroll.stage,
       
    68             xInit: 1920 - 435 - 300,
       
    69             yInit: 1080,
       
    70             width: 1920,
       
    71             height: 1080,
       
    72             widthRoll: 300,
       
    73             framerate: doubleroll.framerate,
       
    74             pixelsPerSecond: Math.floor(1920 / 60),
       
    75             annotColors: [{ts: 0, colors: {'ntm' : '#cdc83f'}}],
       
    76         });
       
    77 
       
    78         var refreshInterval;
       
    79 
       
    80         function stop() {
       
    81             doubleroll.stop();
       
    82             annotsroll.stop();
       
    83             window.clearInterval(refreshInterval);
       
    84         }
       
    85         function start() {
       
    86             doubleroll.start();
       
    87             annotsroll.start();
       
    88             refreshInterval = setInterval(function() { doubleroll.refresh(); annotsroll.refresh(); }, 1000/doubleroll.framerate);
       
    89         }
       
    90 
       
    91         window.onload = function() {
       
    92             doubleroll.init();
       
    93             annotsroll.init();
       
    94             start();
       
    95         }
       
    96 
       
    97 
       
    98 var sessionJson =
       
    99     {
       
   100         "categories": [
       
   101     {
       
   102         "color": "rgb(205,200,63)",
       
   103         "subcategories": [
       
   104     {
       
   105         "color": "rgb(205,200,63)",
       
   106         "code": "ntm",
       
   107         "full_label": "sous-catégorie 1-1",
       
   108         "label": "Batterie"
       
   109     },
       
   110 {
       
   111     "color": "rgb(205,200,63)",
       
   112     "code": "iam",
       
   113     "full_label": "sous-catégorie 1-2",
       
   114     "label": "Clavier"
       
   115 },
       
   116 {
       
   117     "color": "rgb(205,200,63)",
       
   118     "code": "hip",
       
   119     "full_label": "sous-catégorie 1-3",
       
   120     "label": "Guitare"
       
   121 },
       
   122 {
       
   123     "color": "rgb(205,200,63)",
       
   124     "code": "hop",
       
   125     "full_label": "sous-catégorie 1-4",
       
   126     "label": "Trombone"
       
   127 }
       
   128 ],
       
   129 "full_label": "Liste des instruments disponibles",
       
   130 "label": "Instruments"
       
   131 },
       
   132 {
       
   133     "color": "rgb(222,139,83)",
       
   134     "subcategories": [
       
   135 {
       
   136     "color": "rgb(222,139,83)",
       
   137     "code": "rock",
       
   138     "full_label": "sous-catégorie 2-1",
       
   139     "label": "Accélération"
       
   140 },
       
   141 {
       
   142     "color": "rgb(222,139,83)",
       
   143     "code": "rap",
       
   144     "full_label": "sous-catégorie 2-2",
       
   145     "label": "Décélération"
       
   146 },
       
   147 {
       
   148     "color": "rgb(222,139,83)",
       
   149     "code": "classic",
       
   150     "full_label": "sous-catégorie 2-3",
       
   151     "label": "Pause"
       
   152 }
       
   153 ],
       
   154 "full_label": "catégorie 2",
       
   155 "label": "Rythmique"
       
   156 },
       
   157 {
       
   158     "color": "rgb(197,163,202)",
       
   159     "subcategories": [
       
   160     {
       
   161         "color": "rgb(197,163,202)",
       
   162         "code": "drums",
       
   163         "full_label": "sous-catégorie 3-1",
       
   164         "label": "sub cat 3-1"
       
   165     },
       
   166     {
       
   167         "color": "rgb(197,163,202)",
       
   168         "code": "guitar",
       
   169         "full_label": "sous-catégorie 3-2",
       
   170         "label": "sub cat 3-2"
       
   171     }
       
   172     ],
       
   173     "full_label": "catégorie 3",
       
   174     "label": "Une 3ème cat"
       
   175 },
       
   176 {
       
   177     "color": "rgb(121,187,146)",
       
   178     "code": "bass",
       
   179     "full_label": "catégorie 4",
       
   180     "label": "Annot'direct"
       
   181 }
       
   182 ]
       
   183 };
       
   184     </script>
       
   185 </body>
       
   186 </html>