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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/* */ package NET.worlds.scape;
/* */
/* */ import NET.worlds.network.URL;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class MCISoundPlayer
/* */ extends SoundPlayer
/* */ {
/* */ public MCISoundPlayer(Sound owner)
/* */ {
/* 32 */ super(owner);
/* */ }
/* */
/* */
/* */
/* */
/* 38 */ private static MCIThread mciThread = new MCIThread();
/* */ float ang;
/* */ float dist;
/* */ float vol;
/* */ int leftToRepeat;
/* */ int running;
/* */
/* */ public boolean open(float volume, float stopDist, boolean atten, boolean pan)
/* */ {
/* 47 */ return true;
/* */ }
/* */
/* */ public void close() {
/* 51 */ stop();
/* */ }
/* */
/* */ public boolean position(Point3Temp cam, Point3Temp obj, Point3Temp out, Point3Temp up)
/* */ {
/* 56 */ Point3Temp toObj = Point3Temp.make(obj).minus(cam);
/* 57 */ Point3Temp right = Point3Temp.make(out).cross(up);
/* 58 */ float y = toObj.dot(out);
/* 59 */ float x = toObj.dot(right);
/* 60 */ this.ang = ((float)(Math.atan2(y, x) / 3.141592653589793D));
/* 61 */ this.dist = toObj.length();
/* */
/* */
/* 64 */ return setVolume(this.vol);
/* */ }
/* */
/* */ public boolean setVolume(float v) {
/* 68 */ this.vol = v;
/* */
/* 70 */ float leftFrac = 0.5F;
/* 71 */ if ((this.owner != null) && (this.owner.getPanning()))
/* */ {
/* */
/* 74 */ leftFrac = Math.abs(this.ang);
/* */
/* */
/* 77 */ if (this.ang < 0.0F) {
/* 78 */ v = this.vol * (float)(0.5D + Math.abs(0.5D + this.ang));
/* */ }
/* */ }
/* 81 */ if ((this.owner != null) && (this.owner.getAttenuate())) {
/* 82 */ float stopDist = this.owner.getStopDistance();
/* 83 */ if (this.dist > stopDist) {
/* 84 */ volume(0.0F, 0.0F);
/* 85 */ return false;
/* */ }
/* */
/* 88 */ v *= (stopDist - this.dist) / stopDist;
/* */ }
/* */
/* 91 */ volume(v * leftFrac, v * (1.0F - leftFrac));
/* 92 */ return true;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 101 */ MCISoundCommand poll = new MCISoundCommand() {
/* 102 */ public void run() { MCISoundPlayer.this.gotFinished(MCISoundPlayer.this.nativeIsFinished()); }
/* */ };
/* */
/* */ private URL url;
/* */
/* */ private static MCISoundCommand activeStopCmd;
/* */
/* */
/* */ public int getState()
/* */ {
/* 112 */ if (!this.poll.isOnQueue) {
/* 113 */ mciThread.pushCommand(this.poll);
/* */ }
/* 115 */ return this.running != 0 ? 0 : 1;
/* */ }
/* */
/* */ public synchronized void start(int repeatCount) {
/* 119 */ if (repeatCount == 0) {
/* 120 */ this.running = 0;
/* 121 */ return;
/* */ }
/* */
/* 124 */ this.leftToRepeat = repeatCount;
/* */
/* 126 */ if (this.leftToRepeat > 0) {
/* 127 */ this.leftToRepeat -= 1;
/* */ }
/* 129 */ this.running = 1;
/* */
/* 131 */ activeStopCmd = null;
/* 132 */ mciThread.pushCommand(new MCISoundCommand() {
/* 133 */ public void run() { MCISoundPlayer.this.doStart(); }
/* */ });
/* */ }
/* */
/* */
/* */ public synchronized void start(URL u)
/* */ {
/* 140 */ this.url = u;
/* 141 */ start(1);
/* */ }
/* */
/* */ synchronized void doStart() {
/* 145 */ this.running = 2;
/* 146 */ if (!nativeStart((this.owner == null ? this.url : this.owner.getURL()).unalias())) {
/* 147 */ this.running = 3;
/* */ }
/* */ }
/* */
/* */ synchronized void gotFinished(boolean f) {
/* 152 */ if ((f) &&
/* 153 */ (this.running == 2)) {
/* 154 */ start(this.leftToRepeat);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public synchronized void stop()
/* */ {
/* 167 */ this.leftToRepeat = 0;
/* 168 */ activeStopCmd = new MCISoundCommand() {
/* */ public void run() {
/* 170 */ if (MCISoundPlayer.activeStopCmd == this) {
/* 171 */ MCISoundPlayer.activeStopCmd = null;
/* 172 */ MCISoundPlayer.this.nativeStop();
/* */ }
/* */ }
/* 175 */ };
/* 176 */ mciThread.pushCommand(activeStopCmd);
/* */ }
/* */
/* 179 */ MCISoundCommand volumeCmd = new MCISoundCommand() {
/* */ public void run() {
/* 181 */ if (!WavSoundPlayer.ignoreVolumeChanges)
/* 182 */ MCISoundPlayer.this.nativeVolume(this.left, this.right);
/* */ }
/* */ };
/* */
/* */ public void volume(float left, float right) {
/* 187 */ this.volumeCmd.left = left;
/* 188 */ this.volumeCmd.right = right;
/* 189 */ if (!this.volumeCmd.isOnQueue) {
/* 190 */ mciThread.pushCommand(this.volumeCmd);
/* */ }
/* */ }
/* */
/* */ private native void nativeVolume(float paramFloat1, float paramFloat2);
/* */
/* */ private native boolean nativeStart(String paramString);
/* */
/* */ private native boolean nativeIsFinished();
/* */
/* */ private native void nativeStop();
/* */
/* */ public static native boolean isActive();
/* */
/* */ static native void shutdown();
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\MCISoundPlayer.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|