1. /*
  2. * @(#)MixerProvider.java 1.18 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.sound.sampled.spi;
  8. import javax.sound.sampled.Mixer;
  9. /**
  10. * A provider or factory for a particular mixer type.
  11. * This mechanism allows the implementation to determine
  12. * how resources are managed in creation / management of
  13. * a mixer.
  14. *
  15. * @version 1.18 03/12/19
  16. * @author Kara Kytle
  17. * @since 1.3
  18. */
  19. public abstract class MixerProvider {
  20. /**
  21. * Indicates whether the mixer provider supports the mixer represented by
  22. * the specified mixer info object.
  23. * @param info an info object that describes the mixer for which support is queried
  24. * @return <code>true</code> if the specified mixer is supported,
  25. * otherwise <code>false</code>
  26. */
  27. public boolean isMixerSupported(Mixer.Info info) {
  28. Mixer.Info infos[] = getMixerInfo();
  29. for(int i=0; i<infos.length; i++){
  30. if( info.equals( infos[i] ) ) {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. /**
  37. * Obtains the set of info objects representing the mixer
  38. * or mixers provided by this MixerProvider.
  39. * @return set of mixer info objects
  40. */
  41. public abstract Mixer.Info[] getMixerInfo();
  42. /**
  43. * Obtains an instance of the mixer represented by the info object.
  44. * @param info an info object that describes the desired mixer
  45. * @return mixer instance
  46. * @throws IllegalArgumentException if the info object specified does not
  47. * match the info object for a mixer supported by this MixerProvider.
  48. */
  49. public abstract Mixer getMixer(Mixer.Info info);
  50. }