|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.org.toot.midi.core.channel.DefaultMidiChannelWriter
public class DefaultMidiChannelWriter
This class provides a channel-based write API. Requires no state.
Constructor Summary | |
---|---|
DefaultMidiChannelWriter(MidiTransport port,
int index)
|
Method Summary | |
---|---|
void |
allNotesOff()
Turns off all notes that are currently sounding on this channel. |
void |
allSoundOff()
Immediately turns off all sounding notes on this channel, ignoring the state of the Hold Pedal and the internal decay rate of the current Instrument . |
void |
controlChange(int controller,
int value)
Reacts to a change in the specified controller's value. |
void |
encode(int command,
int data)
|
void |
encode(int command,
int data1,
int data2)
|
int |
getIndex()
|
boolean |
localControl(boolean local)
Turns local control on or off. |
void |
noteOff(int noteNumber)
Turns the specified note off. |
void |
noteOff(int noteNumber,
int velocity)
Turns the specified note off. |
void |
noteOn(int noteNumber,
int velocity)
Starts the specified note sounding. |
void |
programChange(int program)
Changes a program (patch). |
void |
programChange(int bank,
int program)
Changes the program using bank and program (patch) numbers. |
void |
resetAllControllers()
Resets all the implemented controllers to their default values. |
void |
setChannelPressure(int pressure)
Reacts to a change in the keyboard pressure. |
void |
setControl(int control,
int value)
Set the controller with the specified index to the specified value. |
void |
setMono(boolean on)
Turns mono mode on or off. |
void |
setMute(boolean mute)
Sets the mute state for this channel. |
void |
setOmni(boolean on)
Turns omni mode on or off. |
void |
setPan(int pan)
|
void |
setPitchBend(int bend)
Changes the pitch offset for all notes on this channel. |
void |
setPolyPressure(int noteNumber,
int pressure)
Reacts to a change in the specified note's key pressure. |
void |
setSolo(boolean soloState)
Sets the solo state for this channel. |
void |
setVolume(int volume)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultMidiChannelWriter(MidiTransport port, int index)
Method Detail |
---|
public int getIndex()
getIndex
in interface MidiChannelWriter
public void encode(int command, int data1, int data2)
public void encode(int command, int data)
public void setPitchBend(int bend)
The MIDI specification stipulates that pitch bend be a 14-bit value, where zero is maximum downward bend, 16383 is maximum upward bend, and 8192 is the center (no pitch bend). The actual amount of pitch change is not specified; it can be changed by a pitch-bend sensitivity setting. However, the General MIDI specification says that the default range should be two semitones up and down from center.
setPitchBend
in interface MidiChannelWriter
bend
- the amount of pitch change, as a nonnegative 14-bit value (8192 = no bend)#getPitchBend
public void setControl(int control, int value)
MidiChannelWriter
setControl
in interface MidiChannelWriter
public void noteOn(int noteNumber, int velocity)
velocity
is zero, this method instead acts like noteOff(int)
, terminating the note.
noteOn
in interface MidiChannelWriter
noteNumber
- the MIDI note number, from 0 to 127 (60 = Middle C)velocity
- the speed with which the key was depressednoteOff(int, int)
public void noteOff(int noteNumber, int velocity)
Instrument
. If the Hold Pedal (a controller; see controlChange
) is down,
the effect of this method is deferred until the pedal is released.
noteOff
in interface MidiChannelWriter
noteNumber
- the MIDI note number, from 0 to 127 (60 = Middle C)velocity
- the speed with which the key was releasednoteOff(int)
,
noteOn(int, int)
,
allNotesOff()
,
allSoundOff()
public void noteOff(int noteNumber)
noteOff
in interface MidiChannelWriter
noteNumber
- the MIDI note number, from 0 to 127 (60 = Middle C)noteOff(int, int)
public void setPolyPressure(int noteNumber, int pressure)
setPolyPressure
in interface MidiChannelWriter
noteNumber
- the MIDI note number, from 0 to 127 (60 = Middle C)pressure
- value for the specified key, from 0 to 127 (127 = maximum pressure)#getPolyPressure(int)
public void setChannelPressure(int pressure)
setPolyPressure
. More commonly, it is a measurement of
a single sensor on a device that doesn't implement polyphonic key pressure. Pressure can be used to control various
aspects of the sound, as described under setPolyPressure
.
setChannelPressure
in interface MidiChannelWriter
pressure
- the pressure with which the keyboard is being depressed, from 0 to 127 (127 = maximum pressure)setPolyPressure(int, int)
,
#getChannelPressure
public void controlChange(int controller, int value)
Instrument
reacts to a controller change may be
specific to the Instrument
. The MIDI 1.0 Specification defines both 7-bit controllers and 14-bit controllers. Continuous controllers, such as wheels and sliders, typically have 14 bits (two MIDI bytes), while discrete controllers, such as switches, typically have 7 bits (one MIDI byte). Refer to the specification to see the expected resolution for each type of control.
Controllers 64 through 95 (0x40 - 0x5F) allow 7-bit precision.
The value of a 7-bit controller is set completely by the value
argument. An additional set of controllers
provide 14-bit precision by using two controller numbers, one for the most significant 7 bits and another for the least
significant 7 bits. Controller numbers 0 through 31 (0x00 - 0x1F) control the
most significant 7 bits of 14-bit controllers; controller numbers
32 through 63 (0x20 - 0x3F) control the least significant 7 bits of
these controllers. For example, controller number 7 (0x07) controls
the upper 7 bits of the channel volume controller, and controller number 39 (0x27) controls the lower 7 bits.
The value of a 14-bit controller is determined by the interaction of the two halves. When the most significant 7 bits
of a controller are set (using controller numbers 0 through 31), the
lower 7 bits are automatically set to 0. The corresponding controller
number for the lower 7 bits may then be used to further modulate the controller value.
controlChange
in interface MidiChannelWriter
controller
- the controller number (0 to 127; see the MIDI 1.0 Specification for the interpretation)value
- the value to which the specified controller is changed (0 to 127)#getController(int)
public void programChange(int program)
The MIDI specification does not dictate whether notes that are already sounding should switch to the new instrument (timbre) or continue with their original timbre until terminated by a note-off.
The program number is zero-based (expressed from 0 to 127). Note that MIDI hardware displays and literature about MIDI typically use the range 1 to 128 instead.
programChange
in interface MidiChannelWriter
program
- the program number to switch to (0 to 127)programChange(int, int)
,
#getProgram()
public void programChange(int bank, int program)
programChange
in interface MidiChannelWriter
bank
- the bank number to switch to (0 to 16383)program
- the program (patch) to use in the specified bank (0 to 127)programChange(int)
,
#getProgram()
public void resetAllControllers()
resetAllControllers
in interface MidiChannelWriter
controlChange(int, int)
public void allNotesOff()
Instrument
.
If the Hold Pedal controller (see controlChange
) is down, the effect of this method is
deferred until the pedal is released.
allNotesOff
in interface MidiChannelWriter
allSoundOff()
,
noteOff(int)
public void allSoundOff()
Instrument
.
allSoundOff
in interface MidiChannelWriter
allNotesOff()
public boolean localControl(boolean local)
localControl
in interface MidiChannelWriter
local
- true
to turn local control on, false
to turn local control off
public void setVolume(int volume)
setVolume
in interface MidiChannelWriter
public void setPan(int pan)
setPan
in interface MidiChannelWriter
public void setMono(boolean on)
"Mono" is short for the word "monophonic," which in this context is opposed to the word "polyphonic" and refers to a single synthesizer voice per MIDI channel. It has nothing to do with how many audio channels there might be (as in "monophonic" versus "stereophonic" recordings).
setMono
in interface MidiChannelWriter
on
- true
to turn mono mode on, false
to turn it off (which means turning poly mode on).#getMono
public void setOmni(boolean on)
setOmni
in interface MidiChannelWriter
on
- true
to turn omni mode on, false
to turn it off.#getOmni
public void setMute(boolean mute)
true
means the channel is to be muted, false
means the channel can sound (if other channels are not soloed). Unlike allSoundOff()
, this method
applies to only a specific channel, not to all channels. Further, it
silences not only currently sounding notes, but also subsequently received notes.
setMute
in interface MidiChannelWriter
mute
- the new mute state#getMute
,
setSolo(boolean)
public void setSolo(boolean soloState)
solo
is true
only this channel
and other soloed channels will sound. If solo
is false
then only other soloed channels will
sound, unless no channels are soloed, in which case all unmuted channels will sound.
setSolo
in interface MidiChannelWriter
soloState
- new solo state for the channel#getSolo
,
setMute(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |