本文整理了Java中javax.sound.sampled.Mixer.getTargetLineInfo()
方法的一些代码示例,展示了Mixer.getTargetLineInfo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mixer.getTargetLineInfo()
方法的具体详情如下:
包路径:javax.sound.sampled.Mixer
类名称:Mixer
方法名:getTargetLineInfo
暂无
代码示例来源:origin: stackoverflow.com
Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
for (Mixer.Info info: mixerInfos){
Mixer m = AudioSystem.getMixer(info);
Line.Info[] lineInfos = m.getSourceLineInfo();
for (Line.Info lineInfo:lineInfos){
System.out.println (info.getName()+"---"+lineInfo);
Line line = m.getLine(lineInfo);
System.out.println("\t-----"+line);
}
lineInfos = m.getTargetLineInfo();
for (Line.Info lineInfo:lineInfos){
System.out.println (m+"---"+lineInfo);
Line line = m.getLine(lineInfo);
System.out.println("\t-----"+line);
}
}
代码示例来源:origin: cmusphinx/sphinx4
private static void dumpMixers() {
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
for (int i = 0; i < mixerInfo.length; i++) {
Mixer mixer = AudioSystem.getMixer(mixerInfo[i]);
System.out.println("Mixer[" + i + "]: \""
+ mixerInfo[i].getName() + '\"');
System.out.println(" Description: "
+ mixerInfo[i].getDescription());
System.out.println(" SourceLineInfo (e.g., speakers):");
dumpLineInfo(" ", mixer.getSourceLineInfo());
System.out.println(" TargetLineInfo (e.g., microphones):");
dumpLineInfo(" ", mixer.getTargetLineInfo());
}
}
代码示例来源:origin: marytts/marytts
Mixer mixer = AudioSystem.getMixer(mixerInfos[i]);
boolean hasTargetLine = false;
Line.Info[] lines = mixer.getTargetLineInfo();
for (int j = 0; j < lines.length; j++) {
if (lines[j] instanceof DataLine.Info) {
代码示例来源:origin: stackoverflow.com
mixer.getSourceLineInfo(),
"Target",
mixer.getTargetLineInfo() );
columnNames = new String[]{ "Input/Output", "Line Info" };
md = new MediaData(mixerInfo[ii].getName(), columnNames, data);
Line.Info[] target = mixer.getTargetLineInfo();
Line[] all = new Line[source.length + target.length];
try {
代码示例来源:origin: marytts/marytts
private static void listTargetDataLines() {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
// mixer.open();
Line.Info[] lines = mixer.getTargetLineInfo();
out(aInfos[i].getName());
for (int j = 0; j < lines.length; j++) {
out(" " + lines[j].toString());
if (lines[j] instanceof DataLine.Info) {
AudioFormat[] formats = ((DataLine.Info) lines[j]).getFormats();
for (int k = 0; k < formats.length; k++) {
out(" " + formats[k].toString());
}
}
}
}
}
代码示例来源:origin: marytts/marytts
private static void listTargetDataLines() {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
// mixer.open();
Line.Info[] lines = mixer.getTargetLineInfo();
out(aInfos[i].getName());
for (int j = 0; j < lines.length; j++) {
out(" " + lines[j].toString());
if (lines[j] instanceof DataLine.Info) {
AudioFormat[] formats = ((DataLine.Info) lines[j]).getFormats();
for (int k = 0; k < formats.length; k++) {
out(" " + formats[k].toString());
}
}
}
}
}
代码示例来源:origin: marytts/marytts
private static void listTargetDataLines() {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
// mixer.open();
Line.Info[] lines = mixer.getTargetLineInfo();
out(aInfos[i].getName());
for (int j = 0; j < lines.length; j++) {
out(" " + lines[j].toString());
if (lines[j] instanceof DataLine.Info) {
AudioFormat[] formats = ((DataLine.Info) lines[j]).getFormats();
for (int k = 0; k < formats.length; k++) {
out(" " + formats[k].toString());
}
}
}
}
}
代码示例来源:origin: marytts/marytts
private static void listTargetDataLines() {
out("Available Mixers:");
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
for (int i = 0; i < aInfos.length; i++) {
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
// mixer.open();
Line.Info[] lines = mixer.getTargetLineInfo();
out(aInfos[i].getName());
for (int j = 0; j < lines.length; j++) {
out(" " + lines[j].toString());
if (lines[j] instanceof DataLine.Info) {
AudioFormat[] formats = ((DataLine.Info) lines[j]).getFormats();
for (int k = 0; k < formats.length; k++) {
out(" " + formats[k].toString());
}
}
}
}
}
代码示例来源:origin: marytts/marytts
Mixer.Info mixerInfo = (Mixer.Info) audioDescriptor;
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineInfos = mixer.getTargetLineInfo();
assert lineInfos.length > 0 : "Strange, there is no more line info for mixer: " + mixer;
Line.Info lineInfo = lineInfos[0];
代码示例来源:origin: cmusphinx/sphinx4
lineInfos = mixer.getTargetLineInfo
(new Line.Info(TargetDataLine.class));
} else {
代码示例来源:origin: stackoverflow.com
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); //get available mixers
System.out.println("Available mixers:");
Mixer mixer = null;
for (int cnt = 0; cnt < mixerInfo.length; cnt++) {
System.out.println(cnt + " " + mixerInfo[cnt].getName());
mixer = AudioSystem.getMixer(mixerInfo[cnt]);
Line.Info[] lineInfos = mixer.getTargetLineInfo();
if (lineInfos.length >= 1 && lineInfos[0].getLineClass().equals(TargetDataLine.class)) {
System.out.println(cnt + " Mic is supported!");
break;
}
}
audioFormat = getAudioFormat(); //get the audio format
DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);
代码示例来源:origin: stackoverflow.com
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
List<Line.Info> availableLines = new ArrayList<Line.Info>();
for (Mixer.Info mixerInfo : mixers){
System.out.println("Found Mixer: " + mixerInfo);
Mixer m = AudioSystem.getMixer(mixerInfo);
Line.Info[] lines = m.getTargetLineInfo();
for (Line.Info li : lines){
System.out.println("Found target line: " + li);
try {
m.open();
availableLines.add(li);
} catch (LineUnavailableException e){
System.out.println("Line unavailable.");
}
}
}
System.out.println("Available lines: " + availableLines);
代码示例来源:origin: IanWraith/DMRDecode
private ArrayList<AudioMixer> getCompatibleDevices(){
devices=new ArrayList<AudioMixer>();
//list the available mixers
Mixer.Info mixers[]=AudioSystem.getMixerInfo();
int i;
//iterate the mixers and display TargetLines
for (i=0;i<mixers.length;i++){
Mixer m = AudioSystem.getMixer(mixers[i]);
Line.Info l[]=m.getTargetLineInfo();
if(l.length>0){
int x;
for (x=0;x<l.length;x++){
if (l[0].getLineClass().getName().equals("javax.sound.sampled.TargetDataLine")){
AudioMixer mc=new AudioMixer(this.theApp,mixers[i].getName(),m,l[x]);
devices.add(mc);
}
}
}
}
return devices;
}
代码示例来源:origin: stackoverflow.com
Line.Info [] lineInfos = mixer.getTargetLineInfo(); // target, not source
for (Line.Info lineInfo : lineInfos)
代码示例来源:origin: de.sciss/sphinx4-core
private static void dumpMixers() {
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
for (int i = 0; i < mixerInfo.length; i++) {
Mixer mixer = AudioSystem.getMixer(mixerInfo[i]);
System.out.println("Mixer[" + i + "]: \""
+ mixerInfo[i].getName() + '\"');
System.out.println(" Description: "
+ mixerInfo[i].getDescription());
System.out.println(" SourceLineInfo (e.g., speakers):");
dumpLineInfo(" ", mixer.getSourceLineInfo());
System.out.println(" TargetLineInfo (e.g., microphones):");
dumpLineInfo(" ", mixer.getTargetLineInfo());
}
}
代码示例来源:origin: stackoverflow.com
int duration = 5; // sample for 5 seconds
TargetDataLine line = null;
// find a DataLine that can be read
// (maybe hardcode this if you have multiple microphones)
Info[] mixerInfo = AudioSystem.getMixerInfo();
for (int i = 0; i < mixerInfo.length; i++) {
Mixer mixer = AudioSystem.getMixer(mixerInfo[i]);
Line.Info[] targetLineInfo = mixer.getTargetLineInfo();
if (targetLineInfo.length > 0) {
line = (TargetDataLine) mixer.getLine(targetLineInfo[0]);
break;
}
}
if (line == null)
throw new UnsupportedOperationException("No recording device found");
AudioFormat af = new AudioFormat(11000, 8, 1, true, false);
line.open(af);
line.start();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[(int)af.getSampleRate() * af.getFrameSize()];
long end = System.currentTimeMillis() + 1000 * duration;
int len;
while (System.currentTimeMillis() < end && ((len = line.read(buf, 0, buf.length)) != -1)) {
baos.write(buf, 0, len);
}
line.stop();
line.close();
baos.close();
代码示例来源:origin: stackoverflow.com
showLineInfo(info);
Line.Info [] targetLineInfo = mixer.getTargetLineInfo();
for (Line.Info info : targetLineInfo)
showLineInfo(info);
代码示例来源:origin: stackoverflow.com
System.out.println("Mixer Name:"+mixerInfo.getName());
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineinfos = mixer.getTargetLineInfo();
for(Line.Info lineinfo : lineinfos){
System.out.println("line:" + lineinfo);
代码示例来源:origin: stackoverflow.com
Line.Info [] targetLineInfo = mixer.getTargetLineInfo();
for (Line.Info info : targetLineInfo)
代码示例来源:origin: de.sciss/sphinx4-core
lineInfos = mixer.getTargetLineInfo
(new Line.Info(TargetDataLine.class));
} else {
内容来源于网络,如有侵权,请联系作者删除!