KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sound > midi > Soundbank


1 /*
2  * @(#)Soundbank.java 1.24 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sound.midi;
9
10 import java.net.URL JavaDoc;
11
12
13 /**
14  * A <code>Soundbank</code> contains a set of <code>Instruments</code>
15  * that can be loaded into a <code>Synthesizer</code>.
16  * Note that a Java Sound <code>Soundbank</code> is different from a MIDI bank.
17  * MIDI permits up to 16383 banks, each containing up to 128 instruments
18  * (also sometimes called programs, patches, or timbres).
19  * However, a <code>Soundbank</code> can contain 16383 times 128 instruments,
20  * because the instruments within a <code>Soundbank</code> are indexed by both
21  * a MIDI program number and a MIDI bank number (via a <code>Patch</code>
22  * object). Thus, a <code>Soundbank</code> can be thought of as a collection
23  * of MIDI banks.
24  * <p>
25  * <code>Soundbank</code> includes methods that return <code>String</code>
26  * objects containing the sound bank's name, manufacturer, version number, and
27  * description. The precise content and format of these strings is left
28  * to the implementor.
29  * <p>
30  * Different synthesizers use a variety of synthesis techniques. A common
31  * one is wavetable synthesis, in which a segment of recorded sound is
32  * played back, often with looping and pitch change. The Downloadable Sound
33  * (DLS) format uses segments of recorded sound, as does the Headspace Engine.
34  * <code>Soundbanks</code> and <code>Instruments</code> that are based on
35  * wavetable synthesis (or other uses of stored sound recordings) should
36  * typically implement the <code>getResources()</code>
37  * method to provide access to these recorded segments. This is optional,
38  * however; the method can return an zero-length array if the synthesis technique
39  * doesn't use sampled sound (FM synthesis and physical modeling are examples
40  * of such techniques), or if it does but the implementor chooses not to make the
41  * samples accessible.
42  *
43  * @see Synthesizer#getDefaultSoundbank
44  * @see Synthesizer#isSoundbankSupported
45  * @see Synthesizer#loadInstruments(Soundbank, Patch[])
46  * @see Patch
47  * @see Instrument
48  * @see SoundbankResource
49  *
50  * @version 1.24, 03/12/19
51  * @author David Rivas
52  * @author Kara Kytle
53  */

54
55 public interface Soundbank {
56
57
58     /**
59      * Obtains the name of the sound bank.
60      * @return a <code>String</code> naming the sound bank
61      */

62     public String JavaDoc getName();
63
64     /**
65      * Obtains the version string for the sound bank.
66      * @return a <code>String</code> that indicates the sound bank's version
67      */

68     public String JavaDoc getVersion();
69
70     /**
71      * Obtains a <code>string</code> naming the company that provides the
72      * sound bank
73      * @return the vendor string
74      */

75     public String JavaDoc getVendor();
76
77     /**
78      * Obtains a textual description of the sound bank, suitable for display.
79      * @return a <code>String</code> that describes the sound bank
80      */

81     public String JavaDoc getDescription();
82
83
84     /**
85      * Extracts a list of non-Instrument resources contained in the sound bank.
86      * @return an array of resources, exclusing instruments. If the sound bank contains
87      * no resources (other than instruments), returns an array of length 0.
88      */

89     public SoundbankResource JavaDoc[] getResources();
90
91
92     /**
93      * Obtains a list of instruments contained in this sound bank.
94      * @return an array of the <code>Instruments</code> in this
95      * <code>SoundBank</code>
96      * If the sound bank contains no instruments, returns an array of length 0.
97      *
98      * @see Synthesizer#getLoadedInstruments
99      * @see #getInstrument(Patch)
100      */

101     public Instrument JavaDoc[] getInstruments();
102
103     /**
104      * Obtains an <code>Instrument</code> from the given <code>Patch</code>.
105      * @param patch a <code>Patch</code> object specifying the bank index
106      * and program change number
107      * @return the requested instrument, or <code>null</code> if the
108      * sound bank doesn't contain that instrument
109      *
110      * @see #getInstruments
111      * @see Synthesizer#loadInstruments(Soundbank, Patch[])
112      */

113     public Instrument JavaDoc getInstrument(Patch JavaDoc patch);
114
115
116 }
117
Popular Tags