1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#include <lib/std.mi>
#include "attribs.m"
Function setObjects();
Global Group frameGroup,beatdisplay;
Global Layer beatOverlay,DisplayRight,DisplayRightOverlay,DisplaySongtickerBG,VisOverlay;
Global Timer refreshEQ;
Global AnimatedLayer beatbarLeft,beatbarRight;
Global int lastBeatLeft,lastBeatRight;
Global Button Toggler,Toggler2;
Global Int dobeat2;
System.onScriptLoaded() {
initAttribs();
frameGroup = getScriptGroup();
beatdisplay = frameGroup.findObject("player.normal.display.beatvisualization");
beatOverlay = frameGroup.findObject("beatdisplayoverlay");
beatbarLeft = frameGroup.findObject("beatleft");
beatbarRight = frameGroup.findObject("beatright");
Toggler = frameGroup.findObject("beatvisualization");
Toggler2 = frameGroup.findObject("beatvisualization2");
DisplayRight = frameGroup.findObject("display.right");
DisplayRightOverlay = frameGroup.findObject("display.right.overlay2");
DisplaySongtickerBG = frameGroup.findObject("display.st.right");
VisOverlay = frameGroup.findObject("visualization.overlay");
lastBeatLeft = 0;
lastBeatRight = 0;
refreshEQ = new Timer;
refreshEQ.setDelay(10);
}
System.onscriptunloading() {
delete refreshEQ;
}
setObjects() {
int group_width = frameGroup.getWidth();
if ( group_width % 2 !=0 ) {
DisplayRight.setXmlParam("image","player.display.right");
DisplayRightOverlay.setXmlParam("image","player.display.right");
DisplaySongtickerBG.setXmlParam("image","player.display.songticker.bg.right");
VisOverlay.setXmlParam("image","player.visualization.overlay");
} else {
DisplayRight.setXmlParam("image","player.display.right2");
DisplayRightOverlay.setXmlParam("image","player.display.right2");
DisplaySongtickerBG.setXmlParam("image","player.display.songticker.bg.right2");
VisOverlay.setXmlParam("image","player.visualization.overlay2");
}
if ( group_width > 480 ) {
int newXpos = (group_width-60)/2;
beatdisplay.setXmlParam("x", IntegerToString(newXpos));
beatdisplay.show();
if ( beatvisualization_attrib.getData()=="1" ) {
refreshEQ.stop();
refreshEQ.start();
} else {
refreshEQ.stop();
beatbarLeft.gotoframe(0);
beatbarRight.gotoframe(0);
}
} else {
beatdisplay.hide();
refreshEQ.stop();
}
}
frameGroup.onResize(int x, int y, int w, int h) {
setObjects();
}
refreshEQ.onTimer() {
int beatLeft= System.getLeftVuMeter();
int beatRight= System.getRightVuMeter();
int frameLeft=beatLeft/16;
int frameRight=beatRight/16;
if (frameLeft>14) frameLeft=14;
if (frameRight>14) frameRight=14;
if (frameLeft<lastBeatLeft) {
frameLeft=lastBeatLeft-1;
if (frameLeft<0) frameLeft=0;
}
if (frameRight<lastBeatRight) {
frameRight=lastBeatRight-1;
if (frameRight<0) frameRight=0;
}
lastBeatLeft=frameLeft;
lastBeatRight=frameRight;
beatbarLeft.gotoframe(frameLeft);
beatbarRight.gotoframe(frameRight);
}
beatvisualization_attrib.onDataChanged() {
setObjects();
}
System.onKeyDown(String key) {
if (key == "shift+ctrl+alt") {
dobeat2 = 1;
complete;
} else dobeat2 = 0;
}
Toggler.onLeftClick() {
if ( beatvisualization_attrib.getData()=="1" ) {
beatvisualization_attrib.setData("0");
} else {
beatvisualization_attrib.setData("1");
}
}
Toggler2.onActivate(boolean on) {
if (!dobeat2) { Toggler.leftClick(); return; }
refreshEQ.stop();
if (on) {
beatbarLeft.setXMLParam("image","player.display.beat.left2");
beatbarRight.setXMLParam("image","player.display.beat.right2");
beatOverlay.hide();
} else {
beatbarLeft.setXMLParam("image","player.display.beat.left");
beatbarRight.setXMLParam("image","player.display.beat.right");
beatOverlay.show();
}
setObjects();
}
|