Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sound/midi/Soundbank.java
38830 views
/*1* Copyright (c) 1998, 2013, 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;2627import java.net.URL;282930/**31* A <code>Soundbank</code> contains a set of <code>Instruments</code>32* that can be loaded into a <code>Synthesizer</code>.33* Note that a Java Sound <code>Soundbank</code> is different from a MIDI bank.34* MIDI permits up to 16383 banks, each containing up to 128 instruments35* (also sometimes called programs, patches, or timbres).36* However, a <code>Soundbank</code> can contain 16383 times 128 instruments,37* because the instruments within a <code>Soundbank</code> are indexed by both38* a MIDI program number and a MIDI bank number (via a <code>Patch</code>39* object). Thus, a <code>Soundbank</code> can be thought of as a collection40* of MIDI banks.41* <p>42* <code>Soundbank</code> includes methods that return <code>String</code>43* objects containing the sound bank's name, manufacturer, version number, and44* description. The precise content and format of these strings is left45* to the implementor.46* <p>47* Different synthesizers use a variety of synthesis techniques. A common48* one is wavetable synthesis, in which a segment of recorded sound is49* played back, often with looping and pitch change. The Downloadable Sound50* (DLS) format uses segments of recorded sound, as does the Headspace Engine.51* <code>Soundbanks</code> and <code>Instruments</code> that are based on52* wavetable synthesis (or other uses of stored sound recordings) should53* typically implement the <code>getResources()</code>54* method to provide access to these recorded segments. This is optional,55* however; the method can return an zero-length array if the synthesis technique56* doesn't use sampled sound (FM synthesis and physical modeling are examples57* of such techniques), or if it does but the implementor chooses not to make the58* samples accessible.59*60* @see Synthesizer#getDefaultSoundbank61* @see Synthesizer#isSoundbankSupported62* @see Synthesizer#loadInstruments(Soundbank, Patch[])63* @see Patch64* @see Instrument65* @see SoundbankResource66*67* @author David Rivas68* @author Kara Kytle69*/7071public interface Soundbank {727374/**75* Obtains the name of the sound bank.76* @return a <code>String</code> naming the sound bank77*/78public String getName();7980/**81* Obtains the version string for the sound bank.82* @return a <code>String</code> that indicates the sound bank's version83*/84public String getVersion();8586/**87* Obtains a <code>string</code> naming the company that provides the88* sound bank89* @return the vendor string90*/91public String getVendor();9293/**94* Obtains a textual description of the sound bank, suitable for display.95* @return a <code>String</code> that describes the sound bank96*/97public String getDescription();9899100/**101* Extracts a list of non-Instrument resources contained in the sound bank.102* @return an array of resources, excluding instruments. If the sound bank contains103* no resources (other than instruments), returns an array of length 0.104*/105public SoundbankResource[] getResources();106107108/**109* Obtains a list of instruments contained in this sound bank.110* @return an array of the <code>Instruments</code> in this111* <code>SoundBank</code>112* If the sound bank contains no instruments, returns an array of length 0.113*114* @see Synthesizer#getLoadedInstruments115* @see #getInstrument(Patch)116*/117public Instrument[] getInstruments();118119/**120* Obtains an <code>Instrument</code> from the given <code>Patch</code>.121* @param patch a <code>Patch</code> object specifying the bank index122* and program change number123* @return the requested instrument, or <code>null</code> if the124* sound bank doesn't contain that instrument125*126* @see #getInstruments127* @see Synthesizer#loadInstruments(Soundbank, Patch[])128*/129public Instrument getInstrument(Patch patch);130131132}133134135