[java] Getting a Clip for a java sound SPI

Started by
0 comments, last by FlaiseSaffron 14 years, 3 months ago
I am trying to use the Tritonus plugins to load and play music saved in a compressed file format (.ogg and .wav compressed with the GSM 06.10 schema). The SPI appears to link to my program and load the file properly, but I don't know how to acquire a clip that will play the loaded music stream. Relevant code:

stream = AudioSystem.getAudioInputStream(url);
format = stream.getFormat();
frameLength = (int)stream.getFrameLength();
clip = AudioSystem.getClip();
clip.open(new AudioInputStream(stream, format, frameLength)); // Throws the below exception

Output:

javax.sound.sampled.LineUnavailableException: line with format VORBIS 44100.0 Hz, unknown bits per sample, stereo, unknown frame size, unknown frame rate,  not supported.
	at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(Unknown Source)
	at com.sun.media.sound.DirectAudioDevice$DirectClip.implOpen(Unknown Source)
	at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
	at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
	at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
	at (my code...)

Can anyone help?
Advertisement
Surely someone can at least give me a hint. I don't care exactly which plugin I end up using as long as it can be made to decode compressed audio without crashing.

This topic is closed to new replies.

Advertisement