client/annotviz/app/js/doubleroll.js
changeset 134 119b6193c493
parent 131 0bb70072a56f
child 145 a8052f8ab19c
equal deleted inserted replaced
133:12f782a13fa2 134:119b6193c493
     3 *
     3 *
     4 * This is the starting point for your application.
     4 * This is the starting point for your application.
     5 * Take a look at http://browserify.org/ for more info
     5 * Take a look at http://browserify.org/ for more info
     6 */
     6 */
     7 
     7 
     8 /* global document: false */
       
     9 
       
    10 'use strict';
     8 'use strict';
    11 
     9 
    12 
    10 
    13 var PIXI = require('pixi');
    11 var PIXI = require('pixi');
    14 var _ = require('lodash');
    12 var _ = require('lodash');
    15 var PianoRoll = require('./pianoroll.js');
    13 var PianoRoll = require('./pianoroll');
    16 
    14 
    17 var defaultConfig = {
    15 var defaultConfig = {
    18     orientation: 'horizontal',
    16     orientation: 'horizontal',
    19     logger: undefined,
    17     logger: undefined,
    20     sceneWidth: 1024,
    18     sceneWidth: 1024,
    61     this.framerate = opts.framerate;
    59     this.framerate = opts.framerate;
    62     this.offsetMusic = opts.offsetMusic;
    60     this.offsetMusic = opts.offsetMusic;
    63     this.noteColors = opts.noteColors;
    61     this.noteColors = opts.noteColors;
    64 
    62 
    65     var noteHeight = opts.noteHeight;
    63     var noteHeight = opts.noteHeight;
    66     var sceneBgColor = opts.sceneBgColor;
       
    67     var sceneHeight = opts.sceneHeight || _(opts.pianorolls).reduce(function(s,p) { return s + p.height; }, 0);
    64     var sceneHeight = opts.sceneHeight || _(opts.pianorolls).reduce(function(s,p) { return s + p.height; }, 0);
    68     var timeWidth = opts.timeWidth;
    65     var timeWidth = opts.timeWidth;
    69     var lineInterval = opts.lineInterval;
    66     var lineInterval = opts.lineInterval;
    70     var offsetMusic = opts.offsetMusic;
    67     var offsetMusic = opts.offsetMusic;
    71 
    68 
    79     var colorsReg = {};
    76     var colorsReg = {};
    80 
    77 
    81     this.container = new PIXI.DisplayObjectContainer();
    78     this.container = new PIXI.DisplayObjectContainer();
    82     this.container.x = Math.floor(sceneWidth*zeroShift);
    79     this.container.x = Math.floor(sceneWidth*zeroShift);
    83     this.container.y = 0;
    80     this.container.y = 0;
    84     
    81 
    85     stageView.registerComponent(this);
    82     stageView.registerComponent(this);
    86 
    83 
    87     var pianorollList = [];
    84     var pianorollList = [];
    88 
    85 
    89     var pianorollOptions = {
    86     var pianorollOptions = {
   164             c.start();
   161             c.start();
   165         });
   162         });
   166     };
   163     };
   167 
   164 
   168     this.stop = function() {
   165     this.stop = function() {
   169     	
   166 
   170         pianorollList.forEach(function(c) {
   167         pianorollList.forEach(function(c) {
   171             c.stop();
   168             c.stop();
   172         });
   169         });
   173     };
   170     };
   174 
   171