Sign in to follow this  
FlaiseSaffron

[java] Getting a Clip for a java sound SPI

Recommended Posts

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this