Package mars.mips.instructions.syscalls
Class SyscallMidiOut
java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallMidiOut
- All Implemented Interfaces:
Syscall
Service to output simulated MIDI tone to sound card. The call returns
immediately upon generating the tone. By contrast, syscall 33
(MidiOutSync) does not return until tone duration has elapsed.
-
Constructor Summary
ConstructorsConstructorDescriptionBuild an instance of the syscall with its default service number and name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
simulate
(BasicStatement statement) Performs syscall function to send MIDI output to sound card.Methods inherited from class mars.mips.instructions.syscalls.AbstractSyscall
getName, getNumber, setNumber
-
Constructor Details
-
SyscallMidiOut
public SyscallMidiOut()Build an instance of the syscall with its default service number and name.
-
-
Method Details
-
simulate
Performs syscall function to send MIDI output to sound card. This requires four arguments in registers $a0 through $a3.
$a0 - pitch (note). Integer value from 0 to 127, with 60 being middle-C on a piano.
$a1 - duration. Integer value in milliseconds.
$a2 - instrument. Integer value from 0 to 127, with 0 being acoustic grand piano.
$a3 - volume. Integer value from 0 to 127.
Default values, in case any parameters are outside the above ranges, are $a0=60, $a1=1000, $a2=0, $a3=100.
See MARS documentation elsewhere or www.midi.org for more information. Note that the pitch, instrument and volume value ranges 0-127 are from javax.sound.midi; actual MIDI instruments use the range 1-128.- Specified by:
simulate
in interfaceSyscall
- Specified by:
simulate
in classAbstractSyscall
- Parameters:
statement
- BasicStatement object for this syscall instruction.- Throws:
SimulatorException
-