Package net.mtrop.doom.sound
Class MUS
java.lang.Object
net.mtrop.doom.sound.MUS
- All Implemented Interfaces:
Iterable<MUS.Event>
,BinaryObject
Abstraction of MUS formatted music sequence data.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Controller Change event.static class
Individual events.static class
Note play event.static class
Note release event.static class
Pitch wheel event.static class
Score ending event.class
A MUS Player sequencer.static interface
A listener for the player.static class
System event.Nested classes/interfaces inherited from interface net.mtrop.doom.object.BinaryObject
BinaryObject.InlineScanner<BO extends BinaryObject>, BinaryObject.Reflect, BinaryObject.Scanner<BO extends BinaryObject>, BinaryObject.Shared, BinaryObject.Transformer<BO extends BinaryObject>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getInstrumentPatch
(int index) Gets an instrument patch to preload.int
int
int
getSequencer
(MUS.SequencerListener listener) Gets a new sequencer object for playing through an MUS's event sequence, tic by tic.iterator()
void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
writeBytes
(OutputStream out) Writes this object to anOutputStream
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.mtrop.doom.object.BinaryObject
fromBytes, readFile, toBytes, writeFile, writeFile
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
MUS_ID
public static final byte[] MUS_ID -
NOTE_NAMES
-
SYSTEM_EVENT_NAME
-
CONTROLLER_NAME
-
INSTRUMENT_NAME
-
DRUM_INSTRUMENT_NAME
-
CHANNEL_DRUM
public static final int CHANNEL_DRUM- See Also:
-
-
Constructor Details
-
MUS
public MUS()Creates a blank MUS lump with no events.
-
-
Method Details
-
getPrimaryChannelCount
public int getPrimaryChannelCount()- Returns:
- the amount of primary channels (from channel 0).
-
getSecondaryChannelCount
public int getSecondaryChannelCount()- Returns:
- the amount of secondary channels (from channel 10).
-
getInstrumentPatchCount
public int getInstrumentPatchCount()- Returns:
- the amount of instrument patches.
-
getInstrumentPatch
public int getInstrumentPatch(int index) Gets an instrument patch to preload.- Parameters:
index
- the instrument patch list index.- Returns:
- the instrument at the corresponding index.
- Throws:
ArrayIndexOutOfBoundsException
- of index is < 0 or >getInstrumentPatchCount()
.
-
getSequencer
Gets a new sequencer object for playing through an MUS's event sequence, tic by tic.- Parameters:
listener
- the listener to emit events to per tic.- Returns:
- a new Sequencer.
- See Also:
-
iterator
-
readBytes
Description copied from interface:BinaryObject
Reads from anInputStream
and sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!- Specified by:
readBytes
in interfaceBinaryObject
- Parameters:
in
- theInputStream
to read from.- Throws:
IOException
- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObject
Writes this object to anOutputStream
.- Specified by:
writeBytes
in interfaceBinaryObject
- Parameters:
out
- theOutputStream
to write to.- Throws:
IOException
- if a write error occurs.
-