jdk/src/share/classes/javax/sound/midi/Soundbank.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sound.midi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * A <code>Soundbank</code> contains a set of <code>Instruments</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * that can be loaded into a <code>Synthesizer</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Note that a Java Sound <code>Soundbank</code> is different from a MIDI bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * MIDI permits up to 16383 banks, each containing up to 128 instruments
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * (also sometimes called programs, patches, or timbres).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * However, a <code>Soundbank</code> can contain 16383 times 128 instruments,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * because the instruments within a <code>Soundbank</code> are indexed by both
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * a MIDI program number and a MIDI bank number (via a <code>Patch</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * object). Thus, a <code>Soundbank</code> can be thought of as a collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * of MIDI banks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <code>Soundbank</code> includes methods that return <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * objects containing the sound bank's name, manufacturer, version number, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * description.  The precise content and format of these strings is left
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * to the implementor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Different synthesizers use a variety of synthesis techniques.  A common
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * one is wavetable synthesis, in which a segment of recorded sound is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * played back, often with looping and pitch change.  The Downloadable Sound
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * (DLS) format uses segments of recorded sound, as does the Headspace Engine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <code>Soundbanks</code> and <code>Instruments</code> that are based on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * wavetable synthesis (or other uses of stored sound recordings) should
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * typically implement the <code>getResources()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * method to provide access to these recorded segments.  This is optional,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * however; the method can return an zero-length array if the synthesis technique
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * doesn't use sampled sound (FM synthesis and physical modeling are examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * of such techniques), or if it does but the implementor chooses not to make the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * samples accessible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @see Synthesizer#getDefaultSoundbank
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @see Synthesizer#isSoundbankSupported
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * @see Synthesizer#loadInstruments(Soundbank, Patch[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * @see Patch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * @see Instrument
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * @see SoundbankResource
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @author David Rivas
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * @author Kara Kytle
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
public interface Soundbank {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * Obtains the name of the sound bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @return a <code>String</code> naming the sound bank
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public String getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Obtains the version string for the sound bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return a <code>String</code> that indicates the sound bank's version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public String getVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Obtains a <code>string</code> naming the company that provides the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * sound bank
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @return the vendor string
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public String getVendor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Obtains a textual description of the sound bank, suitable for display.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @return a <code>String</code> that describes the sound bank
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public String getDescription();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Extracts a list of non-Instrument resources contained in the sound bank.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   103
     * @return an array of resources, excluding instruments.  If the sound bank contains
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * no resources (other than instruments), returns an array of length 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    public SoundbankResource[] getResources();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Obtains a list of instruments contained in this sound bank.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @return an array of the <code>Instruments</code> in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * <code>SoundBank</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * If the sound bank contains no instruments, returns an array of length 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @see Synthesizer#getLoadedInstruments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @see #getInstrument(Patch)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public Instrument[] getInstruments();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Obtains an <code>Instrument</code> from the given <code>Patch</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @param patch a <code>Patch</code> object specifying the bank index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * and program change number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @return the requested instrument, or <code>null</code> if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * sound bank doesn't contain that instrument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @see #getInstruments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @see Synthesizer#loadInstruments(Soundbank, Patch[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public Instrument getInstrument(Patch patch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}