javax.sound.midi
Class Instrument

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.midi.SoundbankResource sample code for javax.sound.midi.SoundbankResource definition code for javax.sound.midi.SoundbankResource 
      extended by javax.sound.midi.Instrument

public abstract class Instrument
extends SoundbankResource sample code for javax.sound.midi.SoundbankResource definition code for javax.sound.midi.SoundbankResource

An instrument is a sound-synthesis algorithm with certain parameter settings, usually designed to emulate a specific real-world musical instrument or to achieve a specific sort of sound effect. Instruments are typically stored in collections called soundbanks. Before the instrument can be used to play notes, it must first be loaded onto a synthesizer, and then it must be selected for use on one or more channels, via a program-change command. MIDI notes that are subsequently received on those channels will be played using the sound of the selected instrument.

See Also:
Soundbank sample code for javax.sound.midi.Soundbank definition code for javax.sound.midi.Soundbank , Soundbank.getInstruments() sample code for javax.sound.midi.Soundbank.getInstruments() definition code for javax.sound.midi.Soundbank.getInstruments() , Patch sample code for javax.sound.midi.Patch definition code for javax.sound.midi.Patch , Synthesizer.loadInstrument(Instrument) sample code for javax.sound.midi.Synthesizer.loadInstrument(javax.sound.midi.Instrument) definition code for javax.sound.midi.Synthesizer.loadInstrument(javax.sound.midi.Instrument) , MidiChannel.programChange(int, int) sample code for javax.sound.midi.MidiChannel.programChange(int, int) definition code for javax.sound.midi.MidiChannel.programChange(int, int)

Constructor Summary
protected Instrument sample code for javax.sound.midi.Instrument.Instrument(javax.sound.midi.Soundbank, javax.sound.midi.Patch, java.lang.String, java.lang.Class) definition code for javax.sound.midi.Instrument.Instrument(javax.sound.midi.Soundbank, javax.sound.midi.Patch, java.lang.String, java.lang.Class) (Soundbank sample code for javax.sound.midi.Soundbank definition code for javax.sound.midi.Soundbank  soundbank, Patch sample code for javax.sound.midi.Patch definition code for javax.sound.midi.Patch  patch, String sample code for java.lang.String definition code for java.lang.String  name, Class sample code for java.lang.Class definition code for java.lang.Class <?> dataClass)
          Constructs a new MIDI instrument from the specified Patch.
 
Method Summary
 Patch sample code for javax.sound.midi.Patch definition code for javax.sound.midi.Patch getPatch sample code for javax.sound.midi.Instrument.getPatch() definition code for javax.sound.midi.Instrument.getPatch() ()
          Obtains the Patch object that indicates the bank and program numbers where this instrument is to be stored in the synthesizer.
 
Methods inherited from class javax.sound.midi.SoundbankResource sample code for javax.sound.midi.SoundbankResource definition code for javax.sound.midi.SoundbankResource
getData sample code for javax.sound.midi.SoundbankResource.getData() definition code for javax.sound.midi.SoundbankResource.getData() , getDataClass sample code for javax.sound.midi.SoundbankResource.getDataClass() definition code for javax.sound.midi.SoundbankResource.getDataClass() , getName sample code for javax.sound.midi.SoundbankResource.getName() definition code for javax.sound.midi.SoundbankResource.getName() , getSoundbank sample code for javax.sound.midi.SoundbankResource.getSoundbank() definition code for javax.sound.midi.SoundbankResource.getSoundbank()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Instrument sample code for javax.sound.midi.Instrument(javax.sound.midi.Soundbank, javax.sound.midi.Patch, java.lang.String, java.lang.Class<?>) definition code for javax.sound.midi.Instrument(javax.sound.midi.Soundbank, javax.sound.midi.Patch, java.lang.String, java.lang.Class<?>)

protected Instrument(Soundbank sample code for javax.sound.midi.Soundbank definition code for javax.sound.midi.Soundbank  soundbank,
                     Patch sample code for javax.sound.midi.Patch definition code for javax.sound.midi.Patch  patch,
                     String sample code for java.lang.String definition code for java.lang.String  name,
                     Class sample code for java.lang.Class definition code for java.lang.Class <?> dataClass)
Constructs a new MIDI instrument from the specified Patch. When a subsequent request is made to load the instrument, the sound bank will search its contents for this instrument's Patch, and the instrument will be loaded into the synthesizer at the bank and program location indicated by the Patch object.

Parameters:
soundbank - sound bank containing the instrument
patch - the patch of this instrument
name - the name of this instrument
dataClass - the class used to represent the sample's data.
See Also:
Synthesizer.loadInstrument(Instrument) sample code for javax.sound.midi.Synthesizer.loadInstrument(javax.sound.midi.Instrument) definition code for javax.sound.midi.Synthesizer.loadInstrument(javax.sound.midi.Instrument)
Method Detail

getPatch sample code for javax.sound.midi.Instrument.getPatch() definition code for javax.sound.midi.Instrument.getPatch()

public Patch sample code for javax.sound.midi.Patch definition code for javax.sound.midi.Patch  getPatch()
Obtains the Patch object that indicates the bank and program numbers where this instrument is to be stored in the synthesizer.

Returns:
this instrument's patch