|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.hogent.tarsos.midi.TarsosSynth
public class TarsosSynth
A singleton that interfaces with a real underlying synthesizer, it acts as an interface that distributes MIDI messages. It sends pitch bends and note on events on one channel (PITCH_BEND_MIDI_CHANNEL) and MIDI tuning dumps on an other channel (TUNED_MIDI_CHANNEL). This is to keep them from interfering with each other. This class also listens to changes in the configured synthesizer or instrument.
Field Summary | |
---|---|
static int |
TUNED_MIDI_CHANNEL
The channel used to tune a keyboard and send messages. |
Constructor Summary | |
---|---|
TarsosSynth()
Listen to configuration changes. |
Method Summary | |
---|---|
void |
addReceiver(javax.sound.midi.Receiver receiver)
Adds a receiver to the underlying list of receivers. |
java.util.List<java.lang.String> |
availableInstruments()
|
void |
close()
|
void |
configurationChanged(ConfKey key)
Fires when a configuration setting changes. |
static TarsosSynth |
getInstance()
|
void |
noteOff(int midiKey,
int channel)
Send a note off message to the MIDI key. |
void |
noteOn(int midiKey,
int velocity,
int channel)
Send a Note ON message to a MIDI key with a velocity. |
void |
pitchBend(double deviationInCents)
Send a pitch bend message to the channel. |
void |
playAbsoluteCents(double absoluteCent,
int velocity)
Send a MIDI pitch bend and a MIDI note ON OFF pair to render a certain value in absolute cents. |
void |
playRelativeCents(double relativeCents,
int velocity)
Play a pitch bended note defined by relative cents and a velocity. |
void |
setDefaultReceiver()
|
void |
tune(double[] tuning)
Tune the receiver with the MIDI Tuning Standard. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TUNED_MIDI_CHANNEL
Constructor Detail |
---|
public TarsosSynth()
Method Detail |
---|
public void setDefaultReceiver()
public void playRelativeCents(double relativeCents, int velocity)
relativeCents
- The relative cents pitch to play. This could be a number
between [0,1200] but it is actually possible to play any
velocity
- The MIDI key velocity. A value in [0,127].public void playAbsoluteCents(double absoluteCent, int velocity)
absoluteCent
- The value in absolute cents.velocity
- The velocity of the note on message.public void pitchBend(double deviationInCents)
deviationInCents
- The deviation in cents. Can be positive or negative but some
synthesizers only support positive pitch bend messages.public void noteOn(int midiKey, int velocity, int channel)
midiKey
- The MIDI key number.velocity
- The velocity of the note on message.channel
- The MIDI channel (0-16).public void noteOff(int midiKey, int channel)
midiKey
- The MIDI key to send the note off message to.channel
- The MIDI channel (0-16).public void tune(double[] tuning)
tuning
- public void addReceiver(javax.sound.midi.Receiver receiver)
receiver
- The receiver to add.public void configurationChanged(ConfKey key)
Configuration.ConfigChangeListener
configurationChanged
in interface Configuration.ConfigChangeListener
key
- The changed configuration setting.public java.util.List<java.lang.String> availableInstruments()
public void close()
public static TarsosSynth getInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |