Exemplo n.º 1
0
  private static Mixer getMixer(String propVal, Line.Info info, List<?> mixerProviders) {

    int index = propVal.indexOf("#"); // $NON-NLS-1$
    String className;
    String mixName;
    if (index == -1) {
      className = propVal.trim();
      mixName = ""; // $NON-NLS-1$
    } else {
      className = propVal.substring(0, index).trim();
      if (index == propVal.length()) {
        mixName = ""; // $NON-NLS-1$
      } else {
        mixName = propVal.substring(index + 1).trim();
      }
    }
    Mixer.Info[] minfos = null;
    if (!className.equals("")) { // $NON-NLS-1$
      for (Iterator providers = mixerProviders.iterator(); providers.hasNext(); ) {
        try {
          MixerProvider pr = (MixerProvider) (providers.next());
          if (className.equals(pr.getClass().getName())) {
            minfos = pr.getMixerInfo();
            break;
          }
        } catch (ClassCastException e) {
        }
      }
    }
    if (minfos == null) {
      minfos = getMixerInfo();
    }

    if (!mixName.equals("")) { // $NON-NLS-1$
      for (Mixer.Info minfo : minfos) {
        if (mixName.equals(minfo.getName())) {
          return getMixer(minfo);
        }
      }
    }
    if (minfos.length > 0) {
      return getMixer(minfos[0]);
    }
    return null;
  }
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      Component component =
          super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      Mixer.Info mi = (Mixer.Info) value;

      if (mi != null) {
        String text = mi.getName();

        if (!"Unknown Version".equals(mi.getVersion())) {
          text += ' ' + mi.getVersion();
        }
        if (!"Unknown Vendor".equals(mi.getVendor())) {
          text += " by " + mi.getVendor();
        }
        setText(text);
      }
      return component;
    }
Exemplo n.º 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;
  }