This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

My Midiplayer isn't looping

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can only figure it has something to do with the methods I'm using. The music would play, then when it reaches the end of the track, the looping method picks that up.

But for some reason, it executes both the if and else blocks.

In other words, the music plays, then when its supposed to loop again, it stops and terminates.


Here are the codes. This is the client class where the looping fails.




And this is the utility class.

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the utility class where you control the looping, you simply call sequence.start(). The start method API says this:

Since the playback has just completed, the current position would be at the end of your MIDI sequence. You need to re-set the sequence. I think the best way to do that is to use:

But I wonder why you don't use the MIDI Sequencer's inbuilt looping?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!