0N/A/*
2362N/A * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.sound.midi;
0N/A
0N/Aimport java.net.URL;
0N/A
0N/A
0N/A
0N/A/**
0N/A * An instrument is a sound-synthesis algorithm with certain parameter
0N/A * settings, usually designed to emulate a specific real-world
0N/A * musical instrument or to achieve a specific sort of sound effect.
0N/A * Instruments are typically stored in collections called soundbanks.
0N/A * Before the instrument can be used to play notes, it must first be loaded
0N/A * onto a synthesizer, and then it must be selected for use on
0N/A * one or more channels, via a program-change command. MIDI notes
0N/A * that are subsequently received on those channels will be played using
0N/A * the sound of the selected instrument.
0N/A *
0N/A * @see Soundbank
0N/A * @see Soundbank#getInstruments
0N/A * @see Patch
0N/A * @see Synthesizer#loadInstrument(Instrument)
0N/A * @see MidiChannel#programChange(int, int)
0N/A * @author Kara Kytle
0N/A */
0N/A
0N/Apublic abstract class Instrument extends SoundbankResource {
0N/A
0N/A
0N/A /**
0N/A * Instrument patch
0N/A */
0N/A private final Patch patch;
0N/A
0N/A
0N/A /**
0N/A * Constructs a new MIDI instrument from the specified <code>Patch</code>.
0N/A * When a subsequent request is made to load the
0N/A * instrument, the sound bank will search its contents for this instrument's <code>Patch</code>,
0N/A * and the instrument will be loaded into the synthesizer at the
0N/A * bank and program location indicated by the <code>Patch</code> object.
0N/A * @param soundbank sound bank containing the instrument
0N/A * @param patch the patch of this instrument
0N/A * @param name the name of this instrument
0N/A * @param dataClass the class used to represent the sample's data.
0N/A *
0N/A * @see Synthesizer#loadInstrument(Instrument)
0N/A */
0N/A protected Instrument(Soundbank soundbank, Patch patch, String name, Class<?> dataClass) {
0N/A
0N/A super(soundbank, name, dataClass);
0N/A this.patch = patch;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Obtains the <code>Patch</code> object that indicates the bank and program
0N/A * numbers where this instrument is to be stored in the synthesizer.
0N/A * @return this instrument's patch
0N/A */
0N/A public Patch getPatch() {
0N/A return patch;
0N/A }
0N/A}