001 /* Mixers
002 Copyright (C) 2005 Free Software Foundation, Inc.
003
004 This file is part of GNU Classpath.
005
006 GNU Classpath is free software; you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation; either version 2, or (at your option)
009 any later version.
010
011 GNU Classpath is distributed in the hope that it will be useful, but
012 WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with GNU Classpath; see the file COPYING. If not, write to the
018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019 02110-1301 USA.
020
021 Linking this library statically or dynamically with other modules is
022 making a combined work based on this library. Thus, the terms and
023 conditions of the GNU General Public License cover the whole
024 combination.
025
026 As a special exception, the copyright holders of this library give you
027 permission to link this library with independent modules to produce an
028 executable, regardless of the license terms of these independent
029 modules, and to copy and distribute the resulting executable under
030 terms of your choice, provided that you also meet, for each linked
031 independent module, the terms and conditions of the license of that
032 module. An independent module is a module which is not derived from
033 or based on this library. If you modify this library, you may extend
034 this exception to your version of the library, but you are not
035 obligated to do so. If you do not wish to do so, delete this
036 exception statement from your version. */
037
038
039 package javax.sound.sampled;
040
041 /**
042 * A Mixer is a Line which itself holds multiple lines.
043 * @since 1.3
044 */
045 public interface Mixer extends Line
046 {
047 /**
048 * An Info object describes a mixer.
049 * @since 1.3
050 */
051 class Info
052 {
053 private String name;
054 private String description;
055 private String vendor;
056 private String version;
057
058 /**
059 * Create a new mixer description.
060 * @param name the name of the mixer
061 * @param vendor the vendor
062 * @param desc a descriptive string
063 * @param vers the mixer's version
064 */
065 protected Info(String name, String vendor, String desc, String vers)
066 {
067 this.name = name;
068 this.description = desc;
069 this.vendor = vendor;
070 this.version = vers;
071 }
072
073 public final boolean equals(Object o)
074 {
075 return super.equals(o);
076 }
077
078 public final int hashCode()
079 {
080 return super.hashCode();
081 }
082
083 /**
084 * Return the name of the mixer.
085 */
086 public final String getName()
087 {
088 return name;
089 }
090
091 /**
092 * Return the mixer's description.
093 */
094 public final String getDescription()
095 {
096 return description;
097 }
098
099 /**
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 }