Source for javax.sound.sampled.Mixer

   1: /* Mixers
   2:    Copyright (C) 2005 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.sound.sampled;
  40: 
  41: /**
  42:  * A Mixer is a Line which itself holds multiple lines.
  43:  * @since 1.3
  44:  */
  45: public interface Mixer extends Line
  46: {
  47:   /**
  48:    * An Info object describes a mixer.
  49:    * @since 1.3
  50:    */
  51:   class Info
  52:   {
  53:     private String name;
  54:     private String description;
  55:     private String vendor;
  56:     private String version;
  57: 
  58:     /**
  59:      * Create a new mixer description.
  60:      * @param name the name of the mixer
  61:      * @param vendor the vendor
  62:      * @param desc a descriptive string
  63:      * @param vers the mixer's version
  64:      */
  65:     protected Info(String name, String vendor, String desc, String vers)
  66:     {
  67:       this.name = name;
  68:       this.description = desc;
  69:       this.vendor = vendor;
  70:       this.version = vers;
  71:     }
  72: 
  73:     public final boolean equals(Object o)
  74:     {
  75:       return super.equals(o);
  76:     }
  77: 
  78:     public final int hashCode()
  79:     {
  80:       return super.hashCode();
  81:     }
  82: 
  83:     /**
  84:      * Return the name of the mixer.
  85:      */
  86:     public final String getName()
  87:     {
  88:       return name;
  89:     }
  90: 
  91:     /**
  92:      * Return the mixer's description.
  93:      */
  94:     public final String getDescription()
  95:     {
  96:       return description;
  97:     }
  98: 
  99:     /**
 100:      * Return the mixer's vendor.
 101:      */
 102:     public final String getVendor()
 103:     {
 104:       return vendor;
 105:     }
 106: 
 107:     /**
 108:      * Return the mixer's version.
 109:      */
 110:     public final String getVersion()
 111:     {
 112:       return version;
 113:     }
 114: 
 115:     public final String toString()
 116:     {
 117:       return ("name=" + name + "; description=" + description
 118:               + "; vendor=" + vendor + "; version=" + version);
 119:     }
 120:   }
 121: 
 122:   /**
 123:    * Return a Line associated with this Mixer, given its description.
 124:    * @param info the description of the line to find
 125:    * @return the corresponding Line
 126:    * @throws LineUnavailableException if no Line matching the description
 127:    * exists in this Mixer
 128:    */
 129:   Line getLine(Line.Info info) throws LineUnavailableException;
 130: 
 131:   /**
 132:    * Return the number of lines matching this description.
 133:    * @param info the description of the lines to find.
 134:    */
 135:   int getMaxLines(Line.Info info);
 136: 
 137:   /**
 138:    * Return an Info object describing this Mixer.
 139:    */
 140:   Info getMixerInfo();
 141: 
 142:   /**
 143:    * Return an array of Info objects describing all the source lines
 144:    * available in this Mixer.
 145:    */
 146:   Line.Info[] getSourceLineInfo();
 147: 
 148:   /**
 149:    * Return an array of Info objects describing all the source lines
 150:    * available in this Mixer, which match the provided decsription.
 151:    * @param info the description of the source lines to find
 152:    */
 153:   Line.Info[] getSourceLineInfo(Line.Info info);
 154: 
 155:   /**
 156:    * Return an array of all the source lines available in this Mixer.
 157:    */
 158:   Line[] getSourceLines();
 159: 
 160:   /**
 161:    * Return an array of Info objects describing all the target lines
 162:    * available in this Mixer.
 163:    */
 164:   Line.Info[] getTargetLineInfo();
 165: 
 166:   /**
 167:    * Return an array of Info objects describing all the target lines
 168:    * available in this Mixer, which match the provided decsription.
 169:    * @param info the description of the target lines to find
 170:    */
 171:   Line.Info[] getTargetLineInfo(Line.Info info);
 172: 
 173:   /**
 174:    * Return an array of all the target lines available in this Mixer.
 175:    */
 176:   Line[] getTargetLines();
 177: 
 178:   /**
 179:    * Return true if a Line matching the given description is supported
 180:    * by this Mixer, false otherwise.
 181:    * @param info the description of the line to find
 182:    */
 183:   boolean isLineSupported(Line.Info info);
 184: 
 185:   /**
 186:    * Return true if this Mixer supports synchronization of the given set
 187:    * of lines.
 188:    * @param lines the lines to check
 189:    * @param sync true if the synchronization must be accurate at all times
 190:    */
 191:   boolean isSynchronizationSupported(Line[] lines, boolean sync);
 192: 
 193:   /**
 194:    * Start synchronization on the given set of lines.
 195:    * @param lines the lines to synchronize, or null for all the lines
 196:    * @param sync true if the synchronization must be accurate at all times
 197:    * @throws IllegalArgumentException if the lines cannot be synchronized
 198:    */
 199:   void synchronize(Line[] lines, boolean sync);
 200: 
 201:   /**
 202:    * Stop synchronization for the given set of lines.
 203:    * @param lines the lines to unsynchronize, or null for all the lines
 204:    */
 205:   void unsynchronize(Line[] lines);
 206: }