Ejemplo n.º 1
0
  private static Line getLine(String propName, Line.Info info) throws LineUnavailableException {

    List<?> mixerProviders = ProviderService.getProviders(mixerProviderPath);

    if (propName != null) {
      String propVal = System.getProperty(propName);
      if (propVal != null) {
        Mixer m = getMixer(propVal, info, mixerProviders);
        if (m != null) {
          Line l = m.getLine(info);
          if (l != null) {
            return l;
          }
        }
      }

      Properties soundProperties = ProviderService.getSoundProperties();
      propVal = soundProperties.getProperty(propName);
      if (propVal != null) {
        Mixer m = getMixer(propVal, info, mixerProviders);
        if (m != null) {
          Line l = m.getLine(info);
          if (l != null) {
            return l;
          }
        }
      }
    }

    for (Iterator providers = ProviderService.getProviders(mixerProviderPath).iterator();
        providers.hasNext(); ) {
      try {
        MixerProvider pr = (MixerProvider) (providers.next());
        Mixer.Info[] mixinfos = pr.getMixerInfo();
        for (Mixer.Info mixinfo : mixinfos) {
          try {
            Mixer mix = pr.getMixer(mixinfo);
            return mix.getLine(info);
          } catch (IllegalArgumentException e) {
            // continue
          }
        }
      } catch (ClassCastException e) {
      }
    }
    // sound.11=Could not get line
    throw new IllegalArgumentException(Messages.getString("sound.11")); // $NON-NLS-1$
  }
Ejemplo n.º 2
0
  public static boolean isLineSupported(Line.Info info) {

    for (Iterator providers = ProviderService.getProviders(mixerProviderPath).iterator();
        providers.hasNext(); ) {
      try {
        MixerProvider pr = (MixerProvider) providers.next();
        Mixer.Info[] mixinfos = pr.getMixerInfo();
        for (Mixer.Info mixinfo : mixinfos) {
          Mixer mix = pr.getMixer(mixinfo);
          if (mix.isLineSupported(info)) {
            return true;
          }
        }
      } catch (ClassCastException e) {
      }
    }
    return false;
  }
Ejemplo n.º 3
0
 public static Line.Info[] getTargetLineInfo(Line.Info info) {
   List<Line.Info> result = new ArrayList<Line.Info>();
   for (Iterator providers = ProviderService.getProviders(mixerProviderPath).iterator();
       providers.hasNext(); ) {
     try {
       MixerProvider pr = (MixerProvider) providers.next();
       Mixer.Info[] mixinfos = pr.getMixerInfo();
       for (Mixer.Info mixinfo : mixinfos) {
         Mixer mix = pr.getMixer(mixinfo);
         Line.Info[] linfos = mix.getTargetLineInfo(info);
         for (Line.Info linfo : linfos) {
           result.add(linfo);
         }
       }
     } catch (ClassCastException e) {
     }
   }
   Line.Info[] temp = new Line.Info[result.size()];
   return result.toArray(temp);
 }