本文整理了Java中javax.sound.sampled.Mixer.isLineSupported()
方法的一些代码示例,展示了Mixer.isLineSupported()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mixer.isLineSupported()
方法的具体详情如下:
包路径:javax.sound.sampled.Mixer
类名称:Mixer
方法名:isLineSupported
暂无
代码示例来源:origin: marytts/marytts
/**
* List Mixers. Only Mixers that support either TargetDataLines or SourceDataLines are listed, depending on the value of
* bPlayback.
*
* @param bPlayback
* bPlayback
*/
public static void listMixersAndExit(boolean bPlayback) {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
Line.Info lineInfo = new Line.Info(bPlayback ? SourceDataLine.class : TargetDataLine.class);
if (mixer.isLineSupported(lineInfo)) {
out(aInfos[i].getName());
}
}
if (aInfos.length == 0) {
out("[No mixers available]");
}
System.exit(0);
}
代码示例来源:origin: marytts/marytts
/**
* List Mixers. Only Mixers that support either TargetDataLines or SourceDataLines are listed, depending on the value of
* bPlayback.
*
* @param bPlayback
* bPlayback
*/
public static void listMixersAndExit(boolean bPlayback) {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
Line.Info lineInfo = new Line.Info(bPlayback ? SourceDataLine.class : TargetDataLine.class);
if (mixer.isLineSupported(lineInfo)) {
out(aInfos[i].getName());
}
}
if (aInfos.length == 0) {
out("[No mixers available]");
}
System.exit(0);
}
代码示例来源:origin: marytts/marytts
/**
* List Mixers. Only Mixers that support either TargetDataLines or SourceDataLines are listed, depending on the value of
* bPlayback.
*
* @param bPlayback
* bPlayback
*/
public static void listMixersAndExit(boolean bPlayback) {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
Line.Info lineInfo = new Line.Info(bPlayback ? SourceDataLine.class : TargetDataLine.class);
if (mixer.isLineSupported(lineInfo)) {
out(aInfos[i].getName());
}
}
if (aInfos.length == 0) {
out("[No mixers available]");
}
System.exit(0);
}
代码示例来源:origin: marytts/marytts
/**
* List Mixers. Only Mixers that support either TargetDataLines or SourceDataLines are listed, depending on the value of
* bPlayback.
*
* @param bPlayback
* bPlayback
*/
public static void listMixersAndExit(boolean bPlayback) {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
Line.Info lineInfo = new Line.Info(bPlayback ? SourceDataLine.class : TargetDataLine.class);
if (mixer.isLineSupported(lineInfo)) {
out(aInfos[i].getName());
}
}
if (aInfos.length == 0) {
out("[No mixers available]");
}
System.exit(0);
}
代码示例来源:origin: crsmoro/scplayer
@Override
public void setMixer(Mixer.Info mixer) {
if (!AudioSystem.getMixer(mixer).isLineSupported(AudioListener.DATALINE)) {
throw new IllegalArgumentException("Mixer does not support PCM");
}
this.mixer = mixer;
}
代码示例来源:origin: stackoverflow.com
// Param for playback (input) device.
Line.Info playbackLine = new Line.Info(SourceDataLine.class);
// Param for capture (output) device.
Line.Info captureLine = new Line.Info(TargetDataLine.class);
private List<Mixer.Info> filterDevices(final Line.Info supportedLine) {
List<Mixer.Info> result = Lists.newArrayList();
ArrayList<Mixer.Info> infos = Lists.newArrayList(AudioSystem.getMixerInfo());
for (Mixer.Info info : infos) {
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(supportedLine)) {
result.add(info);
}
}
return result;
}
代码示例来源:origin: net.sf.phat/phat-audio
private SourceDataLine getSourceDataLine(DataLine.Info dataLineInfo) {
SourceDataLine sdl = null;
for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
Mixer m = AudioSystem.getMixer(mi);
if (m.isLineSupported(dataLineInfo)) {
try {
Line line = m.getLine(dataLineInfo);
if (line instanceof SourceDataLine) {
Logger.getLogger(
PCSpeaker.class.getName()).log(Level.INFO, "Mixer={0}", m.getMixerInfo().getName());
sdl = (SourceDataLine) line;
break;
}
} catch (LineUnavailableException ex) {
Logger.getLogger(PCSpeaker.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
return sdl;
}
代码示例来源:origin: stackoverflow.com
public class VolumeSlider{
// to get the aydiosystem gain control
public void setGain(float ctrl)
{
try {
Mixer.Info[] infos = AudioSystem.getMixerInfo();
for (Mixer.Info info: infos)
{
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(Port.Info.SPEAKER))
{
Port port = (Port)mixer.getLine(Port.Info.SPEAKER);
port.open();
if (port.isControlSupported(FloatControl.Type.VOLUME))
{
FloatControl volume = (FloatControl)port.getControl(FloatControl.Type.VOLUME);
volume.setValue(ctrl);
}
port.close();
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"Erro\n"+e);
}
}
代码示例来源:origin: com.pippsford/SecurePRNG-core
public static void main(String[] args) {
// A recordable line is a target data line
Line.Info targetDataType = new Line.Info(TargetDataLine.class);
// Get available mixers
Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
for (Mixer.Info mi : mixerInfos) {
// May throw SecurityException
Mixer mixer = AudioSystem.getMixer(mi);
// No use if cannot record from it
if (!mixer.isLineSupported(targetDataType)) {
continue;
}
System.out.println("\nname= " + mi.getName());
System.out.println("desc= " + mi.getDescription());
System.out.println("vers= " + mi.getVersion());
System.out.println("vend= " + mi.getVendor());
}
}
代码示例来源:origin: com.pippsford/SecurePRNG-core
/**
* Get all available sources from which we may collect entropy
*
* @return audio sources
*/
protected static List<AudioSource> getSources() {
List<AudioSource> list = new ArrayList<>();
// A recordable line is a target data line
Line.Info targetDataType = new Line.Info(TargetDataLine.class);
// The source will be from some mixer, so loop over all of them.
// Get available mixers
Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
for (Mixer.Info mi : mixerInfos) {
// May throw SecurityException
Mixer mixer = AudioSystem.getMixer(mi);
// No use if cannot record from it
if (!mixer.isLineSupported(targetDataType)) {
continue;
}
getSources(list, mixer);
}
return list;
}
代码示例来源:origin: stackoverflow.com
targetMixer.open();
if (targetMixer.isLineSupported(targetDataLineInfo)) {
System.out.println(mixerInfo.getName() + " supports recording @" + af);
Mixer portMixer = AudioSystem.getMixer(mifo);
portMixer.open();
portMixer.isLineSupported((Line.Info) myInputType);
if (portMixer.isLineSupported((Line.Info) myInputType)) {
代码示例来源:origin: com.github.stephenc.monte/monte-screen-recorder
private static Vector<AudioSourceItem> getAudioSources() {
Vector<AudioSourceItem> l = new Vector<AudioSourceItem>();
l.add(new AudioSourceItem("None", null, false));
l.add(new AudioSourceItem("Default Input", null, true));
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
DataLine.Info lineInfo = new DataLine.Info(
TargetDataLine.class,
new javax.sound.sampled.AudioFormat(
44100.0f,
16,
2,
true,
true));
for (Mixer.Info info : mixers) {
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(lineInfo)) {
l.add(new AudioSourceItem(info.getName(), info));
}
}
return l;
}
代码示例来源:origin: ru.sbtqa/monte-media
private static Vector<AudioSourceItem> getAudioSources() {
Vector<AudioSourceItem> l = new Vector<AudioSourceItem>();
l.add(new AudioSourceItem("None", null, false));
l.add(new AudioSourceItem("Default Input", null, true));
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
DataLine.Info lineInfo = new DataLine.Info(
TargetDataLine.class,
new javax.sound.sampled.AudioFormat(
44100.0f,
16,
2,
true,
true));
for (Mixer.Info info : mixers) {
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(lineInfo)) {
l.add(new AudioSourceItem(info.getName(), info));
}
}
return l;
}
代码示例来源:origin: com.github.stephenc.monte/monte-screen-recorder
private static Vector<AudioSourceItem> getAudioSources() {
Vector<AudioSourceItem> l = new Vector<AudioSourceItem>();
l.add(new AudioSourceItem("None", null, false));
l.add(new AudioSourceItem("Default Input", null, true));
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
DataLine.Info lineInfo = new DataLine.Info(
TargetDataLine.class,
new javax.sound.sampled.AudioFormat(
44100.0f,
16,
2,
true,
true));
for (Mixer.Info info : mixers) {
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(lineInfo)) {
l.add(new AudioSourceItem(info.getName(), info));
}
}
return l;
}
代码示例来源:origin: ru.sbtqa/monte-media
private static Vector<AudioSourceItem> getAudioSources() {
Vector<AudioSourceItem> l = new Vector<AudioSourceItem>();
l.add(new AudioSourceItem("None", null, false));
l.add(new AudioSourceItem("Default Input", null, true));
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
DataLine.Info lineInfo = new DataLine.Info(
TargetDataLine.class,
new javax.sound.sampled.AudioFormat(
44100.0f,
16,
2,
true,
true));
for (Mixer.Info info : mixers) {
Mixer mixer = AudioSystem.getMixer(info);
if (mixer.isLineSupported(lineInfo)) {
l.add(new AudioSourceItem(info.getName(), info));
}
}
return l;
}
代码示例来源:origin: crsmoro/scplayer
System.out.println(i + " - " + mixerInfo.getName() + " - " + mixerInfo.getDescription() + " - "
+ mixerInfo.getVersion()
+ (AudioSystem.getMixer(mixerInfo).isLineSupported(AudioListener.DATALINE)
? " - Support PCM Audio" : ""));
代码示例来源:origin: tulskiy/musique
DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt, BUFFER_SIZE);
logger.fine("Dataline info: " + info);
if (mixer != null && mixer.isLineSupported(info)) {
line = (SourceDataLine) mixer.getLine(info);
logger.fine("Mixer: " + mixer.getMixerInfo().getDescription());
代码示例来源:origin: stackoverflow.com
targetMixer.open();
if (targetMixer.isLineSupported(targetDataLineInfo)) {
System.out.println(mixerInfo.getName() + " supports recording @ " + af);
portMixer.open();
boolean lineTypeSupported = portMixer.isLineSupported((Line.Info) myInputType);
System.out.println(portMixerInfo.getName() +" does " + (lineTypeSupported? "" : "NOT") + " support " + myInputType.getName());
if (lineTypeSupported) {
代码示例来源:origin: com.pippsford/SecurePRNG-core
DataLine.Info targetInfo = new DataLine.Info(
TargetDataLine.class, test, buffSize);
if (mixer.isLineSupported(targetInfo)) {
list.add(new AudioSource(mixer, targetInfo,
buffSize));
内容来源于网络,如有侵权,请联系作者删除!