equal
deleted
inserted
replaced
9 |
9 |
10 |
10 |
11 var PIXI = require('pixi'); |
11 var PIXI = require('pixi'); |
12 var _ = require('lodash'); |
12 var _ = require('lodash'); |
13 var PianoRoll = require('./pianoroll'); |
13 var PianoRoll = require('./pianoroll'); |
|
14 var Utils = require('./utils.js'); |
14 |
15 |
15 var defaultConfig = { |
16 var defaultConfig = { |
16 orientation: 'horizontal', |
17 orientation: 'horizontal', |
17 logger: undefined, |
18 logger: undefined, |
18 sceneWidth: 1024, |
19 sceneWidth: 1024, |
132 .endFill(); |
133 .endFill(); |
133 _this.container.addChild(lineGraphics); |
134 _this.container.addChild(lineGraphics); |
134 } |
135 } |
135 }); |
136 }); |
136 |
137 |
|
138 var currentTimeText = new PIXI.Text('-- : -- : --', { font: '40pt Arial', fill: '#646464' }); |
|
139 console.log(currentTimeText); |
|
140 currentTimeText.x = -currentTimeText.width - 60; |
|
141 currentTimeText.y = sceneHeight - currentTimeText.height - 30; |
|
142 this.container.addChild(currentTimeText); |
|
143 |
|
144 |
137 if(!isHorizontal) { |
145 if(!isHorizontal) { |
138 this.container.rotation = Math.PI/2; |
146 this.container.rotation = Math.PI/2; |
139 this.container.y = sceneHeight; |
147 this.container.y = sceneHeight; |
140 this.container.x = sceneWidth; |
148 this.container.x = sceneWidth; |
141 } |
149 } |
142 |
150 |
143 |
151 |
146 ws.message(function(data) { |
154 ws.message(function(data) { |
147 _this.addNotes(data); |
155 _this.addNotes(data); |
148 }); |
156 }); |
149 |
157 |
150 }; |
158 }; |
151 |
159 |
|
160 this.updateTime = function(){ |
|
161 currentTimeText.setText(Utils.formatTime(Date.now())); |
|
162 }; |
152 |
163 |
153 this.addNotes = function(data) { |
164 this.addNotes = function(data) { |
154 |
165 |
155 pianorollList.forEach(function(c) { |
166 pianorollList.forEach(function(c) { |
156 c.addNoteRaw(data); |
167 c.addNoteRaw(data); |
163 }); |
174 }); |
164 }; |
175 }; |
165 |
176 |
166 // Init page and intervals |
177 // Init page and intervals |
167 var startTs; |
178 var startTs; |
|
179 var refreshTimeInterval; |
168 |
180 |
169 this.start = function() { |
181 this.start = function() { |
170 |
182 refreshTimeInterval = setInterval(function() {_this.updateTime();}, 1000); |
|
183 |
171 startTs = Date.now(); |
184 startTs = Date.now(); |
172 pianorollList.forEach(function(c) { |
185 pianorollList.forEach(function(c) { |
173 c.start(); |
186 c.start(); |
174 }); |
187 }); |
175 }; |
188 }; |