Package net.mtrop.doom.sound
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
Individual events.
-
Field Summary
Modifier and TypeFieldDescriptionprotected 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
ModifierConstructorDescriptionprotected
Event
(int type, int channel, int restTics) Creates a new MUS event. -
Method Summary
Modifier and TypeMethodDescriptionint
int
Gets the amount of tics in the rest period.int
getType()
boolean
isLast()
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[]
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
- iftype
is 5 or not between 0 and 6, orchannel
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
- ifchannel
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 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.
-