mars.mips.instructions.syscalls
Class SyscallMidiOutSync

java.lang.Object
  extended by mars.mips.instructions.syscalls.AbstractSyscall
      extended by mars.mips.instructions.syscalls.SyscallMidiOutSync
All Implemented Interfaces:
Syscall

public class SyscallMidiOutSync
extends AbstractSyscall

Service to output simulated MIDI tone to sound card. The call does not return until the tone duration has elapsed. By contrast, syscall 31 (MidiOut) returns immediately upon generating the tone.


Constructor Summary
SyscallMidiOutSync()
          Build an instance of the MIDI (simulated) out syscall.
 
Method Summary
 void simulate(ProgramStatement statement)
          Performs syscall function to send MIDI output to sound card.
 
Methods inherited from class mars.mips.instructions.syscalls.AbstractSyscall
getName, getNumber, setNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyscallMidiOutSync

public SyscallMidiOutSync()
Build an instance of the MIDI (simulated) out syscall. Default service number is 33 and name is "MidiOutSync".

Method Detail

simulate

public void simulate(ProgramStatement statement)
              throws ProcessingException
Performs syscall function to send MIDI output to sound card. The syscall does not return until after the duration period ($a1) has elapsed. 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