Rev 70 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 70 | Rev 77 | ||
---|---|---|---|
Line 68... | Line 68... | ||
68 | 68 | ||
69 | public void start_playing(String name) |
69 | public void start_playing(String name) |
70 | { |
70 | { |
Line -... | Line 71... | ||
- | 71 | try { |
|
71 | try { |
72 | |
- | 73 | try { |
|
- | 74 | player = Manager.createPlayer(getClass().getResourceAsStream(name+".mp3"), "audio/mp3"); |
|
- | 75 | } |
|
- | 76 | catch (Exception e) { |
|
72 | 77 | player = Manager.createPlayer(getClass().getResourceAsStream(name+".wav"), "audio/x-wav"); |
|
73 | player = Manager.createPlayer(getClass().getResourceAsStream(name), "audio/mp3"); |
78 | } |
74 | player.addPlayerListener(this); |
79 | player.addPlayerListener(this); |
Line 75... | Line 80... | ||
75 | player.realize(); |
80 | player.realize(); |
Line 82... | Line 87... | ||
82 | 87 | ||
83 | player.prefetch(); |
88 | player.prefetch(); |
84 | player.setLoopCount(1); |
89 | player.setLoopCount(1); |
85 | player.start(); |
90 | player.start(); |
86 | } |
91 | } |
- | 92 | catch (Exception e) { |
|
- | 93 | ||
- | 94 | ||
- | 95 | ||
- | 96 | ||
87 | catch (Exception e) { } |
97 | } |
Line 88... | Line 98... | ||
88 | } |
98 | } |
89 | 99 | ||
90 | public void wait_for_end() |
100 | public void wait_for_end() |
Line 106... | Line 116... | ||
106 | 116 | ||
107 | if (mk.connected&&(canvas.do_sound)&&(mk.debug_data.UBatt()!=-1)&&(!mk.force_disconnect)) |
117 | if (mk.connected&&(canvas.do_sound)&&(mk.debug_data.UBatt()!=-1)&&(!mk.force_disconnect)) |
108 | { |
118 | { |
Line 109... | Line 119... | ||
109 | int ubatt=mk.debug_data.UBatt(); |
119 | int ubatt=mk.debug_data.UBatt(); |
110 | 120 | ||
Line 111... | Line 121... | ||
111 | start_playing((ubatt/10)+".mp3"); |
121 | start_playing(""+(ubatt/10)); |
112 | wait_for_end(); |
122 | wait_for_end(); |
113 | 123 | ||
114 | if((ubatt%10)!=0) |
124 | if((ubatt%10)!=0) |
115 | { |
125 | { |
116 | start_playing("komma.mp3"); |
126 | start_playing("komma"); |
117 | wait_for_end(); |
127 | wait_for_end(); |
118 | start_playing((ubatt%10)+".mp3"); |
128 | start_playing(""+(ubatt%10)); |
Line 119... | Line 129... | ||
119 | wait_for_end(); |
129 | wait_for_end(); |
Line 120... | Line 130... | ||
120 | } |
130 | } |