summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/CDTrackInfo.java
blob: 75326f70f1c901e2454cc8a780a5b2fd73e2ecd3 (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
/*    */ package NET.worlds.scape;
/*    */ 
/*    */ import java.io.PrintStream;
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CDTrackInfo
/*    */ {
/*    */   private int[] pos;
/*    */   private int[] len;
/*    */   
/*    */   public CDTrackInfo(int numTracks)
/*    */   {
/* 14 */     this.pos = new int[numTracks];
/* 15 */     this.len = new int[numTracks];
/*    */   }
/*    */   
/* 18 */   public int getNumTracks() { return this.pos.length; }
/*    */   
/*    */   public int getStartFrames(int track)
/*    */   {
/* 22 */     return getPosM(track) * 60 * 75 + getPosS(track) * 75 + getPosF(track);
/*    */   }
/*    */   
/*    */   public int getEndFrames(int track)
/*    */   {
/* 27 */     if (track == this.pos.length - 1)
/* 28 */       return getStartFrames(track) + 
/* 29 */         getLenM(track) * 60 * 75 + getLenS(track) * 75 + 
/* 30 */         getLenF(track);
/* 31 */     return getStartFrames(track + 1) - 1;
/*    */   }
/*    */   
/* 34 */   public int getPosM(int track) { return minutes(this.pos[track]); }
/* 35 */   public int getPosS(int track) { return seconds(this.pos[track]); }
/* 36 */   public int getPosF(int track) { return frames(this.pos[track]); }
/*    */   
/* 38 */   public int getLenM(int track) { return minutes(this.len[track]); }
/* 39 */   public int getLenS(int track) { return seconds(this.len[track]); }
/* 40 */   public int getLenF(int track) { return frames(this.len[track]); }
/*    */   
/*    */   private static int minutes(int packed)
/*    */   {
/* 44 */     return packed & 0xFF;
/*    */   }
/*    */   
/*    */   private static int seconds(int packed)
/*    */   {
/* 49 */     return packed >> 8 & 0xFF;
/*    */   }
/*    */   
/*    */   private static int frames(int packed)
/*    */   {
/* 54 */     return packed >> 16 & 0xFF;
/*    */   }
/*    */   
/*    */   private static String format2(int val)
/*    */   {
/* 59 */     String result = "";
/* 60 */     if (val < 10)
/* 61 */       result = "0";
/* 62 */     return result + val;
/*    */   }
/*    */   
/*    */   private static String format(int packed)
/*    */   {
/* 67 */     return 
/* 68 */       minutes(packed) + ":" + format2(seconds(packed)) + ":" + format2(frames(packed));
/*    */   }
/*    */   
/*    */   public void dump()
/*    */   {
/* 73 */     System.out.println("Tracks: " + this.pos.length);
/* 74 */     for (int i = 0; i < this.pos.length; i++) {
/* 75 */       System.out.println("Track " + i + " " + "start " + format(this.pos[i]) + 
/* 76 */         " length " + format(this.len[i]));
/*    */     }
/*    */   }
/*    */ }


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