author | rougeronj |
Thu, 22 Jan 2015 02:21:15 +0100 | |
changeset 105 | 25ac8802c189 |
parent 104 | 685c5ebc59d0 |
child 108 | 082b64a5c699 |
permissions | -rw-r--r-- |
98 | 1 |
/** |
2 |
* js/annotsvizview.js |
|
3 |
* |
|
4 |
* This is the starting point for your application. |
|
5 |
* Take a look at http://browserify.org/ for more info |
|
6 |
*/ |
|
103 | 7 |
|
8 |
'use strict'; |
|
9 |
||
10 |
var PIXI = require('pixi'); |
|
11 |
var _ = require('lodash'); |
|
12 |
var DoubleRoll = require('./doubleroll.js'); |
|
13 |
var AnnotsTimeLine = require('./annotstimeline.js'); |
|
14 |
var AnnotsRoll = require('./annotsroll.js'); |
|
15 |
||
16 |
var defaultOptions = { |
|
17 |
xInit: 0, |
|
18 |
yInit: 0, |
|
104 | 19 |
width: 1024, |
20 |
height: 768, |
|
103 | 21 |
}; |
22 |
||
23 |
function AnnotsVizView(options){ |
|
24 |
var _this = this; |
|
25 |
var opts = _(options).defaults(defaultOptions).value(); |
|
26 |
|
|
27 |
this.container = new PIXI.DisplayObjectContainer(); |
|
28 |
this.container.x = opts.xInit; |
|
29 |
this.container.y = opts.yInit; |
|
30 |
this.width = opts.width; |
|
31 |
this.height= opts.height; |
|
32 |
|
|
33 |
var wsPianoroll = opts.wsPianoroll; |
|
34 |
var wsAnnot = opts.wsAnnot; |
|
35 |
var stageView = opts.stageView; |
|
36 |
|
|
37 |
stageView.registerComponent(this); |
|
38 |
|
|
39 |
var timeLine = new AnnotsTimeLine.AnnotsTimeLine({ |
|
40 |
stageView : stageView, |
|
41 |
logger: logger, |
|
42 |
ws: new annotviz.WsWrapper(wsUriAnnotation, logger), |
|
43 |
xInit: 0, |
|
44 |
yInit: 0, |
|
104 | 45 |
width: 1024 - 200 - 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
46 |
height: 768-200, |
103 | 47 |
timeBegin: Date.now(), |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
48 |
timeEnd: Date.now() + 3000000, |
103 | 49 |
intervalWidth: 6, |
50 |
intervalHeight: 10, |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
51 |
maxCellHeight: 70, |
104 | 52 |
radius: 200, |
103 | 53 |
annotCategories: [{ |
54 |
ts: 0, |
|
55 |
colors: { |
|
56 |
'ntm': '#CDC83F', |
|
57 |
'iam': '#CDC83F', |
|
58 |
'hip': '#CDC83F', |
|
59 |
'hop': '#CDC83F', |
|
60 |
'rock': '#DE8B53', |
|
61 |
'rap': '#DE8B53', |
|
62 |
'classic': '#DE8B53', |
|
63 |
'drums': '#C5A3CA', |
|
64 |
'guitar': '#C5A3CA', |
|
65 |
'bass': '#79BB92', |
|
66 |
'default': '#808080' |
|
67 |
}, |
|
68 |
order: ['ntm', 'iam', 'hip', 'hop', 'rock', 'rap', 'classic', 'drums', 'guitar', 'bass', 'default'] |
|
69 |
}] |
|
70 |
}); |
|
71 |
|
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
72 |
var doubleRollH = new DoubleRoll.DoubleRoll({ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
73 |
stageView : stageView, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
74 |
logger: logger, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
75 |
ws: wsPianoroll, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
76 |
yInit: (this.height - 200), |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
77 |
sceneHeight: 200, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
78 |
pianorolls : [ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
79 |
{ |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
80 |
height: 200, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
81 |
timeWidth: 10, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
82 |
lineInterval: 5000, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
83 |
noteHeight: 10 |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
84 |
}, |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
85 |
] |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
86 |
}); |
103 | 87 |
|
88 |
var doubleRollV = new DoubleRoll.DoubleRoll({ |
|
89 |
stageView : stageView, |
|
90 |
logger: logger, |
|
91 |
ws: wsPianoroll, |
|
92 |
orientation: 'vertical', |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
93 |
sceneHeight: 768-200, |
103 | 94 |
pianorolls : [ |
95 |
{ |
|
104 | 96 |
height: 200, |
103 | 97 |
timeWidth: 60, |
98 |
lineInterval: 5000, |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
99 |
noteHeight: 5, |
103 | 100 |
}, |
101 |
] |
|
102 |
}); |
|
103 |
|
|
104 |
var annotsRoll = new AnnotsRoll.AnnotsRoll({ |
|
105 |
stageView : stageView, |
|
106 |
logger: logger, |
|
107 |
ws: wsAnnot, |
|
108 |
parentContainer: doubleRollV.stage, |
|
104 | 109 |
xInit: 1024 - 200 - 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
110 |
yInit: 768-200, |
104 | 111 |
width: 200 + 200, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
112 |
height: 768-200, |
104 | 113 |
widthRoll: 200, |
103 | 114 |
framerate: doubleRollV.framerate, |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
115 |
pixelsPerSecond: Math.floor(1024 / 60), |
103 | 116 |
annotColors: [{ |
117 |
ts: 0, |
|
118 |
colors: { |
|
119 |
'ntm': '#CDC83F', |
|
120 |
'iam': '#CDC83F', |
|
121 |
'hip': '#CDC83F', |
|
122 |
'hop': '#CDC83F', |
|
123 |
'rock': '#DE8B53', |
|
124 |
'rap': '#DE8B53', |
|
125 |
'classic': '#DE8B53', |
|
126 |
'drums': '#C5A3CA', |
|
127 |
'guitar': '#C5A3CA', |
|
128 |
'bass': '#79BB92', |
|
129 |
'default': '#808080' |
|
130 |
} |
|
131 |
}] |
|
132 |
}); |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
133 |
|
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
134 |
var limiters = new PIXI.Graphics() |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
135 |
.lineStyle(1, 0x646464) |
103 | 136 |
.moveTo(annotsRoll.container.x, annotsRoll.container.y) |
137 |
.lineTo(annotsRoll.container.x, annotsRoll.container.y - annotsRoll.height) |
|
138 |
.moveTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y) |
|
139 |
.lineTo(annotsRoll.container.x + annotsRoll.widthRoll, annotsRoll.container.y - annotsRoll.height) |
|
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
140 |
.moveTo(0, this.height - 200) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
141 |
.lineTo(this.width, this.height - 200) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
142 |
.drawRect(0, 0, this.width -1, this.height -1) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
143 |
.beginFill(0xECECEC) |
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
144 |
.drawRect(1024 - 200, 0, 200, 768-200) |
103 | 145 |
.endFill(); |
105
25ac8802c189
Improve interface + Add horizontal pianoroll to annotsvizview
rougeronj
parents:
104
diff
changeset
|
146 |
this.container.addChild(limiters); |
103 | 147 |
|
148 |
// var doubleRollV = new DoubleRoll.DoubleRoll({}); |
|
149 |
|
|
150 |
this.init = function(){ |
|
151 |
|
|
152 |
} |
|
153 |
|
|
154 |
this.start = function() { |
|
155 |
}; |
|
156 |
|
|
157 |
this.refresh = function() { |
|
158 |
}; |
|
159 |
|
|
160 |
this.stop = function(){ |
|
161 |
}; |
|
162 |
|
|
163 |
return this; |
|
164 |
|
|
165 |
} |
|
166 |
||
167 |
module.exports = { |
|
168 |
AnnotsVizView: AnnotsVizView |
|
169 |
}; |