Package mars.mips.instructions.syscalls
Class MidiNotePlayer
java.lang.Object
mars.mips.instructions.syscalls.MidiNotePlayer
Used by the MIDI syscalls to play MIDI notes on demand.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default MIDI channel of the tone: 0 (channel 1).static final int
The default duration of the tone: 1000 milliseconds.static final byte
The default instrument of the tone: 0 / piano.static final byte
The default pitch value for the tone: 60 / middle C.static final byte
The default volume of the tone: 100 (of 127). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ScheduledFuture<?>
playNote
(int pitch, int duration, int instrument, int volume) Play a note with the specified pitch, duration, and instrument, and volume, returning immediately.
-
Field Details
-
DEFAULT_PITCH
public static final byte DEFAULT_PITCHThe default pitch value for the tone: 60 / middle C.- See Also:
-
DEFAULT_DURATION
public static final int DEFAULT_DURATIONThe default duration of the tone: 1000 milliseconds.- See Also:
-
DEFAULT_INSTRUMENT
public static final byte DEFAULT_INSTRUMENTThe default instrument of the tone: 0 / piano.- See Also:
-
DEFAULT_VOLUME
public static final byte DEFAULT_VOLUMEThe default volume of the tone: 100 (of 127).- See Also:
-
DEFAULT_CHANNEL
public static final int DEFAULT_CHANNELThe default MIDI channel of the tone: 0 (channel 1).- See Also:
-
-
Constructor Details
-
MidiNotePlayer
public MidiNotePlayer()
-
-
Method Details
-
playNote
Play a note with the specified pitch, duration, and instrument, and volume, returning immediately.- Parameters:
pitch
- The desired pitch in semitones - 0-127 where 60 is middle C.duration
- The desired duration in milliseconds.instrument
- The desired instrument (or patch) represented by a positive byte value (0-127). See the general MIDI instrument patch map for more instruments associated with each value.volume
- The desired volume of the initial attack of the note (MIDI velocity) represented by a positive byte value (0-127).
-