MCPcopy Create free account
hub / github.com/demoth/jake2 / Play

Method Play

client/src/main/java/jake2/client/CDAudio.java:211–252  ·  view source on GitHub ↗
(int track, boolean looping)

Source from the content-addressed store, hash-verified

209 }
210
211 public static void Play(int track, boolean looping) {
212 if (cdfile == -1 || !enabled)
213 return;
214
215 if (!cdValid) {
216 GetAudioDiskInfo();
217 if (!cdValid)
218 return;
219 }
220
221 //track = remap[track];
222
223 if (track < 1 || track > maxTrack) {
224 Com.Printf("CD Audio (MP3s) Bad track number " + track +".\n");
225 return;
226 }
227
228 if (playing)
229 {
230 if (playTrack == track)
231 return;
232 Stop();
233 }
234
235 // play mp3 file
236 String mp3filename = cddir.string + "\\soundtrack\\" +track + ".mp3";
237 mp3 = new MP3(mp3filename, looping);
238 mp3.play();
239 if (mp3.isError() == true)
240 return;
241
242 playLooping = looping;
243 playTrack = (byte) track;
244 playing = true;
245
246 if (cd_volume.value == 0.0f)
247 Stop ();
248 if (looping == true)
249 Com.DPrintf("CD Audio (MP3s) Looping track " + track + "\n");
250 else
251 Com.DPrintf("CD Audio (MP3s) Playing track " + track + "\n");
252 }
253
254 public static void Stop() {
255 if (cdfile == -1 || enabled == false || playing == false)

Callers 3

PrepRefreshMethod · 0.95
CD_fMethod · 0.95
ParseConfigStringMethod · 0.95

Calls 6

GetAudioDiskInfoMethod · 0.95
PrintfMethod · 0.95
StopMethod · 0.95
DPrintfMethod · 0.95
playMethod · 0.80
isErrorMethod · 0.80

Tested by

no test coverage detected