Code example for SourceDataLine

Methods: open

0
            throws LineUnavailableExceptionDataLine.Info info = new DataLine.Info(SourceDataLine.class, stream
                .getFormat()); 
        SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
        line.open(stream.getFormat(), bufferSize);
        return line;
    } 
 
    /** 
     * Create a new buffer. The buffer size will vary according to the noise 
     * frame size and rate. 
     *  
     * @return The noise buffer. 
     */ 
    private byte[] createStreamedBuffer() 
    { 
        int bufferSize = stream.getFormat().getFrameSize()
                * Math.round(stream.getFormat().getSampleRate() / 10);