mars.mips.instructions.syscalls
Class SyscallMidiOut
java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallMidiOut
- All Implemented Interfaces:
- Syscall
public class SyscallMidiOut
- extends AbstractSyscall
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 |
SyscallMidiOut()
Build an instance of the MIDI (simulated) out syscall. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SyscallMidiOut
public SyscallMidiOut()
- Build an instance of the MIDI (simulated) out syscall. Default service number
is 31 and name is "MidiOut".
simulate
public void simulate(ProgramStatement statement)
throws ProcessingException
- 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 interface Syscall
- Specified by:
simulate
in class AbstractSyscall
- Parameters:
statement
- ProgramStatement object for this syscall instruction.
- Throws:
ProcessingException