Class MUS.Event

java.lang.Object
net.mtrop.doom.sound.MUS.Event
Direct Known Subclasses:
MUS.ControllerChangeEvent, MUS.NotePlayEvent, MUS.NoteReleaseEvent, MUS.PitchEvent, MUS.ScoreEndEvent, MUS.SystemEvent
Enclosing class:
MUS

public abstract static class MUS.Event extends Object
Individual events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    Event channel.
    protected int
    Time to rest in tics.
    protected int
    Event type.
    static final int
    Controller change event.
    static final int
    Pitch slide event.
    static final int
    Play note event.
    static final int
    Release note event.
    static final int
    Score end event.
    static final int
    System event event.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Event(int type, int channel, int restTics)
    Creates a new MUS event.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    Gets the amount of tics in the rest period.
    int
     
    boolean
    Checks if this is the last event in a group, before a rest needs to be taken?
    void
    setChannel(int channel)
    Sets this Event's channel.
    void
    setRestTics(int restTics)
    Sets the amount of tics in the rest period.
    abstract byte[]
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TYPE_RELEASE

      public static final int TYPE_RELEASE
      Release note event.
      See Also:
    • TYPE_PLAY

      public static final int TYPE_PLAY
      Play note event.
      See Also:
    • TYPE_PITCH

      public static final int TYPE_PITCH
      Pitch slide event.
      See Also:
    • TYPE_SYSTEM

      public static final int TYPE_SYSTEM
      System event event.
      See Also:
    • TYPE_CHANGE_CONTROLLER

      public static final int TYPE_CHANGE_CONTROLLER
      Controller change event.
      See Also:
    • TYPE_SCORE_END

      public static final int TYPE_SCORE_END
      Score end event.
      See Also:
    • type

      protected int type
      Event type.
    • channel

      protected int channel
      Event channel.
    • restTics

      protected int restTics
      Time to rest in tics.
  • Constructor Details

    • Event

      protected Event(int type, int channel, int restTics)
      Creates a new MUS event.
      Parameters:
      type - Event type. Must be valid EVENT_TYPE.
      channel - Event channel.
      restTics - The amount of tics before the next event gets processed.
      Throws:
      IllegalArgumentException - if type is 5 or not between 0 and 6, or channel is not between 0 and 15.
  • Method Details

    • getType

      public int getType()
      Returns:
      this Event's type.
    • getChannel

      public int getChannel()
      Returns:
      this Event's channel.
    • setChannel

      public void setChannel(int channel)
      Sets this Event's channel.
      Parameters:
      channel - the channel number.
      Throws:
      IllegalArgumentException - if channel is not between 0 and 15.
    • isLast

      public boolean isLast()
      Checks if this is the last event in a group, before a rest needs to be taken?
      Returns:
      true if so, false if not.
    • getRestTics

      public int getRestTics()
      Gets the amount of tics in the rest period. Only valid if isLast() is true.
      Returns:
      the amount of rest tics.
    • setRestTics

      public void setRestTics(int restTics)
      Sets the amount of tics in the rest period. Only valid if isLast() is true.
      Parameters:
      restTics - the new amount of rest tics.
    • toBytes

      public abstract byte[] toBytes()
      Returns:
      this event to a serialized byte form.