Java 8 LineUnavailableException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LineUnavailableException class.

This code example shows how to use the following methods:printStackTrace
			targetDataLine.open(audioFormat);
		} 
		catch (LineUnavailableException e)
		{ 
			out("unable to get a recording line"); 
			e.printStackTrace();
			System.exit(1);
		} 
 
		/* Again for simplicity, we've hardcoded the audio file 
		   type, too. 
		*/ 
		AudioFileFormat.Type	targetType = AudioFileFormat.Type.WAVE;
 
		/* Now, we are creating an SimpleAudioRecorder object. It 
		   contains the logic of starting and stopping the 
		   recording, reading audio data from the TargetDataLine 
		   and writing the data to a file. 
		*/ 
		SimpleAudioRecorder	recorder = new SimpleAudioRecorder(
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
			targetDataLine.open(audioFormat);
		} 
		catch (LineUnavailableException e)
		{ 
			out("unable to get a recording line"); 
			e.printStackTrace();
			System.exit(1);
		} 
 
		/* Again for simplicity, we've hardcoded the audio file 
		   type, too. 
		*/ 
		AudioFileFormat.Type	targetType = AudioFileFormat.Type.WAVE;
 
		/* Now, we are creating an SimpleAudioRecorder object. It 
		   contains the logic of starting and stopping the 
		   recording, reading audio data from the TargetDataLine 
		   and writing the data to a file. 
		*/ 
		SimpleAudioRecorder	recorder = new SimpleAudioRecorder(
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
    	try { 
    		targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
    		targetDataLine.open(audioFormat);
    	} catch (LineUnavailableException e) {
    		System.err.println("unable to get a recording line");
    		e.printStackTrace();
    		//System.exit(1); 
    	} 
 
    	/* 
    	 * Again for simplicity, we've hardcoded the audio file type, too. 
    	 */ 
    	AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE;
 
        AudioRecorder.BufferingRecorder recorder = new AudioRecorder.BufferingRecorder(targetDataLine, targetType, targetFile, (int) millis);
 
    	/* 
    	 * Here, the recording is actually started. 
    	 */ 
    	recorder.start();
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
		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() { 
		int increment = ((nBytesRead % 4) == 0) ? 0 : 4 - (nBytesRead % 4);
		for (int i = 0; i < increment; i++) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
	{ 
		try { 
			line=AudioSystem.getTargetDataLine(
					new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,SAMPLE_RATE,16,1,2,SAMPLE_RATE,false));
		} catch (LineUnavailableException e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} 
	} 
 
	/** 
	 * Create a new AudioProcessor around the line in device. 
	 * @param fftNumBins Number of FFT bins to provide 
	 * @param fftMaxFreq Maximum audio frequency (in Hz) to return through FFT 
	 * @param fftBinLog Scale the FFT bins to equal width in log frequency.  Otherwise, FFT bins 
	 * will be equal width in frequency. 
	 * @param fftScaleDecay The exponential rate (ratio per frame) that the peak FFT amplitude is  
	 * reduced.  This should be a number between 0 and 1. 
	 * @param freqScalePower The exponential rate to reduce effective amplitude versus frequency.   
	 * Amplitude is multipled by (freq^^freqScalePower).  Typically this is used to represent the 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:printStackTrace
		input = (TargetDataLine) line;
		if (input != null) {
			try { 
				input.open(new AudioFormat(8000.0f, 16, 1, true, true));
			} catch (LineUnavailableException e) {
				e.printStackTrace();
			} 
		} 
	} 
 
	public void setOutput(Line line)
	{ 
		output = (SourceDataLine) line;
		if (output != null) {
			try { 
				output.open(new AudioFormat(8000.0f, 16, 1, true, true));
			} catch (LineUnavailableException e) {
				e.printStackTrace();
			} 
		} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
	public Line getDataLineForMixer(){
		TargetDataLine line = null;
		try { 
			line = (TargetDataLine) this.mixer.getLine(getDataLineInfo());
		} catch (LineUnavailableException e) {
			System.out.println("Error getting mix line:" + e.getMessage());
		} 
		 
		return line;
	} 
	 
	/** 
	 * Open the current line 
	 */ 
	public void openLine(){ 
		try { 
			this.line.open(format);
		} catch (LineUnavailableException e) {
			System.out.println("Unable to open line:" + e.getMessage());
		} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * have been found for the specified format.  
	 */ 
	private SourceDataLine getSourceDataLine(AudioFormat format) throws LineUnavailableException {
		DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
		if(!AudioSystem.isLineSupported(info)) {
			throw new LineUnavailableException ("Unable to find the Java 2 audio channel");
		} 
		return (SourceDataLine)AudioSystem.getLine(info);
	} 
	 
	/** 
	 * Starts the playback of the audio stream.  
	 */ 
	public void play() { 
		playing = true;
		if(sourceDataLine != null) {
			sourceDataLine.start();
		} 
		synchronized(this) {
			notifyAll();
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
	    this.setMixer(mx);
		DataLine.Info info = getDataLineInfo();	
		try	{ 
			this.line = (TargetDataLine) AudioSystem.getLine(info);
		}catch(LineUnavailableException ex){
			String err="setDefaultLine() : "+ex.getMessage();
			audioDebugDump(err);
		} 
	} 
	 
	 
	/** 
	 * Get the DataLine.info object for the TargetDataLine  
	 * @return 
	 */ 
	private DataLine.Info getDataLineInfo(){
		DataLine.Info info = new DataLine.Info(TargetDataLine.class, this.format); // format is an AudioFormat object
		if (!AudioSystem.isLineSupported(info)) {
			// Record the error 
			audioDebugDump("getDataLineInfo() : Error"); 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 LineUnavailableException Methods: