private Line.Info[] getPortInfo(Mixer mixer) { Line.Info[] infos; List<Line.Info> portInfoList = new ArrayList<>(); infos = mixer.getSourceLineInfo(); for (Line.Info info : infos) { if (info instanceof Port.Info || info instanceof DataLine.Info) { portInfoList.add(info); } } infos = mixer.getTargetLineInfo(); for (Line.Info info1 : infos) { if (info1 instanceof Port.Info || info1 instanceof DataLine.Info) { portInfoList.add(info1); } } return portInfoList.toArray(EMPTY_PORT_INFO_ARRAY); }
private boolean arePortsSupported(Mixer mixer) { Line.Info[] infos; infos = mixer.getSourceLineInfo(); for (Line.Info info : infos) { if (info instanceof Port.Info) { return true; } else if (info instanceof DataLine.Info) { return true; } } infos = mixer.getTargetLineInfo(); for (Line.Info info : infos) { if (info instanceof Port.Info) { return true; } else if (info instanceof DataLine.Info) { return true; } } return false; }
private static void d1() { Mixer.Info[] fmi = AudioSystem.getMixerInfo(); for (Mixer.Info mi : fmi) { Mixer mixer = AudioSystem.getMixer(mi); Line.Info[] isl = mixer.getSourceLineInfo(); Line.Info[] itl = mixer.getTargetLineInfo(); // if( itl.length > 0) { error.log("--------------------------------------------------------------"); error.log("Src Count " + isl.length + " Target size " + itl.length); error.log(mi.toString()); error.log("Name " + mi.getName()); error.log("Version " + mi.getVersion()); error.log("Vendor " + mi.getVendor()); error.log("Description " + mi.getDescription()); error.log("~~~"); dumpLines(isl, " >> SourceLine : "); dumpLines(itl, " >> TargetLine : "); } } }
private static Mixer.Info[] getAvailableMixers(boolean isTarget) { ArrayList<Mixer.Info> mixers = new ArrayList<Mixer.Info>(Arrays.asList((Mixer.Info[]) AudioSystem.getMixerInfo())); for (Iterator<Mixer.Info> it = mixers.iterator(); it.hasNext(); ) { Mixer.Info minfo = it.next(); Mixer mixer = AudioSystem.getMixer(minfo); Line.Info[] linfo = (isTarget) ? mixer.getTargetLineInfo() : mixer.getSourceLineInfo(); boolean hasDataLine = false; for (int j = 0; j < linfo.length; j++) { if (linfo[j] instanceof DataLine.Info) { hasDataLine = true; break; } } if (!hasDataLine) { it.remove(); } } return mixers.toArray(new Mixer.Info[mixers.size()]); }
public String toString() { Mixer.Info info = mixer.getMixerInfo(); String s = "\nMixer [" + id + "]"; s += "\n\t Name: " + info.getName(); s += "\n\t Desc: " + info.getDescription(); s += "\n\t Ven : " + info.getVendor(); s += "\n\t Ver : " + info.getVersion(); s += "\n\t Str : " + info.toString(); Line.Info[] infos = mixer.getSourceLineInfo(); s += "\n\nSourceLine count : " + infos.length; for (int i = 0; i < infos.length; i++) { if (infos[i] instanceof DataLine.Info) { s += "\n\t\tData Line Source [" + i + "]"; s += "\n\t\t\t Str : " + infos[i].toString(); } else if (infos[i] instanceof Port.Info) { s += "\n\t\tPort Source [" + i + "]"; s += "\n\t\t\t Name: " + ((Port.Info) infos[i]).getName(); s += "\n\t\t\t is Src: " + ((Port.Info) infos[i]).isSource(); s += "\n\t\t\t Str : " + infos[i].toString(); } else /*if(infos[i]!=null)*/ { s += "\n\t\tSource [" + i + "]"; s += "\n\t\t\t Str : " + infos[i].toString(); } } s += "\n\nOUTPUT\n"; for (int i = 0; i < formats.length; i++) { try { SourceDataLine out = getOutputLine(formats[i]); out.close(); s += "\n" + formats[i].toString(); } catch (Exception e) { // s+="\n"+e.getMessage(); } } infos = mixer.getTargetLineInfo(); s += "\n\nTargetLine count : " + infos.length; for (int i = 0; i < infos.length; i++) { if (infos[i] instanceof DataLine.Info) { s += "\n\t\tData Line Target [" + i + "]"; s += "\n\t\t\t Str : " + infos[i].toString(); } else if (infos[i] instanceof Port.Info) { s += "\n\t\tPort Target [" + i + "]"; s += "\n\t\t\t Name: " + ((Port.Info) infos[i]).getName(); s += "\n\t\t\t is Src: " + ((Port.Info) infos[i]).isSource(); s += "\n\t\t\t Str : " + infos[i].toString(); } else /*if(infos[i]!=null)*/ { s += "\n\t\tTarget [" + i + "]"; s += "\n\t\t\t Str : " + infos[i].toString(); } } s += "\n\nINPUT\n"; for (int i = 0; i < formats.length; i++) { try { TargetDataLine out = getInputLine(formats[i]); out.close(); s += "\n" + formats[i].toString(); } catch (Exception e) { // s+="\n"+e.getMessage(); } } return s; }