Class MIDIFileEvent

java.lang.Object
com.softsynth.midifile.MIDIFileEvent
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
MIDIFileSysExEvent

public class MIDIFileEvent
extends java.lang.Object
implements java.lang.Cloneable
Contains information for an event found in a MIDIFile
Author:
Phil Burk (C) 1999 SoftSynth.com
  • Field Summary

    Fields
    Modifier and Type Field Description
    int command  
    int data1  
    int data2  
  • Constructor Summary

    Constructors
    Constructor Description
    MIDIFileEvent​(int ticks, int command, int data1, int data2)
    Create an event to store a basic MIDI Message
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object clone()
    Clones contents of event.
    int getChannel()
    Returns (command&0x0F)+1.
    int getCommand()
    Returns entire command byte, eg.
    double getSeconds()  
    int getTicks()
    Returns time in ticks.
    void setSeconds​(double seconds)
    Set time in seconds.
    void setTicks​(int ticks)
    Set time in ticks.
    java.lang.String toString()  
    void write​(MIDIFileOutput mfout)
    Write a MIDIFileEvent to a MIDIFile on disk.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • command

      public int command
    • data1

      public int data1
    • data2

      public int data2
  • Constructor Details

    • MIDIFileEvent

      public MIDIFileEvent​(int ticks, int command, int data1, int data2)
      Create an event to store a basic MIDI Message
      Parameters:
      ticks - MIDIFile time-stamp
      command - MIDI Command, eg. NOTE_ON.
      data1 - First data byte of message.
      data2 - Second optional data byte of message.
  • Method Details

    • setTicks

      public void setTicks​(int ticks)
      Set time in ticks.
    • getTicks

      public int getTicks()
      Returns time in ticks.
    • setSeconds

      public void setSeconds​(double seconds)
      Set time in seconds.
    • getSeconds

      public double getSeconds()
    • getCommand

      public int getCommand()
      Returns entire command byte, eg. 0x93
    • getChannel

      public int getChannel()
      Returns (command&0x0F)+1. Only valid for ChannelMessages
    • write

      public void write​(MIDIFileOutput mfout) throws java.io.IOException
      Write a MIDIFileEvent to a MIDIFile on disk.
      Throws:
      java.io.IOException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • clone

      public java.lang.Object clone()
      Clones contents of event.