PDA

View Full Version : Java with sound


Bishop
04-01-2002, 08:11 PM
This code ...

protected Mixer theMixer;
protected AudioFormat audioFormat = new AudioFormat(44100.0F, 16, 1, false, true);
protected TargetDataLine recorder;

public AudioLayer()
{
Mixer.Info mixerInfo;
Object tmp = null;
DataLine.Info dLine = new DataLine.Info(TargetDataLine.class, audioFormat);

ListMixers();
mixerInfo = GetMixerInfo("Mac OS X,CoreAudio,Audio hardware");
System.out.println("Useing mixer: " + mixerInfo.getName());
theMixer = AudioSystem.getMixer(mixerInfo);
try {
tmp = theMixer.getLine(dLine);
} catch(Exception e) { System.err.println("\nException: " + e); System.exit(73); };


... produce this result


Available Mixers:
Java Sound Audio Engine
Mac OS X,CoreAudio,Audio hardware
Mac OS X,CoreAudio,Audio hardware
Useing mixer: Mac OS X,CoreAudio,Audio hardware

Exception: java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_UNSIGNED, 44100.0 Hz, 16 bit, mono, big-endian, audio data

talk2U.app has exited with status 73.

Anyone know why? This is my first experince useing sound in java so it might be something obvious. Sorry for the large amount of code included but I could not think of a better way to explain this problem.

/Bishop