Beispiel #1
0
 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  : ");
     }
   }
 }
  public Mixer getMixer(Mixer.Info info) {
    // if the default device is asked, we provide the mixer
    // with SourceDataLine's
    if (info == null) {
      for (int i = 0; i < infos.length; i++) {
        Mixer mixer = getDevice(infos[i]);
        if (mixer.getSourceLineInfo().length > 0) {
          return mixer;
        }
      }
    }
    // otherwise get the first mixer that matches
    // the requested info object
    for (int i = 0; i < infos.length; i++) {
      if (infos[i].equals(info)) {
        return getDevice(infos[i]);
      }
    }

    throw new IllegalArgumentException(
        "Mixer " + info.toString() + " not supported by this provider.");
  }
Beispiel #3
0
  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;
  }