javax.sound.sampled.Mixer.Info Java Examples

The following examples show how to use javax.sound.sampled.Mixer.Info. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoftMixingMixerProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #2
Source File: SoftMixingMixerProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #3
Source File: SoftMixingMixerProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #4
Source File: SoftMixingMixerProvider.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #5
Source File: SoftMixingMixerProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #6
Source File: SoftMixingMixerProvider.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #7
Source File: SoftMixingMixerProvider.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #8
Source File: SoftMixingMixerProvider.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #9
Source File: SoundMixer.java    From jace with GNU General Public License v2.0 6 votes vote down vote up
private void initMixer() {
        Info selected;
        Info[] mixerInfo = AudioSystem.getMixerInfo();

        if (mixerInfo == null || mixerInfo.length == 0) {
            theMixer = null;
            lineAvailable = false;
            System.out.println("No sound mixer is available!");
            return;
        }

        String mixer = preferredMixer.getValue();
        selected = mixerInfo[0];
        for (Info i : mixerInfo) {
            if (i.getName().equalsIgnoreCase(mixer)) {
                selected = i;
                break;
            }
        }
        theMixer = AudioSystem.getMixer(selected);
//        for (Line l : theMixer.getSourceLines()) {
//            l.close();
//        }
        lineAvailable = true;
    }
 
Example #10
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 6 votes vote down vote up
protected void firstFrame() {
		// load assets
		audioSample = FileUtil.fileFromPath(FileUtil.getPath("audio/kit808/snare.wav"));
		
		// store audio lines
		linesOut = new ArrayList<Line.Info>();
		mixers = new ArrayList<Mixer>();
		
		// beads
//		audioContext = new AudioContext();
//		audioContext.postAudioFormatInfo();
//		P.out("audioContext.out.getOuts()", audioContext.out.getOuts());
//		audioContext.start();

		printAllMixerNames();
		P.out("=============");
		getDeviceInfos("");
	}
 
Example #11
Source File: SoftMixingMixerProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }
}
 
Example #12
Source File: SoftMixingMixerProvider.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }
}
 
Example #13
Source File: SoftMixingMixerProvider.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #14
Source File: SoftMixingMixerProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #15
Source File: SoftMixingMixerProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #16
Source File: SoftMixingMixerProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Mixer getMixer(Info info) {
    if (!(info == null || info == SoftMixingMixer.info)) {
        throw new IllegalArgumentException("Mixer " + info.toString()
                + " not supported by this provider.");
    }
    synchronized (mutex) {
        if (lockthread != null)
            if (Thread.currentThread() == lockthread)
                throw new IllegalArgumentException("Mixer "
                        + info.toString()
                        + " not supported by this provider.");
        if (globalmixer == null)
            globalmixer = new SoftMixingMixer();
        return globalmixer;
    }

}
 
Example #17
Source File: BasicPlayer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public Mixer getMixer(final String name) {
	Mixer mixer = null;
	if (name != null) {
		final Mixer.Info[] mInfos = AudioSystem.getMixerInfo();
		if (mInfos != null) {
			for (final Info mInfo : mInfos) {
				if (mInfo.getName().equals(name)) {
					mixer = AudioSystem.getMixer(mInfo);
					break;
				}
			}
		}
	}
	return mixer;
}
 
Example #18
Source File: TGMixerProvider.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Mixer getMixer(Info info) {
	if( TGMixer.MIXER_INFO.equals(info) ) {
		return new TGMixer();
	}
	return null;
}
 
Example #19
Source File: BasicPlayer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public List<String> getMixers() {
	final ArrayList<String> mixers = new ArrayList<>();
	final Mixer.Info[] mInfos = AudioSystem.getMixerInfo();
	if (mInfos != null) {
		for (final Info mInfo : mInfos) {
			final Line.Info lineInfo = new Line.Info(SourceDataLine.class);
			final Mixer mixer = AudioSystem.getMixer(mInfo);
			if (mixer.isLineSupported(lineInfo)) {
				mixers.add(mInfo.getName());
			}
		}
	}
	return mixers;
}
 
Example #20
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 5 votes vote down vote up
protected Clip clipFromLine() {
	try {
		// did this even work??
		int lineIndex = UI.valueInt(LINE_INDEX);
		lineIndex = P.constrain(lineIndex, 0, linesOut.size() - 1);
		Line.Info lineInfo = linesOut.get(lineIndex);
    	Line line = AudioSystem.getLine(lineInfo);
        Clip clip = (Clip)line;

		return clip;
	} catch (LineUnavailableException e) {
		e.printStackTrace();
		return null;
	}
}
 
Example #21
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 5 votes vote down vote up
protected Clip clipFromDefault() {
	try {
    	Line.Info lineInfo = new Line.Info(Clip.class);
    	Line line = AudioSystem.getLine(lineInfo);
        Clip clip = (Clip)line;
		return clip;
	} catch (LineUnavailableException e) {
		e.printStackTrace();
		return null;
	}
}
 
Example #22
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 5 votes vote down vote up
protected void printAllMixerNames() {
    for(Mixer.Info info : AudioSystem.getMixerInfo()) {
        P.out(info.getName(), " - ", info.getDescription());
		Mixer m = AudioSystem.getMixer(info);
		mixers.add(m);
		UI.addButton(info.getName(), false);
    }
}
 
Example #23
Source File: SoundMixer.java    From jace with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LinkedHashMap<? extends String, String> getSelections() {
    Info[] mixerInfo = AudioSystem.getMixerInfo();
    LinkedHashMap<String, String> out = new LinkedHashMap<>();
    for (Info i : mixerInfo) {
        out.put(i.getName(), i.getName());
    }
    return out;
}
 
Example #24
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 5 votes vote down vote up
protected void buildLinesFromCurMixer() {
	Line.Info[] sourceInfos = curMixer().getSourceLineInfo();
	for (int s = 0; s < sourceInfos.length; s++) {
		P.out("=========================");
		Line.Info lineInfo = sourceInfos[s];
		linesOut.add(lineInfo);
		P.out("    info: " + lineInfo);
		try {
			Line line = AudioSystem.getLine(lineInfo);
			if (line instanceof SourceDataLine) {
				Arrays.asList(((DataLine.Info) line.getLineInfo()).getFormats()).forEach(format -> {
					P.out("#######");
					P.out("Channels: " + format.getChannels());
					P.out("Size in Bits: " + format.getSampleSizeInBits());
					P.out("Frame Rate: " + format.getFrameRate());
					P.out("Frame Size: " + format.getFrameSize());
					P.out("Encoding: " + format.getEncoding());
					P.out("Sample Rate: " + format.getSampleRate());

				});
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		P.out("=========================");
	}
}
 
Example #25
Source File: SoftMixingMixerProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Info[] getMixerInfo() {
    return new Info[] { SoftMixingMixer.info };
}
 
Example #26
Source File: SoftMixingMixerProvider.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Info[] getMixerInfo() {
    return new Info[] { SoftMixingMixer.info };
}
 
Example #27
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 4 votes vote down vote up
public void getDeviceInfos(String filter) {
		Info[] infos = AudioSystem.getMixerInfo();
		for (int i = 0; i < infos.length; i++) {
			Info info = infos[i];
			P.out("Mixer Name: " + info.getName());
			P.out("Mixer Description: " + info.getDescription());
			P.out("Mixer Vendor: " + info.getVendor());

			// Mixer m = AudioSystem.getMixer(info);

			// outputs
//			Line.Info[] sourceInfos = m.getSourceLineInfo();
//			for (int s = 0; s < sourceInfos.length; s++) {
//				P.out("=========================");
//				Line.Info lineInfo = sourceInfos[s];
////				linesOut.add(lineInfo);
//				P.out("    info: " + lineInfo);
//				try {
//					Line line = AudioSystem.getLine(lineInfo);
//					if (line instanceof SourceDataLine) {
//						Arrays.asList(((DataLine.Info) line.getLineInfo()).getFormats()).forEach(format -> {
//							P.out("#######");
//							P.out("Channels: " + format.getChannels());
//							P.out("Size in Bits: " + format.getSampleSizeInBits());
//							P.out("Frame Rate: " + format.getFrameRate());
//							P.out("Frame Size: " + format.getFrameSize());
//							P.out("Encoding: " + format.getEncoding());
//							P.out("Sample Rate: " + format.getSampleRate());
//
//						});
//					}
//				} catch (Exception ex) {
//					ex.printStackTrace();
//				}
//				P.out("=========================");
//			}

			// inputs
//			Line.Info[] targetInfos = m.getTargetLineInfo();
//			for (int t = 0; t < targetInfos.length; t++) {
//				P.out("=========================");
//				Line.Info lineInfo = targetInfos[t];
//				linesOut.add(lineInfo);
//				P.out("    info: " + lineInfo);
//				try {
//					Line line = AudioSystem.getLine(lineInfo);
//					if (line instanceof TargetDataLine) {
//						Arrays.asList(((DataLine.Info) line.getLineInfo()).getFormats()).forEach(format -> {
//							P.out("#######");
//							P.out("Channels: " + format.getChannels());
//							P.out("Size in Bits: " + format.getSampleSizeInBits());
//							P.out("Frame Rate: " + format.getFrameRate());
//							P.out("Frame Size: " + format.getFrameSize());
//							P.out("Encoding: " + format.getEncoding());
//							P.out("Sample Rate: " + format.getSampleRate());
//
//						});
//					}
//				} catch (Exception ex) {
//					ex.printStackTrace();
//				}
//				P.out("=========================");
//			}
		}
		
		// add UI to select line out
//		int numLinesOut = linesOut.size();
//		UI.addSlider(LINE_INDEX, 0, 0, numLinesOut - 1, 1, false);
		int numMixers = mixers.size();
		UI.addSlider(MIXER_INDEX, 0, 0, numMixers - 1, 1, false);
	}
 
Example #28
Source File: Demo_MultichannelAudio_NativeMultipleSoundcard.java    From haxademic with MIT License 4 votes vote down vote up
protected Clip clipFromCurMixerLine() {
		try {
			Line.Info[] sourceInfos = curMixer().getSourceLineInfo();
			for (int s = 0; s < sourceInfos.length; s++) {
				P.out("-- sourceInfos", sourceInfos[s]);
			}
			Line.Info lineInfo = sourceInfos[1];
			P.out("*** info: " + lineInfo);
			Line line = AudioSystem.getLine(lineInfo);
//			AudioSystem.get
			DataLine.Info dataLineInfo = ((DataLine.Info) line.getLineInfo());
//			SourceDataLine srcDataLine = AudioSystem.getSourceDataLine(format, curMixer().getMixerInfo());
//			P.out("*** srcDataLine info: " + srcDataLine.getLineInfo());
			Line lineSpecific = null;
			P.out("dataLineInfo.getFormats().length", dataLineInfo.getFormats().length);
			AudioFormat format = dataLineInfo.getFormats()[0];
//			if (line instanceof SourceDataLine) {
//				Arrays.asList(((DataLine.Info) line.getLineInfo()).getFormats()).forEach(format -> {
//					P.out("#######");
					P.out("Channels: " + format.getChannels());
					P.out("Size in Bits: " + format.getSampleSizeInBits());
					P.out("Frame Rate: " + format.getFrameRate());
					P.out("Frame Size: " + format.getFrameSize());
					P.out("Encoding: " + format.getEncoding());
					P.out("Sample Rate: " + format.getSampleRate());

//				});
//			}
			DataLine.Info info = new DataLine.Info(Clip.class, format);
//			SourceDataLine srcDataLine = AudioSystem.getSourceDataLine(format, curMixer().getMixerInfo());
			lineSpecific = curMixer().getLine(info);
//			Line lineSpecific = AudioSystem.getLine(srcDataLine.getLineInfo());
//			Line lineSpecific = curMixer().getLine(srcDataLine.getLineInfo());
			Port.Info infoooo = (Port.Info)lineSpecific.getLineInfo();
			P.out("infoooo", infoooo);

			Clip clip = (Clip)lineSpecific;
			return clip;
		} catch (LineUnavailableException e) {
			e.printStackTrace();
			return null;
		}
	}
 
Example #29
Source File: SoftMixingMixerProvider.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Info[] getMixerInfo() {
    return new Info[] { SoftMixingMixer.info };
}
 
Example #30
Source File: TGMixerProvider.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Info[] getMixerInfo() {
	return new Info[] { TGMixer.MIXER_INFO };
}