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
Nested ClassesModifier and TypeClassDescriptionstatic classController Change event.static classIndividual events.static classNote play event.static classNote release event.static classPitch wheel event.static classScore ending event.classA MUS Player sequencer.static interfaceA listener for the player.static classSystem 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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetInstrumentPatch(int index) Gets an instrument patch to preload.intintintgetSequencer(MUS.SequencerListener listener) Gets a new sequencer object for playing through an MUS's event sequence, tic by tic.iterator()voidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.voidwriteBytes(OutputStream out) Writes this object to anOutputStream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.mtrop.doom.object.BinaryObject
fromBytes, readFile, toBytes, writeFile, writeFileMethods 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:BinaryObjectReads from anInputStreamand 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:
readBytesin interfaceBinaryObject- Parameters:
in- theInputStreamto read from.- Throws:
IOException- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObjectWrites this object to anOutputStream.- Specified by:
writeBytesin interfaceBinaryObject- Parameters:
out- theOutputStreamto write to.- Throws:
IOException- if a write error occurs.
-