Re: Baffeled with IllegalArgumentException exception
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Nov 2006 09:33:06 -0800
Sundar wrote:
My best guess is that your sound card doesn't support ULAW.
It doesnt look like a hardware issue, coz the exception is thrown
randomly. Sometimes the program works fine and plays the audio
properly. But sometimes it fails with IllegalArgumentException !. If it
is a harware problem the exception will be consistent, But in reality
it isnt!!.
-Sundar
Knute Johnson wrote:Sundar wrote:Hi,My best guess is that your sound card doesn't support ULAW.
Iam using java sound API to play the audio. Iam using the Clip class to
play the audio. Frequently i get the following exception...
java.lang.IllegalArgumentException: No line matching interface Clip
supporting format ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, is
supported.
The exception is thrown in the code line "Targetclip = (Clip)
AudioSystem.getLine(info);"
The code snippet which throws the exception is as follows...
//Converting Audio Format
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
System.out.println("*** Converting...");
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits()*2,
format.getChannels(),
format.getFrameSize()*2,
format.getFrameRate(),
true); // big endian
stream2 = AudioSystem.getAudioInputStream(format, stream2);
}
printDebug("((int)stream2.getFrameLength()*format.getFrameSize()):
" + ((int)stream2.getFrameLength()*format.getFrameSize()));
DataLine.Info info = new DataLine.Info(Clip.class,
stream2.getFormat());
// DataLine.Info info2 = new DataLine.Info(Clip.class,
stream2.getFormat(),
((int)stream2.getFrameLength()*format.getFrameSize()));
Targetclip = (Clip) AudioSystem.getLine(info);
What could be wrong?? Why this exception is thrown? How do we solve
this??
Any links, sample code OR help in any form is highly appreciate.
Thanks in advance
-Sundar
--
Knute Johnson
email s/nospam/knute/
I'm not sure then what the problem is. If you want to post a simple test program that will show the problem, I'd be happy to play with it.
--
Knute Johnson
email s/nospam/knute/
.
- References:
- Baffeled with IllegalArgumentException exception
- From: Sundar
- Re: Baffeled with IllegalArgumentException exception
- From: Knute Johnson
- Re: Baffeled with IllegalArgumentException exception
- From: Sundar
- Baffeled with IllegalArgumentException exception
- Prev by Date: Re: Baffeled with IllegalArgumentException exception
- Next by Date: Re: Storing PublicKey and PrivateKey in a program
- Previous by thread: Re: Baffeled with IllegalArgumentException exception
- Next by thread: Compile jar for Microsoft Virtual Machine
- Index(es):
Relevant Pages
|