Reputation: 73
Suppose I have a sound file that I wish to play in this manner:
Essentially, I wish for the song to play from 0:00 to 0:30, then loop from 0:30 to the end.
How do you do this?
Usually, when playing Audio Files, I use AudioClip.
AudioClip audio = Applet.newAudioClip( this.getClass().getResource( "..." ) );
audio.loop();
It's because of bad experiences with loading the audio file when the project is packed into a .jar file. If the method you recommend uses another class, I would still be more than happy to listen. However, if you've encountered the same problem as I have and know how to fix it, please do tell me.
Upvotes: 0
Views: 170
Reputation: 168825
You might use a Clip
for this, or if the clip is too large, feed the bytes directly to a SourceDataLine
.
Upvotes: 1