20 |
20 |
21 import com.nokia.microedition.media.control.ControlImpl; |
21 import com.nokia.microedition.media.control.ControlImpl; |
22 |
22 |
23 |
23 |
24 public class RateControl extends ControlImpl implements |
24 public class RateControl extends ControlImpl implements |
25 javax.microedition.media.control.RateControl { |
25 javax.microedition.media.control.RateControl |
|
26 { |
26 |
27 |
27 private final static int DEFUALT_RATE=100000; |
28 private final static int DEFUALT_RATE=100000; |
28 private final static int MIN_RATE=0; |
29 private final static int MIN_RATE=0; |
29 /** |
30 /** |
30 * |
31 * |
31 * @param aPlayer |
32 * @param aPlayer |
32 */ |
33 */ |
33 public RateControl(Player aPlayer){ |
34 public RateControl(Player aPlayer) |
34 this.iPlayer=aPlayer; |
35 { |
35 ((AnimationPlayer)iPlayer).setiCurrentRate(DEFUALT_RATE); |
36 this.iPlayer=aPlayer; |
36 } |
37 ((AnimationPlayer)iPlayer).setiCurrentRate(DEFUALT_RATE); |
37 |
38 } |
38 /* (non-Javadoc) |
|
39 * @see javax.microedition.media.control.RateControl#getMaxRate() |
|
40 */ |
|
41 public int getMaxRate() { |
|
42 checkState(); |
|
43 return DEFUALT_RATE; |
|
44 } |
|
45 |
39 |
46 /* (non-Javadoc) |
40 /* (non-Javadoc) |
47 * @see javax.microedition.media.control.RateControl#getMinRate() |
41 * @see javax.microedition.media.control.RateControl#getMaxRate() |
48 */ |
42 */ |
49 public int getMinRate() { |
43 public int getMaxRate() |
50 checkState(); |
44 { |
51 return MIN_RATE; |
45 checkState(); |
52 } |
46 return DEFUALT_RATE; |
|
47 } |
53 |
48 |
54 /* (non-Javadoc) |
49 /* (non-Javadoc) |
55 * @see javax.microedition.media.control.RateControl#getRate() |
50 * @see javax.microedition.media.control.RateControl#getMinRate() |
56 */ |
51 */ |
57 public int getRate() { |
52 public int getMinRate() |
58 checkState(); |
53 { |
59 return ((AnimationPlayer)iPlayer).getiCurrentRate(); |
54 checkState(); |
60 } |
55 return MIN_RATE; |
|
56 } |
61 |
57 |
62 /** |
58 /* (non-Javadoc) |
63 * Current implementation support only two rate default(100000) or min(0). |
59 * @see javax.microedition.media.control.RateControl#getRate() |
64 * No other rate is supported |
60 */ |
65 */ |
61 public int getRate() |
66 public int setRate(int aMilliRate) { |
62 { |
67 checkState(); |
63 checkState(); |
68 int rate =aMilliRate; |
64 return ((AnimationPlayer)iPlayer).getiCurrentRate(); |
69 if(rate<=MIN_RATE){ |
65 } |
70 rate =MIN_RATE; |
66 |
71 }else if(rate >= DEFUALT_RATE){ |
67 /** |
72 rate =DEFUALT_RATE; |
68 * Current implementation support only two rate default(100000) or min(0). |
73 } |
69 * No other rate is supported |
74 return ((AnimationPlayer)iPlayer).setiCurrentRate(rate) ; |
70 */ |
75 } |
71 public int setRate(int aMilliRate) |
|
72 { |
|
73 checkState(); |
|
74 int rate =aMilliRate; |
|
75 if (rate<=MIN_RATE) |
|
76 { |
|
77 rate =MIN_RATE; |
|
78 } |
|
79 else if (rate >= DEFUALT_RATE) |
|
80 { |
|
81 rate =DEFUALT_RATE; |
|
82 } |
|
83 return ((AnimationPlayer)iPlayer).setiCurrentRate(rate) ; |
|
84 } |
76 } |
85 } |