Code example for SourceDataLine

Methods: open

0
info = new DataLine.Info(SourceDataLine.class, audioFormat);
		if (AudioSystem.isLineSupported(info)) {
			try { 
				line = (SourceDataLine) AudioSystem.getLine(info);
				line.open(audioFormat);
			} catch (LineUnavailableException e) {
				e.printStackTrace();
				System.exit(1);
			} catch (Exception e) {
				e.printStackTrace();
				System.exit(1);
			} 
		} else { 
			System.out
					.println("Format of the file is incorrect (only 8 or 16 bits per sample are supported).");
		} 
	} 
 
	public static void audio_play() {