@@ -262,14 +262,14 @@ private boolean setStartTime(float time) {
262
262
}
263
263
264
264
/**
265
- * Jump to a specific position in the audiosample while continuing to play (or starting to play if it wasn't playing already).
266
- *
267
- * @param time
268
- * position to jump to, in seconds.
265
+ * Jump to a specific position in the audiosample while continuing to play (or
266
+ * starting to play if it wasn't playing already).
267
+ *
268
+ * @param time position to jump to, in seconds
269
269
* @see AudioSample#cue(float)
270
270
* @see AudioSample#play()
271
271
* @webref Sampling:AudioSample
272
- * @webBrief Jump to a specific position in the audiosample while continuing to play (or starting to play if it wasn't playing already) .
272
+ * @webBrief Jumps to a specific position in the audio sample .
273
273
**/
274
274
public void jump (float time ) {
275
275
// FIXME this currently only works for simply *playing* files, if the
@@ -327,27 +327,25 @@ private void setStartFrameCountOffset() {
327
327
private void loopInternal (int startFrame , int numFrames , int numLoops ) {
328
328
// always use current sample player
329
329
this .stop ();
330
+ super .play (); // adds the player
330
331
this .setStartFrameCountOffset ();
331
332
this .startFrame = startFrame ;
332
333
QueueDataCommand cmd = this .player .dataQueue .createQueueDataCommand (this .sample , startFrame , numFrames );
333
334
// TODO setAutoStop(true) ?
334
- // TODO setImmadiate (true) ?
335
+ // TODO setImmediate (true) ?
335
336
cmd .setCallback (new PlaybackFinishedCallback ());
336
337
// TODO how to loop indefinitely??
337
- if (numLoops > 1 ) {
338
- // how many times it's *repeated* after the first time
339
- cmd .setNumLoops (numLoops - 1 );
340
- } else {
341
- // TODO this.player.dataQueue.queueLoop(this.sample, startFrame,
342
- // numFrames);
343
- }
338
+ // how many times it's *repeated* after the first time
339
+ // any negative number makes an infinite loop
340
+ cmd .setNumLoops (numLoops - 1 );
341
+ // TODO this.player.dataQueue.queueLoop(this.sample, startFrame, numFrames);
344
342
this .player .getSynthesizer ().queueCommand (cmd );
345
343
this .isPlayingAtLeastUntil = System .currentTimeMillis () + 50 ;
346
344
this .isPlaying = true ;
347
345
}
348
346
349
347
private void loopInternal (int startFrame , int numFrames ) {
350
- this .loopInternal (startFrame , numFrames , 0 );
348
+ this .loopInternal (startFrame , numFrames , - 1 );
351
349
}
352
350
353
351
/*
@@ -440,7 +438,6 @@ public void finished(QueueDataEvent event) {
440
438
stop ();
441
439
}
442
440
public void looped (QueueDataEvent event ) {
443
- System .out .println ("loop" );
444
441
}
445
442
public void started (QueueDataEvent event ) {
446
443
}
0 commit comments