|
-
March 2nd, 2000, 08:07 PM
#1
how to play a *.midi files in loop??? urgent!!!
In less than 5H i have to give back to my teacher a java application game that i juste have finished but.....i have to play a files.midi in loop and i don't know the easiest way to proceed.....( i'm a beginner so please.....i need detailed feedback.....thnaks.)
-
March 3rd, 2000, 08:44 PM
#2
Re: how to play a *.midi files in loop??? urgent!!!
Try this way:
import java.applet.*;
import java.net.*;
public class MidiLoop extends Applet
{
// use your MIDI file name here:
protected final String SOUND_FILE_NAME = "littlecz.mid";
// applet entry point
public void init()
{
// ... any operators
try
{
// compose URL path to your midi file
URL url = new URL(getCodeBase(), SOUND_FILE_NAME);
// get audio clip reference
AudioClip audioClip = this.getAudioClip(url);
// play clip in infinite loop
audioClip.loop();
}
catch(MalformedURLException ex)
{
System.out.println("can't load sound file");
}
// ...
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|