Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java
38918 views
/*1* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.sampled.spi;2627import javax.sound.sampled.Mixer;2829/**30* A provider or factory for a particular mixer type.31* This mechanism allows the implementation to determine32* how resources are managed in creation / management of33* a mixer.34*35* @author Kara Kytle36* @since 1.337*/38public abstract class MixerProvider {394041/**42* Indicates whether the mixer provider supports the mixer represented by43* the specified mixer info object.44* <p>45* The full set of mixer info objects that represent the mixers supported46* by this {@code MixerProvider} may be obtained47* through the {@code getMixerInfo} method.48*49* @param info an info object that describes the mixer for which support is queried50* @return {@code true} if the specified mixer is supported,51* otherwise {@code false}52* @see #getMixerInfo()53*/54public boolean isMixerSupported(Mixer.Info info) {5556Mixer.Info infos[] = getMixerInfo();5758for(int i=0; i<infos.length; i++){59if( info.equals( infos[i] ) ) {60return true;61}62}63return false;64}656667/**68* Obtains the set of info objects representing the mixer69* or mixers provided by this MixerProvider.70* <p>71* The {@code isMixerSupported} method returns {@code true}72* for all the info objects returned by this method.73* The corresponding mixer instances for the info objects74* are returned by the {@code getMixer} method.75*76* @return a set of mixer info objects77* @see #getMixer(javax.sound.sampled.Mixer.Info) getMixer(Mixer.Info)78* @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)79*/80public abstract Mixer.Info[] getMixerInfo();818283/**84* Obtains an instance of the mixer represented by the info object.85* <p>86* The full set of the mixer info objects that represent the mixers87* supported by this {@code MixerProvider} may be obtained88* through the {@code getMixerInfo} method.89* Use the {@code isMixerSupported} method to test whether90* this {@code MixerProvider} supports a particular mixer.91*92* @param info an info object that describes the desired mixer93* @return mixer instance94* @throws IllegalArgumentException if the info object specified does not95* match the info object for a mixer supported by this MixerProvider.96* @see #getMixerInfo()97* @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)98*/99public abstract Mixer getMixer(Mixer.Info info);100}101102103