Code example for SourceDataLine

Methods: startopen

0
		audioFormat = audioInputStream.getFormat();
		info = new DataLine.Info(SourceDataLine.class,
								 audioFormat);
		try{ 
			line = (SourceDataLine)AudioSystem.getLine(info);
			line.open(audioFormat);
		}catch (LineUnavailableException ex){
			//System.out.println("*** Audio line unavailable ***"); 
			//System.exit(1); 
		} 
 
		line.start();
 
		audioBytes = new byte[(int)soundFile.length()];
 
		try{ 
			numBytes = audioInputStream.read(audioBytes, 0, audioBytes.length);
		}catch (IOException ex){
			//System.out.println("*** Cannot read " + fileName + " ***"); 
			//System.exit(1); 
Experience pair programming with AI  Get Codota for Java