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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intEvent channel.protected intTime to rest in tics.protected intEvent type.static final intController change event.static final intPitch slide event.static final intPlay note event.static final intRelease note event.static final intScore end event.static final intSystem event event. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEvent(int type, int channel, int restTics) Creates a new MUS event. -
Method Summary
Modifier and TypeMethodDescriptionintintGets the amount of tics in the rest period.intgetType()booleanisLast()Checks if this is the last event in a group, before a rest needs to be taken?voidsetChannel(int channel) Sets this Event's channel.voidsetRestTics(int restTics) Sets the amount of tics in the rest period.abstract byte[]toBytes()
-
Field Details
-
TYPE_RELEASE
public static final int TYPE_RELEASERelease note event.- See Also:
-
TYPE_PLAY
public static final int TYPE_PLAYPlay note event.- See Also:
-
TYPE_PITCH
public static final int TYPE_PITCHPitch slide event.- See Also:
-
TYPE_SYSTEM
public static final int TYPE_SYSTEMSystem event event.- See Also:
-
TYPE_CHANGE_CONTROLLER
public static final int TYPE_CHANGE_CONTROLLERController change event.- See Also:
-
TYPE_SCORE_END
public static final int TYPE_SCORE_ENDScore end event.- See Also:
-
type
protected int typeEvent type. -
channel
protected int channelEvent channel. -
restTics
protected int restTicsTime 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- iftypeis 5 or not between 0 and 6, orchannelis 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- ifchannelis 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 ifisLast()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 ifisLast()is true.- Parameters:
restTics- the new amount of rest tics.
-
toBytes
public abstract byte[] toBytes()- Returns:
- this event to a serialized byte form.
-