Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I know if a certain tick in a sequence has been reached during playback?

2742794Aug 30 2014 — edited Aug 30 2014

I'm using the sequencer to play a sequence and I need to jump to an other part of the sequence when a certain tick is reached. Imagine a loop that when we reach tick number "y" we jump back to tick number "x". But I'm not doing a loop so the built in looping methods won't work for me because sometimes I have to jump forward and that is not allowed .

At the moment I'm using a swing timer that fires a getTickPosition() every millisecond until I reach my desired tick but this is giving me slightly inconsistent results and I have a feeling it is using a lot of CPU for a fairly simple task.

I wish there was an event listener that would notify me when a certain tick is processed by the sequencer or even if I could be notified each time a new tick is processed so that I can do a check to see if it was the tick I was waiting for.

I wonder how the sequencer does it internally for knowing when the loop end is.

Any suggestions or workarounds would be greatly appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2014
Added on Aug 30 2014
0 comments
966 views