List of usage examples for javax.sound.sampled SourceDataLine getFormat
AudioFormat getFormat();
From source file:javazoom.jlgui.player.amp.visual.ui.SpectrumTimeAnalyzer.java
/** * Setup DSP./* w ww . j a v a 2 s . c o m*/ * @param line */ public void setupDSP(SourceDataLine line) { if (dsp != null) { int channels = line.getFormat().getChannels(); if (channels == 1) dsp.setChannelMode(KJDigitalSignalProcessingAudioDataConsumer.CHANNEL_MODE_MONO); else dsp.setChannelMode(KJDigitalSignalProcessingAudioDataConsumer.CHANNEL_MODE_STEREO); int bits = line.getFormat().getSampleSizeInBits(); if (bits == 8) dsp.setSampleType(KJDigitalSignalProcessingAudioDataConsumer.SAMPLE_TYPE_EIGHT_BIT); else dsp.setSampleType(KJDigitalSignalProcessingAudioDataConsumer.SAMPLE_TYPE_SIXTEEN_BIT); } }