author | rougeronj |
Fri, 23 Jan 2015 10:09:59 +0100 | |
changeset 135 | d3066fa80a81 |
parent 131 | 0bb70072a56f |
child 145 | a8052f8ab19c |
permissions | -rw-r--r-- |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
/** |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
* scripts/doubleroll.js |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
* |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
* This is the starting point for your application. |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
* Take a look at http://browserify.org/ for more info |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
*/ |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
'use strict'; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
var PIXI = require('pixi'); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
var _ = require('lodash'); |
131 | 13 |
var PianoRoll = require('./pianoroll'); |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
var defaultConfig = { |
95 | 16 |
orientation: 'horizontal', |
98 | 17 |
logger: undefined, |
104 | 18 |
sceneWidth: 1024, |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
pianorolls : [ |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
{ |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
height: 435, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
timeWidth: 10, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
lineInterval: 5000, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
noteHeight: undefined |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
}, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
{ |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
height: 645, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
timeWidth: 60, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
lineInterval: 5000, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
noteHeight: undefined |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
}, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
], |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
framerate: 25, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
offsetMusic: false, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
sceneBgColor: 0xFFFFFF, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
lineColor: 0x444444, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
lineFillColor: 0xFFFF00, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
noteColors: [0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991], |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
noteHeight: undefined, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
zeroShift: 0.9, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
timeWidth: 60, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
lineInterval: 5000, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
// wsUri: undefined, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
// eventCode: undefined |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
function DoubleRoll(options) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
var _this = this; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
var opts = _(options).defaults(defaultConfig).value(); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
|
95 | 53 |
var orientation = opts.orientation; |
54 |
var isHorizontal = (orientation !== 'vertical'); |
|
55 |
||
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
this.logger = opts.logger; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
this.lineColor = opts.lineColor; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
this.lineFillColor = opts.lineFillColor; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
59 |
this.framerate = opts.framerate; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
60 |
this.offsetMusic = opts.offsetMusic; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
this.noteColors = opts.noteColors; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
63 |
var noteHeight = opts.noteHeight; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
var sceneHeight = opts.sceneHeight || _(opts.pianorolls).reduce(function(s,p) { return s + p.height; }, 0); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
var timeWidth = opts.timeWidth; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
var lineInterval = opts.lineInterval; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
67 |
var offsetMusic = opts.offsetMusic; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
68 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
var sceneWidth = opts.sceneWidth; |
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
70 |
var stageView = opts.stageView; |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
var zeroShift = opts.zeroShift; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
|
98 | 74 |
var ws = opts.ws; |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
var colorsReg = {}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
|
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
78 |
this.container = new PIXI.DisplayObjectContainer(); |
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
79 |
this.container.x = Math.floor(sceneWidth*zeroShift); |
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
80 |
this.container.y = 0; |
131 | 81 |
|
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
82 |
stageView.registerComponent(this); |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
83 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
84 |
var pianorollList = []; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
85 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
86 |
var pianorollOptions = { |
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
87 |
parentContainer: this.container, |
95 | 88 |
orientation: orientation, |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
89 |
xInit: 0, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
90 |
width: sceneWidth, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
91 |
noteColors: this.noteColors, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
92 |
colorsReg: colorsReg, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
93 |
lineColor: this.lineColor, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
94 |
lineInterval: lineInterval, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
95 |
offsetMusic: offsetMusic, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
96 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
97 |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
98 |
var yInit = opts.yInit || 0; |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
99 |
var linesDown = true; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
100 |
_(opts.pianorolls).forEach(function(prDef, i) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
101 |
var prNoteHeight = noteHeight || prDef.noteHeight || prDef.height / 128; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
102 |
var prTimeWidth = prDef.timeWidth || timeWidth; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
103 |
pianorollList.push(new PianoRoll(_({ |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
104 |
yInit: yInit, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
105 |
height: prDef.height, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
106 |
linesDown: linesDown, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
107 |
pixelsPerSecond: Math.floor(sceneWidth / prTimeWidth), |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
108 |
noteHeight: prNoteHeight, |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
109 |
lineInterval: prDef.lineInterval |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
110 |
}).defaults(pianorollOptions).value())); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
111 |
yInit += prDef.height; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
112 |
linesDown = !linesDown; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
113 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
114 |
if(i<(opts.pianorolls.length-1)) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
115 |
var lineGraphics = new PIXI.Graphics() |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
116 |
.beginFill(_this.lineFillColor) |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
117 |
.lineStyle(1, _this.lineColor) |
95 | 118 |
.moveTo(Math.floor(sceneWidth*zeroShift), yInit) |
119 |
.lineTo(-sceneWidth - Math.floor(sceneWidth*zeroShift), yInit) |
|
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
120 |
.endFill(); |
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
121 |
_this.container.addChild(lineGraphics); |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
122 |
} |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
123 |
}); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
124 |
|
95 | 125 |
if(!isHorizontal) { |
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
126 |
this.container.rotation = Math.PI/2; |
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
127 |
this.container.y = sceneHeight; |
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
128 |
this.container.x = sceneWidth; |
95 | 129 |
} |
130 |
||
131 |
||
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
132 |
this.init = function() { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
133 |
|
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
134 |
ws.message(function(data) { |
98 | 135 |
_this.addNotes(data); |
136 |
}); |
|
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
137 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
138 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
139 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
140 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
141 |
this.addNotes = function(data) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
142 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
143 |
pianorollList.forEach(function(c) { |
98 | 144 |
c.addNoteRaw(data); |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
145 |
}); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
146 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
147 |
|
100
0d7dac03c1a0
Merge with 72d767c5142df7fc6387215096321295fbaaa73d
rougeronj
parents:
98
diff
changeset
|
148 |
this.refresh = function() { |
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
149 |
pianorollList.forEach(function(c) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
150 |
c.move(); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
151 |
}); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
152 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
153 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
154 |
// Init page and intervals |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
155 |
var startTs; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
156 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
157 |
this.start = function() { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
158 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
159 |
startTs = Date.now(); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
160 |
pianorollList.forEach(function(c) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
161 |
c.start(); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
162 |
}); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
163 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
164 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
165 |
this.stop = function() { |
131 | 166 |
|
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
167 |
pianorollList.forEach(function(c) { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
168 |
c.stop(); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
169 |
}); |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
170 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
171 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
172 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
173 |
this.log = function(m) { |
98 | 174 |
if(this.logger) { |
175 |
this.logger.log(m); |
|
94
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
176 |
} |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
177 |
}; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
178 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
179 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
180 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
181 |
return this; |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
182 |
} |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
183 |
|
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
184 |
module.exports = { |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
185 |
DoubleRoll: DoubleRoll |
e0e514c5470f
create doubleroll component and modularize app
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
186 |
}; |