AudioClip playlist!! grumble!
Hello, is there anyone out there who knows how to create a playlist using audioclip.... i've got audioclip working fine, playing wav's nice and dandy but i need a function, like a list or que.... when the user selects a song its added to the que and then each song is played through the playlist until the end.... just like, well, a jukebox would... i dont want the songs played straight away when selected...
someone told me to use java.sound.sampled as this would allow the program to know when the song has finished and i can then pull that song from the top of the que and play the next... but im having loads of trouble with the buffer with sound.sampled and wav. clips..... is there any other way.... has anyone seen a simple program that plays songs from a playlist like i need.....
and could someone whos me a working example of
try{
// From file
AudioInputStream stream = AudioSystem.getAudioInputStream(new File("audiofile"));
// From URL
stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile"));
// At present, ALAW and ULAW encodings must be converted
// to PCM_SIGNED before it can be played
AudioFormat format = stream.getFormat();
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED){
format =new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits()*2,
format.getChannels(),
format.getFrameSize()*2,
format.getFrameRate(),
true);// big endian
stream = AudioSystem.getAudioInputStream(format, stream);
}
// Create the clip
DataLine.Info info =new DataLine.Info(
Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
Clip clip = (Clip) AudioSystem.getLine(info);
// This method does not return until the audio file is completely loaded
clip.open(stream);
// Start playing
clip.start();
}catch (MalformedURLException e){
}catch (IOException e){
}catch (LineUnavailableException e){
}catch (UnsupportedAudioFileException e){
}
using a wav file directory.......... this is driving me nuts..i keep getting biffer probelms...cheers

