Source Code Cross Referenced for Mixer.java in  » 6.0-JDK-Core » sound » javax » sound » sampled » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sound » javax.sound.sampled 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1999-2004 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.sound.sampled;
027
028        /**
029         * A mixer is an audio device with one or more lines.  It need not be
030         * designed for mixing audio signals.  A mixer that actually mixes audio
031         * has multiple input (source) lines and at least one output (target) line.
032         * The former are often instances of classes that implement
033         * <code>{@link SourceDataLine}</code>,
034         * and the latter, <code>{@link TargetDataLine}</code>.  <code>{@link Port}</code>
035         * objects, too, are either source lines or target lines.
036         * A mixer can accept prerecorded, loopable sound as input, by having
037         * some of its source lines be instances of objects that implement the
038         * <code>{@link Clip}</code> interface.
039         * <p>
040         * Through methods of the <code>Line</code> interface, which <code>Mixer</code> extends,
041         * a mixer might provide a set of controls that are global to the mixer.  For example,
042         * the mixer can have a master gain control.  These global controls are distinct
043         * from the controls belonging to each of the mixer's individual lines.
044         * <p>
045         * Some mixers, especially
046         * those with internal digital mixing capabilities, may provide
047         * additional capabilities by implementing the <code>DataLine</code> interface.
048         * <p>
049         * A mixer can support synchronization of its lines.  When one line in
050         * a synchronized group is started or stopped, the other lines in the group
051         * automatically start or stop simultaneously with the explicitly affected one.
052         *
053         * @author Kara Kytle
054         * @version 1.38, 07/05/05
055         * @since 1.3
056         */
057        public interface Mixer extends Line {
058
059            /**
060             * Obtains information about this mixer, including the product's name,
061             * version, vendor, etc.
062             * @return a mixer info object that describes this mixer
063             * @see Mixer.Info
064             */
065            public Info getMixerInfo();
066
067            /**
068             * Obtains information about the set of source lines supported
069             * by this mixer.
070             * Some source lines may only be available when this mixer is open.
071             * @return array of <code>Line.Info</code> objects representing source lines
072             * for this mixer.  If no source lines are supported,
073             * an array of length 0 is returned.
074             */
075            public Line.Info[] getSourceLineInfo();
076
077            /**
078             * Obtains information about the set of target lines supported
079             * by this mixer.
080             * Some target lines may only be available when this mixer is open.
081             * @return array of <code>Line.Info</code> objects representing target lines
082             * for this mixer.  If no target lines are supported,
083             * an array of length 0 is returned.
084             */
085            public Line.Info[] getTargetLineInfo();
086
087            /**
088             * Obtains information about source lines of a particular type supported
089             * by the mixer.
090             * Some source lines may only be available when this mixer is open.
091             * @param info a <code>Line.Info</code> object describing lines about which information
092             * is queried
093             * @return an array of <code>Line.Info</code> objects describing source lines matching
094             * the type requested.  If no matching source lines are supported, an array of length 0
095             * is returned.
096             */
097            public Line.Info[] getSourceLineInfo(Line.Info info);
098
099            /**
100             * Obtains information about target lines of a particular type supported
101             * by the mixer.
102             * Some target lines may only be available when this mixer is open.
103             * @param info a <code>Line.Info</code> object describing lines about which information
104             * is queried
105             * @return an array of <code>Line.Info</code> objects describing target lines matching
106             * the type requested.  If no matching target lines are supported, an array of length 0
107             * is returned.
108             */
109            public Line.Info[] getTargetLineInfo(Line.Info info);
110
111            /**
112             * Indicates whether the mixer supports a line (or lines) that match
113             * the specified <code>Line.Info</code> object.
114             * Some lines may only be supported when this mixer is open.
115             * @param info describes the line for which support is queried
116             * @return <code>true</code> if at least one matching line is
117             * supported, <code>false</code> otherwise
118             */
119            public boolean isLineSupported(Line.Info info);
120
121            /**
122             * Obtains a line that is available for use and that matches the description
123             * in the specified <code>Line.Info</code> object.
124             *
125             * <p>If a <code>DataLine</code> is requested, and <code>info</code>
126             * is an instance of <code>DataLine.Info</code> specifying at
127             * least one fully qualified audio format, the last one
128             * will be used as the default format of the returned
129             * <code>DataLine</code>.
130             *
131             * @param info describes the desired line
132             * @throws LineUnavailableException if a matching line
133             * is not available due to resource restrictions
134             * @throws IllegalArgumentException if this mixer does
135             * not support any lines matching the description
136             * @throws SecurityException if a matching line
137             * is not available due to security restrictions
138             */
139            public Line getLine(Line.Info info) throws LineUnavailableException;
140
141            //$$fb 2002-04-12: fix for 4667258: behavior of Mixer.getMaxLines(Line.Info) method doesn't match the spec
142            /**
143             * Obtains the approximate maximum number of lines of the requested type that can be open
144             * simultaneously on the mixer.
145             *
146             * Certain types of mixers do not have a hard bound and may allow opening more lines.
147             * Since certain lines are a shared resource, a mixer may not be able to open the maximum
148             * number of lines if another process has opened lines of this mixer.
149             *
150             * The requested type is any line that matches the description in
151             * the provided <code>Line.Info</code> object.  For example, if the info
152             * object represents a speaker
153             * port, and the mixer supports exactly one speaker port, this method
154             * should return 1.  If the info object represents a source data line
155             * and the mixer supports the use of 32 source data lines simultaneously,
156             * the return value should be 32.
157             * If there is no limit, this function returns <code>AudioSystem.NOT_SPECIFIED</code>.
158             * @param info a <code>Line.Info</code> that describes the line for which
159             * the number of supported instances is queried
160             * @return the maximum number of matching lines supported, or <code>AudioSystem.NOT_SPECIFIED</code>
161             */
162            public int getMaxLines(Line.Info info);
163
164            /**
165             * Obtains the set of all source lines currently open to this mixer.
166             *
167             * @return the source lines currently open to the mixer.
168             * If no source lines are currently open to this mixer,  an
169             * array of length 0 is returned.
170             * @throws SecurityException if the matching lines
171             * are not available due to security restrictions
172             */
173            public Line[] getSourceLines();
174
175            /**
176             * Obtains the set of all target lines currently open from this mixer.
177             *
178             * @return target lines currently open from the mixer.
179             * If no target lines are currently open from this mixer, an
180             * array of length 0 is returned.
181             * @throws SecurityException if the matching lines
182             * are not available due to security restrictions
183             */
184            public Line[] getTargetLines();
185
186            /**
187             * Synchronizes two or more lines.  Any subsequent command that starts or stops
188             * audio playback or capture for one of these lines will exert the
189             * same effect on the other lines in the group, so that they start or stop playing or
190             * capturing data simultaneously.
191             *
192             * @param lines the lines that should be synchronized
193             * @param maintainSync <code>true</code> if the synchronization
194             * must be precisely maintained (i.e., the synchronization must be sample-accurate)
195             * at all times during operation of the lines , or <code>false</code>
196             * if precise synchronization is required only during start and stop operations
197             *
198             * @throws IllegalArgumentException if the lines cannot be synchronized.
199             * This may occur if the lines are of different types or have different
200             * formats for which this mixer does not support synchronization, or if
201             * all lines specified do not belong to this mixer.
202             */
203            public void synchronize(Line[] lines, boolean maintainSync);
204
205            /**
206             * Releases synchronization for the specified lines.  The array must
207             * be identical to one for which synchronization has already been
208             * established; otherwise an exception may be thrown.  However, <code>null</code>
209             * may be specified, in which case all currently synchronized lines that belong
210             * to this mixer are unsynchronized.
211             * @param lines the synchronized lines for which synchronization should be
212             * released, or <code>null</code> for all this mixer's synchronized lines
213             *
214             * @throws IllegalArgumentException if the lines cannot be unsynchronized.
215             * This may occur if the argument specified does not exactly match a set
216             * of lines for which synchronization has already been established.
217             */
218            public void unsynchronize(Line[] lines);
219
220            /**
221             * Reports whether this mixer supports synchronization of the specified set of lines.
222             *
223             * @param lines the set of lines for which synchronization support is queried
224             * @param maintainSync <code>true</code> if the synchronization
225             * must be precisely maintained (i.e., the synchronization must be sample-accurate)
226             * at all times during operation of the lines , or <code>false</code>
227             * if precise synchronization is required only during start and stop operations
228             *
229             * @return <code>true</code> if the lines can be synchronized, <code>false</code>
230             * otherwise
231             */
232            public boolean isSynchronizationSupported(Line[] lines,
233                    boolean maintainSync);
234
235            /**
236             * The <code>Mixer.Info</code> class represents information about an audio mixer,
237             * including the product's name, version, and vendor, along with a textual
238             * description.  This information may be retrieved through the
239             * {@link Mixer#getMixerInfo() getMixerInfo}
240             * method of the <code>Mixer</code> interface.
241             *
242             * @author Kara Kytle
243             * @version 1.38, 07/05/05
244             * @since 1.3
245             */
246            public static class Info {
247
248                /**
249                 * Mixer name.
250                 */
251                private/*final*/String name;
252
253                /**
254                 * Mixer vendor.
255                 */
256                private/*final*/String vendor;
257
258                /**
259                 * Mixer description.
260                 */
261                private/*final*/String description;
262
263                /**
264                 * Mixer version.
265                 */
266                private/*final*/String version;
267
268                /**
269                 * Constructs a mixer's info object, passing it the given
270                 * textual information.
271                 * @param name the name of the mixer
272                 * @param vendor the company who manufactures or creates the hardware
273                 * or software mixer
274                 * @param description descriptive text about the mixer
275                 * @param version version information for the mixer
276                 */
277                protected Info(String name, String vendor, String description,
278                        String version) {
279
280                    this .name = name;
281                    this .vendor = vendor;
282                    this .description = description;
283                    this .version = version;
284                }
285
286                /**
287                 * Indicates whether two info objects are equal, returning <code>true</code> if
288                 * they are identical.
289                 * @param obj the reference object with which to compare this info
290                 * object
291                 * @return <code>true</code> if this info object is the same as the
292                 * <code>obj</code> argument; <code>false</code> otherwise
293                 */
294                public final boolean equals(Object obj) {
295                    return super .equals(obj);
296                }
297
298                /**
299                 * Finalizes the hashcode method.
300                 *
301                 * @return the hashcode for this object
302                 */
303                public final int hashCode() {
304                    return super .hashCode();
305                }
306
307                /**
308                 * Obtains the name of the mixer.
309                 * @return a string that names the mixer
310                 */
311                public final String getName() {
312                    return name;
313                }
314
315                /**
316                 * Obtains the vendor of the mixer.
317                 * @return a string that names the mixer's vendor
318                 */
319                public final String getVendor() {
320                    return vendor;
321                }
322
323                /**
324                 * Obtains the description of the mixer.
325                 * @return a textual description of the mixer
326                 */
327                public final String getDescription() {
328                    return description;
329                }
330
331                /**
332                 * Obtains the version of the mixer.
333                 * @return textual version information for the mixer
334                 */
335                public final String getVersion() {
336                    return version;
337                }
338
339                /**
340                 * Provides a string representation of the mixer info.
341                 * @return a string describing the info object
342                 */
343                public final String toString() {
344                    return (name + ", version " + version);
345                }
346            } // class Info
347        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.