javax.sound.midi
Class Patch

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

public class Patch
extends Object sample code for java.lang.Object definition code for java.lang.Object

A Patch object represents a location, on a MIDI synthesizer, into which a single instrument is stored (loaded). Every Instrument object has its own Patch object that specifies the memory location into which that instrument should be loaded. The location is specified abstractly by a bank index and a program number (not by any scheme that directly refers to a specific address or offset in RAM). This is a hierarchical indexing scheme: MIDI provides for up to 16384 banks, each of which contains up to 128 program locations. For example, a minimal sort of synthesizer might have only one bank of instruments, and only 32 instruments (programs) in that bank.

To select what instrument should play the notes on a particular MIDI channel, two kinds of MIDI message are used that specify a patch location: a bank-select command, and a program-change channel command. The Java Sound equivalent is the programChange(int, int) sample code for javax.sound.midi.MidiChannel.programChange(int, int) definition code for javax.sound.midi.MidiChannel.programChange(int, int) method of MidiChannel.

See Also:
Instrument sample code for javax.sound.midi.Instrument definition code for javax.sound.midi.Instrument , Instrument.getPatch() sample code for javax.sound.midi.Instrument.getPatch() definition code for javax.sound.midi.Instrument.getPatch() , MidiChannel.programChange(int, int) sample code for javax.sound.midi.MidiChannel.programChange(int, int) definition code for javax.sound.midi.MidiChannel.programChange(int, int) , Synthesizer.loadInstruments(Soundbank, Patch[]) sample code for javax.sound.midi.Synthesizer.loadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[]) definition code for javax.sound.midi.Synthesizer.loadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[]) , Soundbank sample code for javax.sound.midi.Soundbank definition code for javax.sound.midi.Soundbank , Sequence.getPatchList() sample code for javax.sound.midi.Sequence.getPatchList() definition code for javax.sound.midi.Sequence.getPatchList()

Constructor Summary
Patch sample code for javax.sound.midi.Patch.Patch(int, int) definition code for javax.sound.midi.Patch.Patch(int, int) (int bank, int program)
          Constructs a new patch object from the specified bank and program numbers.
 
Method Summary
 int getBank sample code for javax.sound.midi.Patch.getBank() definition code for javax.sound.midi.Patch.getBank() ()
          Returns the number of the bank that contains the instrument whose location this Patch specifies.
 int getProgram sample code for javax.sound.midi.Patch.getProgram() definition code for javax.sound.midi.Patch.getProgram() ()
          Returns the index, within a bank, of the instrument whose location this Patch specifies.
 
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

Patch sample code for javax.sound.midi.Patch(int, int) definition code for javax.sound.midi.Patch(int, int)

public Patch(int bank,
             int program)
Constructs a new patch object from the specified bank and program numbers.

Parameters:
bank - the bank index (in the range from 0 to 16383)
program - the program index (in the range from 0 to 127)
Method Detail

getBank sample code for javax.sound.midi.Patch.getBank() definition code for javax.sound.midi.Patch.getBank()

public int getBank()
Returns the number of the bank that contains the instrument whose location this Patch specifies.

Returns:
the bank number, whose range is from 0 to 16383
See Also:
MidiChannel.programChange(int, int) sample code for javax.sound.midi.MidiChannel.programChange(int, int) definition code for javax.sound.midi.MidiChannel.programChange(int, int)

getProgram sample code for javax.sound.midi.Patch.getProgram() definition code for javax.sound.midi.Patch.getProgram()

public int getProgram()
Returns the index, within a bank, of the instrument whose location this Patch specifies.

Returns:
the instrument's program number, whose range is from 0 to 127
See Also:
MidiChannel.getProgram() sample code for javax.sound.midi.MidiChannel.getProgram() definition code for javax.sound.midi.MidiChannel.getProgram() , MidiChannel.programChange(int) sample code for javax.sound.midi.MidiChannel.programChange(int) definition code for javax.sound.midi.MidiChannel.programChange(int) , MidiChannel.programChange(int, int) sample code for javax.sound.midi.MidiChannel.programChange(int, int) definition code for javax.sound.midi.MidiChannel.programChange(int, int)