summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/MusicManager.java
blob: c50ae78ce5d535a2d9327e78dea023272293fed6 (plain) (blame)
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import NET.worlds.console.DialogReceiver;
/*     */ import NET.worlds.console.Main;
/*     */ import NET.worlds.console.MainCallback;
/*     */ import NET.worlds.network.URL;
/*     */ import java.util.Hashtable;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class MusicManager
/*     */   implements MainCallback, DialogReceiver
/*     */ {
/*  55 */   private static Hashtable<URL, MusicManager> managers = new Hashtable();
/*     */   private static MusicManagerDialog dialog;
/*     */   private static boolean registered;
/*     */   private static URL lastWorldURL;
/*     */   private static boolean showDialog;
/*     */   private static MusicManager curManager;
/*  61 */   private static String lastRoomName = "";
/*     */   
/*     */   private static int lastCDTrack;
/*     */   private static URL lastMIDIFile;
/*     */   private String name;
/*  66 */   private Hashtable<String, MusicTrack> tracks = new Hashtable();
/*  67 */   private Hashtable<String, MusicRoom> rooms = new Hashtable();
/*     */   private World world;
/*     */   private String fileName;
/*     */   private boolean maybeMusicChange;
/*     */   
/*     */   public static void showDialog()
/*     */   {
/*  74 */     if (dialog == null)
/*  75 */       showDialog = true;
/*     */   }
/*     */   
/*     */   public MusicManager() {
/*  79 */     if (!registered) {
/*  80 */       Main.register(this);
/*  81 */       registered = true;
/*  82 */       curManager = this;
/*     */     }
/*     */   }
/*     */   
/*     */   private MusicManager(World world, URL url) {
/*  87 */     this.world = world;
/*  88 */     this.name = world.getName();
/*  89 */     String file = url.unalias().toLowerCase();
/*  90 */     int index = file.lastIndexOf(".world");
/*  91 */     if (index != -1) {
/*  92 */       this.fileName = (url.unalias().substring(0, index) + ".music");
/*  93 */       load();
/*     */     }
/*     */   }
/*     */   
/*     */   public World getWorld() {
/*  98 */     return this.world;
/*     */   }
/*     */   
/*     */   public String getName() {
/* 102 */     return this.name;
/*     */   }
/*     */   
/*     */   public String getFileName() {
/* 106 */     return this.fileName;
/*     */   }
/*     */   
/*     */   public Hashtable<String, MusicTrack> getMusic() {
/* 110 */     return this.tracks;
/*     */   }
/*     */   
/*     */   public MusicTrack getMusic(String name) {
/* 114 */     return (MusicTrack)this.tracks.get(name);
/*     */   }
/*     */   
/*     */   public Hashtable<String, MusicRoom> getRooms() {
/* 118 */     return this.rooms;
/*     */   }
/*     */   
/*     */   public MusicRoom getRoom(String name) {
/* 122 */     return (MusicRoom)this.rooms.get(name);
/*     */   }
/*     */   
/*     */   public synchronized void maybeChangedMusic() {
/* 126 */     this.maybeMusicChange = true;
/*     */   }
/*     */   
/*     */   /* Error */
/*     */   public void save()
/*     */   {
/*     */     // Byte code:
/*     */     //   0: aconst_null
/*     */     //   1: astore_1
/*     */     //   2: new 153	java/io/PrintStream
/*     */     //   5: dup
/*     */     //   6: new 155	java/io/FileOutputStream
/*     */     //   9: dup
/*     */     //   10: aload_0
/*     */     //   11: getfield 122	NET/worlds/scape/MusicManager:fileName	Ljava/lang/String;
/*     */     //   14: invokespecial 157	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
/*     */     //   17: invokespecial 158	java/io/PrintStream:<init>	(Ljava/io/OutputStream;)V
/*     */     //   20: astore_1
/*     */     //   21: aload_0
/*     */     //   22: getfield 58	NET/worlds/scape/MusicManager:tracks	Ljava/util/Hashtable;
/*     */     //   25: invokestatic 161	NET/worlds/core/Sort:sortKeys	(Ljava/util/Hashtable;)[Ljava/lang/String;
/*     */     //   28: astore_2
/*     */     //   29: iconst_0
/*     */     //   30: istore_3
/*     */     //   31: goto +100 -> 131
/*     */     //   34: aload_0
/*     */     //   35: getfield 58	NET/worlds/scape/MusicManager:tracks	Ljava/util/Hashtable;
/*     */     //   38: aload_2
/*     */     //   39: iload_3
/*     */     //   40: aaload
/*     */     //   41: invokevirtual 137	java/util/Hashtable:get	(Ljava/lang/Object;)Ljava/lang/Object;
/*     */     //   44: checkcast 141	NET/worlds/scape/MusicTrack
/*     */     //   47: astore 4
/*     */     //   49: aload 4
/*     */     //   51: invokevirtual 167	NET/worlds/scape/MusicTrack:getMIDIFileName	()Ljava/lang/String;
/*     */     //   54: astore 5
/*     */     //   56: aload 5
/*     */     //   58: invokevirtual 170	java/lang/String:length	()I
/*     */     //   61: ifne +7 -> 68
/*     */     //   64: ldc -82
/*     */     //   66: astore 5
/*     */     //   68: aload_1
/*     */     //   69: new 100	java/lang/StringBuilder
/*     */     //   72: dup
/*     */     //   73: ldc -80
/*     */     //   75: invokespecial 110	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
/*     */     //   78: aload 4
/*     */     //   80: invokevirtual 178	NET/worlds/scape/MusicTrack:getName	()Ljava/lang/String;
/*     */     //   83: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   86: ldc -77
/*     */     //   88: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   91: aload 4
/*     */     //   93: invokevirtual 181	NET/worlds/scape/MusicTrack:getVirtTrackNumber	()I
/*     */     //   96: invokevirtual 184	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
/*     */     //   99: ldc -77
/*     */     //   101: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   104: aload 5
/*     */     //   106: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   109: ldc -77
/*     */     //   111: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   114: aload 4
/*     */     //   116: invokevirtual 187	NET/worlds/scape/MusicTrack:getLooping	()Z
/*     */     //   119: invokevirtual 191	java/lang/StringBuilder:append	(Z)Ljava/lang/StringBuilder;
/*     */     //   122: invokevirtual 119	java/lang/StringBuilder:toString	()Ljava/lang/String;
/*     */     //   125: invokevirtual 194	java/io/PrintStream:println	(Ljava/lang/String;)V
/*     */     //   128: iinc 3 1
/*     */     //   131: iload_3
/*     */     //   132: aload_2
/*     */     //   133: arraylength
/*     */     //   134: if_icmplt -100 -> 34
/*     */     //   137: aload_0
/*     */     //   138: getfield 60	NET/worlds/scape/MusicManager:rooms	Ljava/util/Hashtable;
/*     */     //   141: invokestatic 161	NET/worlds/core/Sort:sortKeys	(Ljava/util/Hashtable;)[Ljava/lang/String;
/*     */     //   144: astore_2
/*     */     //   145: iconst_0
/*     */     //   146: istore_3
/*     */     //   147: goto +58 -> 205
/*     */     //   150: aload_0
/*     */     //   151: getfield 60	NET/worlds/scape/MusicManager:rooms	Ljava/util/Hashtable;
/*     */     //   154: aload_2
/*     */     //   155: iload_3
/*     */     //   156: aaload
/*     */     //   157: invokevirtual 137	java/util/Hashtable:get	(Ljava/lang/Object;)Ljava/lang/Object;
/*     */     //   160: checkcast 147	NET/worlds/scape/MusicRoom
/*     */     //   163: astore 4
/*     */     //   165: aload_1
/*     */     //   166: new 100	java/lang/StringBuilder
/*     */     //   169: dup
/*     */     //   170: ldc -59
/*     */     //   172: invokespecial 110	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
/*     */     //   175: aload 4
/*     */     //   177: invokevirtual 199	NET/worlds/scape/MusicRoom:getRoomName	()Ljava/lang/String;
/*     */     //   180: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   183: ldc -77
/*     */     //   185: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   188: aload 4
/*     */     //   190: invokevirtual 202	NET/worlds/scape/MusicRoom:getMusicName	()Ljava/lang/String;
/*     */     //   193: invokevirtual 115	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
/*     */     //   196: invokevirtual 119	java/lang/StringBuilder:toString	()Ljava/lang/String;
/*     */     //   199: invokevirtual 194	java/io/PrintStream:println	(Ljava/lang/String;)V
/*     */     //   202: iinc 3 1
/*     */     //   205: iload_3
/*     */     //   206: aload_2
/*     */     //   207: arraylength
/*     */     //   208: if_icmplt -58 -> 150
/*     */     //   211: goto +28 -> 239
/*     */     //   214: astore_2
/*     */     //   215: aload_1
/*     */     //   216: ifnull +31 -> 247
/*     */     //   219: aload_1
/*     */     //   220: invokevirtual 205	java/io/PrintStream:close	()V
/*     */     //   223: goto +24 -> 247
/*     */     //   226: astore 6
/*     */     //   228: aload_1
/*     */     //   229: ifnull +7 -> 236
/*     */     //   232: aload_1
/*     */     //   233: invokevirtual 205	java/io/PrintStream:close	()V
/*     */     //   236: aload 6
/*     */     //   238: athrow
/*     */     //   239: aload_1
/*     */     //   240: ifnull +7 -> 247
/*     */     //   243: aload_1
/*     */     //   244: invokevirtual 205	java/io/PrintStream:close	()V
/*     */     //   247: return
/*     */     // Line number table:
/*     */     //   Java source line #130	-> byte code offset #0
/*     */     //   Java source line #132	-> byte code offset #2
/*     */     //   Java source line #134	-> byte code offset #21
/*     */     //   Java source line #135	-> byte code offset #29
/*     */     //   Java source line #136	-> byte code offset #34
/*     */     //   Java source line #137	-> byte code offset #49
/*     */     //   Java source line #138	-> byte code offset #56
/*     */     //   Java source line #139	-> byte code offset #64
/*     */     //   Java source line #140	-> byte code offset #68
/*     */     //   Java source line #141	-> byte code offset #91
/*     */     //   Java source line #142	-> byte code offset #114
/*     */     //   Java source line #140	-> byte code offset #125
/*     */     //   Java source line #135	-> byte code offset #128
/*     */     //   Java source line #144	-> byte code offset #137
/*     */     //   Java source line #145	-> byte code offset #145
/*     */     //   Java source line #146	-> byte code offset #150
/*     */     //   Java source line #147	-> byte code offset #165
/*     */     //   Java source line #145	-> byte code offset #202
/*     */     //   Java source line #149	-> byte code offset #211
/*     */     //   Java source line #151	-> byte code offset #215
/*     */     //   Java source line #152	-> byte code offset #219
/*     */     //   Java source line #150	-> byte code offset #226
/*     */     //   Java source line #151	-> byte code offset #228
/*     */     //   Java source line #152	-> byte code offset #232
/*     */     //   Java source line #153	-> byte code offset #236
/*     */     //   Java source line #151	-> byte code offset #239
/*     */     //   Java source line #152	-> byte code offset #243
/*     */     //   Java source line #154	-> byte code offset #247
/*     */     // Local variable table:
/*     */     //   start	length	slot	name	signature
/*     */     //   0	248	0	this	MusicManager
/*     */     //   1	243	1	out	java.io.PrintStream
/*     */     //   28	179	2	keys	String[]
/*     */     //   214	1	2	localException	Exception
/*     */     //   30	102	3	i	int
/*     */     //   146	60	3	i	int
/*     */     //   47	68	4	m	MusicTrack
/*     */     //   163	26	4	r	MusicRoom
/*     */     //   54	51	5	midiName	String
/*     */     //   226	11	6	localObject	Object
/*     */     // Exception table:
/*     */     //   from	to	target	type
/*     */     //   2	211	214	java/lang/Exception
/*     */     //   2	215	226	finally
/*     */   }
/*     */   
/*     */   /* Error */
/*     */   private void load()
/*     */   {
/*     */     // Byte code:
/*     */     //   0: aload_0
/*     */     //   1: getfield 58	NET/worlds/scape/MusicManager:tracks	Ljava/util/Hashtable;
/*     */     //   4: invokevirtual 223	java/util/Hashtable:clear	()V
/*     */     //   7: aload_0
/*     */     //   8: getfield 60	NET/worlds/scape/MusicManager:rooms	Ljava/util/Hashtable;
/*     */     //   11: invokevirtual 223	java/util/Hashtable:clear	()V
/*     */     //   14: aconst_null
/*     */     //   15: astore_1
/*     */     //   16: aconst_null
/*     */     //   17: astore_2
/*     */     //   18: new 226	java/io/DataInputStream
/*     */     //   21: dup
/*     */     //   22: new 228	java/io/FileInputStream
/*     */     //   25: dup
/*     */     //   26: aload_0
/*     */     //   27: getfield 122	NET/worlds/scape/MusicManager:fileName	Ljava/lang/String;
/*     */     //   30: invokespecial 230	java/io/FileInputStream:<init>	(Ljava/lang/String;)V
/*     */     //   33: invokespecial 231	java/io/DataInputStream:<init>	(Ljava/io/InputStream;)V
/*     */     //   36: astore_1
/*     */     //   37: goto +125 -> 162
/*     */     //   40: new 234	java/util/StringTokenizer
/*     */     //   43: dup
/*     */     //   44: aload_2
/*     */     //   45: ldc -77
/*     */     //   47: invokespecial 236	java/util/StringTokenizer:<init>	(Ljava/lang/String;Ljava/lang/String;)V
/*     */     //   50: astore_3
/*     */     //   51: aload_3
/*     */     //   52: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   55: astore 4
/*     */     //   57: aload 4
/*     */     //   59: ldc -14
/*     */     //   61: invokevirtual 244	java/lang/String:equals	(Ljava/lang/Object;)Z
/*     */     //   64: ifeq +55 -> 119
/*     */     //   67: new 141	NET/worlds/scape/MusicTrack
/*     */     //   70: dup
/*     */     //   71: aload_3
/*     */     //   72: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   75: aload_3
/*     */     //   76: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   79: invokestatic 248	java/lang/Integer:parseInt	(Ljava/lang/String;)I
/*     */     //   82: aload_3
/*     */     //   83: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   86: aload_3
/*     */     //   87: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   90: invokestatic 253	java/lang/Boolean:valueOf	(Ljava/lang/String;)Ljava/lang/Boolean;
/*     */     //   93: invokevirtual 258	java/lang/Boolean:booleanValue	()Z
/*     */     //   96: invokespecial 261	NET/worlds/scape/MusicTrack:<init>	(Ljava/lang/String;ILjava/lang/String;Z)V
/*     */     //   99: astore 5
/*     */     //   101: aload_0
/*     */     //   102: getfield 58	NET/worlds/scape/MusicManager:tracks	Ljava/util/Hashtable;
/*     */     //   105: aload 5
/*     */     //   107: invokevirtual 178	NET/worlds/scape/MusicTrack:getName	()Ljava/lang/String;
/*     */     //   110: aload 5
/*     */     //   112: invokevirtual 264	java/util/Hashtable:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
/*     */     //   115: pop
/*     */     //   116: goto +46 -> 162
/*     */     //   119: aload 4
/*     */     //   121: ldc_w 268
/*     */     //   124: invokevirtual 244	java/lang/String:equals	(Ljava/lang/Object;)Z
/*     */     //   127: ifeq +35 -> 162
/*     */     //   130: new 147	NET/worlds/scape/MusicRoom
/*     */     //   133: dup
/*     */     //   134: aload_3
/*     */     //   135: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   138: aload_3
/*     */     //   139: invokevirtual 239	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
/*     */     //   142: invokespecial 270	NET/worlds/scape/MusicRoom:<init>	(Ljava/lang/String;Ljava/lang/String;)V
/*     */     //   145: astore 5
/*     */     //   147: aload_0
/*     */     //   148: getfield 60	NET/worlds/scape/MusicManager:rooms	Ljava/util/Hashtable;
/*     */     //   151: aload 5
/*     */     //   153: invokevirtual 199	NET/worlds/scape/MusicRoom:getRoomName	()Ljava/lang/String;
/*     */     //   156: aload 5
/*     */     //   158: invokevirtual 264	java/util/Hashtable:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
/*     */     //   161: pop
/*     */     //   162: aload_1
/*     */     //   163: invokevirtual 271	java/io/DataInputStream:readLine	()Ljava/lang/String;
/*     */     //   166: dup
/*     */     //   167: astore_2
/*     */     //   168: ifnonnull -128 -> 40
/*     */     //   171: goto +38 -> 209
/*     */     //   174: astore_3
/*     */     //   175: aload_1
/*     */     //   176: ifnull +46 -> 222
/*     */     //   179: aload_1
/*     */     //   180: invokevirtual 274	java/io/DataInputStream:close	()V
/*     */     //   183: goto +39 -> 222
/*     */     //   186: astore 7
/*     */     //   188: goto +34 -> 222
/*     */     //   191: astore 6
/*     */     //   193: aload_1
/*     */     //   194: ifnull +12 -> 206
/*     */     //   197: aload_1
/*     */     //   198: invokevirtual 274	java/io/DataInputStream:close	()V
/*     */     //   201: goto +5 -> 206
/*     */     //   204: astore 7
/*     */     //   206: aload 6
/*     */     //   208: athrow
/*     */     //   209: aload_1
/*     */     //   210: ifnull +12 -> 222
/*     */     //   213: aload_1
/*     */     //   214: invokevirtual 274	java/io/DataInputStream:close	()V
/*     */     //   217: goto +5 -> 222
/*     */     //   220: astore 7
/*     */     //   222: return
/*     */     // Line number table:
/*     */     //   Java source line #157	-> byte code offset #0
/*     */     //   Java source line #158	-> byte code offset #7
/*     */     //   Java source line #159	-> byte code offset #14
/*     */     //   Java source line #160	-> byte code offset #16
/*     */     //   Java source line #162	-> byte code offset #18
/*     */     //   Java source line #163	-> byte code offset #37
/*     */     //   Java source line #164	-> byte code offset #40
/*     */     //   Java source line #165	-> byte code offset #51
/*     */     //   Java source line #166	-> byte code offset #57
/*     */     //   Java source line #167	-> byte code offset #67
/*     */     //   Java source line #168	-> byte code offset #75
/*     */     //   Java source line #169	-> byte code offset #86
/*     */     //   Java source line #167	-> byte code offset #96
/*     */     //   Java source line #170	-> byte code offset #101
/*     */     //   Java source line #171	-> byte code offset #116
/*     */     //   Java source line #172	-> byte code offset #130
/*     */     //   Java source line #173	-> byte code offset #138
/*     */     //   Java source line #172	-> byte code offset #142
/*     */     //   Java source line #174	-> byte code offset #147
/*     */     //   Java source line #163	-> byte code offset #162
/*     */     //   Java source line #177	-> byte code offset #171
/*     */     //   Java source line #180	-> byte code offset #175
/*     */     //   Java source line #181	-> byte code offset #179
/*     */     //   Java source line #182	-> byte code offset #183
/*     */     //   Java source line #178	-> byte code offset #191
/*     */     //   Java source line #180	-> byte code offset #193
/*     */     //   Java source line #181	-> byte code offset #197
/*     */     //   Java source line #182	-> byte code offset #201
/*     */     //   Java source line #184	-> byte code offset #206
/*     */     //   Java source line #180	-> byte code offset #209
/*     */     //   Java source line #181	-> byte code offset #213
/*     */     //   Java source line #182	-> byte code offset #217
/*     */     //   Java source line #185	-> byte code offset #222
/*     */     // Local variable table:
/*     */     //   start	length	slot	name	signature
/*     */     //   0	223	0	this	MusicManager
/*     */     //   15	199	1	in	java.io.DataInputStream
/*     */     //   17	151	2	line	String
/*     */     //   50	89	3	tok	java.util.StringTokenizer
/*     */     //   174	1	3	localException	Exception
/*     */     //   55	65	4	type	String
/*     */     //   99	12	5	track	MusicTrack
/*     */     //   145	12	5	room	MusicRoom
/*     */     //   191	16	6	localObject	Object
/*     */     //   186	1	7	localIOException	java.io.IOException
/*     */     //   204	1	7	localIOException1	java.io.IOException
/*     */     //   220	1	7	localIOException2	java.io.IOException
/*     */     // Exception table:
/*     */     //   from	to	target	type
/*     */     //   18	171	174	java/lang/Exception
/*     */     //   175	183	186	java/io/IOException
/*     */     //   18	175	191	finally
/*     */     //   193	201	204	java/io/IOException
/*     */     //   209	217	220	java/io/IOException
/*     */   }
/*     */   
/*     */   public void mainCallback()
/*     */   {
/* 188 */     Pilot pilot = Pilot.getActive();
/* 189 */     if (pilot != null) {
/* 190 */       World world = pilot.getWorld();
/* 191 */       boolean worldChange = false;
/* 192 */       String newRoomName = "";
/* 193 */       if (world != null) {
/* 194 */         URL url = world.getSourceURL();
/* 195 */         if (!url.equals(lastWorldURL)) {
/* 196 */           MusicManager manager = (MusicManager)managers.get(url);
/* 197 */           if (manager == null) {
/* 198 */             manager = new MusicManager(world, url);
/* 199 */             managers.put(url, manager);
/*     */           }
/* 201 */           lastWorldURL = url;
/* 202 */           curManager = manager;
/* 203 */           worldChange = true;
/*     */         }
/* 205 */         Room room = pilot.getRoom();
/* 206 */         if (room != null) {
/* 207 */           String roomName = room.getName();
/* 208 */           if (roomName != null)
/* 209 */             newRoomName = roomName;
/*     */         }
/*     */       } else {
/* 212 */         lastWorldURL = null; }
/* 213 */       synchronized (this) {
/* 214 */         if ((worldChange) || (!newRoomName.equals(lastRoomName)) || 
/* 215 */           (curManager.maybeMusicChange)) {
/* 216 */           curManager.maybeMusicChange = false;
/* 217 */           lastRoomName = newRoomName;
/* 218 */           MusicRoom mr = curManager.getRoom(lastRoomName);
/* 219 */           CDAudio cd = CDAudio.get();
/* 220 */           boolean found = false;
/* 221 */           if (mr != null) {
/* 222 */             MusicTrack mt = curManager.getMusic(mr.getMusicName());
/* 223 */             if (mt != null) {
/* 224 */               found = true;
/* 225 */               int track = mt.getVirtTrackNumber();
/* 226 */               boolean changed = false;
/* 227 */               if (track != cd.getCDTrack()) {
/* 228 */                 cd.setCDTrack(lastCDTrack = track);
/* 229 */                 changed = true;
/*     */               }
/* 231 */               String name = mt.getMIDIFileName();
/*     */               URL midiPath;
/* 233 */               URL midiPath; if (name.length() != 0) {
/* 234 */                 midiPath = URL.make(world.getSourceURL(), 
/* 235 */                   mt.getMIDIFileName());
/*     */               } else
/* 237 */                 midiPath = cd.getDefaultMIDIFile();
/* 238 */               if (!midiPath.equals(cd.getMIDIFile())) {
/* 239 */                 cd.setMIDIFile(lastMIDIFile = midiPath);
/* 240 */                 changed = true;
/*     */               }
/* 242 */               if (changed)
/* 243 */                 cd.change(mt.getLooping());
/*     */             }
/*     */           }
/* 246 */           if (!found) {
/* 247 */             if (((lastCDTrack != 0) && (cd.getCDTrack() == lastCDTrack)) || (
/* 248 */               (lastMIDIFile != null) && 
/* 249 */               (lastMIDIFile.equals(cd.getMIDIFile())))) {
/* 250 */               cd.setCDTrack(0);
/* 251 */               cd.setMIDIFile(cd.getDefaultMIDIFile());
/* 252 */               cd.stop();
/*     */             }
/* 254 */             lastCDTrack = 0;
/* 255 */             lastMIDIFile = null;
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/* 260 */     lastWorldURL = null;
/* 261 */     if ((lastWorldURL != null) && (dialog == null) && (showDialog)) {
/* 262 */       showDialog = false;
/* 263 */       dialog = new MusicManagerDialog(
/* 264 */         (MusicManager)managers.get(lastWorldURL));
/*     */     }
/*     */   }
/*     */   
/*     */   public void dialogDone(Object who, boolean confirmed) {
/* 269 */     if (confirmed) {
/* 270 */       save();
/*     */     } else {
/* 272 */       load();
/* 273 */       maybeChangedMusic();
/*     */     }
/* 275 */     dialog = null;
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\MusicManager.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */