Path: blob/master/src/java.desktop/share/classes/javax/sound/midi/Soundbank.java
41159 views
/*1* Copyright (c) 1998, 2014, 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.midi;2627/**28* A {@code Soundbank} contains a set of {@code Instruments} that can be loaded29* into a {@code Synthesizer}. Note that a Java Sound {@code Soundbank} is30* different from a MIDI bank. MIDI permits up to 16383 banks, each containing31* up to 128 instruments (also sometimes called programs, patches, or timbres).32* However, a {@code Soundbank} can contain 16383 times 128 instruments, because33* the instruments within a {@code Soundbank} are indexed by both a MIDI program34* number and a MIDI bank number (via a {@code Patch} object). Thus, a35* {@code Soundbank} can be thought of as a collection of MIDI banks.36* <p>37* {@code Soundbank} includes methods that return {@code String} objects38* containing the sound bank's name, manufacturer, version number, and39* description. The precise content and format of these strings is left to the40* implementor.41* <p>42* Different synthesizers use a variety of synthesis techniques. A common one is43* wavetable synthesis, in which a segment of recorded sound is played back,44* often with looping and pitch change. The Downloadable Sound (DLS) format uses45* segments of recorded sound, as does the Headspace Engine. {@code Soundbanks}46* and {@code Instruments} that are based on wavetable synthesis (or other uses47* of stored sound recordings) should typically implement the48* {@code getResources()} method to provide access to these recorded segments.49* This is optional, however; the method can return an zero-length array if the50* synthesis technique doesn't use sampled sound (FM synthesis and physical51* modeling are examples of such techniques), or if it does but the implementor52* chooses not to make the samples accessible.53*54* @author David Rivas55* @author Kara Kytle56* @see Synthesizer#getDefaultSoundbank57* @see Synthesizer#isSoundbankSupported58* @see Synthesizer#loadInstruments(Soundbank, Patch[])59* @see Patch60* @see Instrument61* @see SoundbankResource62*/63public interface Soundbank {6465/**66* Obtains the name of the sound bank.67*68* @return a {@code String} naming the sound bank69*/70String getName();7172/**73* Obtains the version string for the sound bank.74*75* @return a {@code String} that indicates the sound bank's version76*/77String getVersion();7879/**80* Obtains a {@code string} naming the company that provides the sound bank.81*82* @return the vendor string83*/84String getVendor();8586/**87* Obtains a textual description of the sound bank, suitable for display.88*89* @return a {@code String} that describes the sound bank90*/91String getDescription();9293/**94* Extracts a list of non-Instrument resources contained in the sound bank.95*96* @return an array of resources, excluding instruments. If the sound bank97* contains no resources (other than instruments), returns an array98* of length 0.99*/100SoundbankResource[] getResources();101102/**103* Obtains a list of instruments contained in this sound bank.104*105* @return an array of the {@code Instruments} in this {@code SoundBank}. If106* the sound bank contains no instruments, returns an array of107* length 0.108* @see Synthesizer#getLoadedInstruments109* @see #getInstrument(Patch)110*/111Instrument[] getInstruments();112113/**114* Obtains an {@code Instrument} from the given {@code Patch}.115*116* @param patch a {@code Patch} object specifying the bank index and117* program change number118* @return the requested instrument, or {@code null} if the sound bank119* doesn't contain that instrument120* @see #getInstruments121* @see Synthesizer#loadInstruments(Soundbank, Patch[])122*/123Instrument getInstrument(Patch patch);124}125126127