Class SyscallMidiOutSync

java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
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 Details

    • SyscallMidiOutSync

      public SyscallMidiOutSync()
      Build an instance of the syscall with its default service number and name.
  • Method Details

    • simulate

      public void simulate(BasicStatement statement) throws SimulatorException, InterruptedException
      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 - BasicStatement object for this syscall instruction.
      Throws:
      SimulatorException
      InterruptedException