Code example for SourceDataLine

Methods: close

0
	} 
 
	public void destroy() { 
		if (dataLine == null) return;
		clock.terminate();
		dataLine.close();
		dataLine = null;
	} 
 
	@Override 
	public synchronized int nextSamples(byte[] buffer, int quant) {
		if (dataLine == null) return -1;
		if (buffer == null) {		// Signal is off
			dataLine.flush();
			return -1; 
		} 
		// Drop samples that don't fit the input buffer available capacity 
		int ava = inputBuffer.remaining();
		if (ava > quant)
			ava = quant;