Code example for SourceDataLine

Methods: write

0
	@Override 
	public boolean process(AudioEvent audioEvent) {
		// overlap in samples * nr of bytes / sample = bytes overlap 
		int byteOverlap = audioEvent.getOverlap() * format.getFrameSize();
		int byteStepSize = audioEvent.getBufferSize() * format.getFrameSize() - byteOverlap;
		line.write(audioEvent.getByteBuffer(), byteOverlap, byteStepSize);		
		return true; 
	} 
	 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see be.tarsos.util.RealTimeAudioProcessor.AudioProcessor# 
	 * processingFinished() 
	 */ 
	public void processingFinished() { 
		// cleanup 
		line.drain();//drain takes too long..
		line.stop();
		line.close();