micromod
Class ModuleLoader

java.lang.Object
  extended bymicromod.ModuleLoader

public class ModuleLoader
extends java.lang.Object


Nested Class Summary
protected static class ModuleLoader.ModFormatInfo
          A type for the module format information.
 
Constructor Summary
ModuleLoader()
           
 
Method Summary
protected static ModuleLoader.ModFormatInfo getFormatInfo(java.lang.String id)
           
static boolean identify(java.io.DataInput modStream)
           
protected static byte nibbleDecimal2Bin(byte decValue)
          Return a 2-digit decimal value written as hex as a binary number.
static Module read(java.io.DataInput dataInput)
           
protected static Instrument readInstrument(java.io.DataInput dataInput)
          Read in the data for an Instrument, and return a new Instrument containing that data.
protected static Sequence.Pattern readPattern(java.io.DataInput dataInput, int numChannels)
          Read the data for a Pattern into a new Pattern object and return it.
protected static void readSampleData(Instrument instrument, java.io.DataInput dataInput)
          Read the number of bytes specified by the Instrument's sampleLength field into the Instrument's data array, and zero the first 2 samples, as ProTracker is supposed to do (According to Lars Hamre's modspec.txt)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleLoader

public ModuleLoader()
Method Detail

identify

public static boolean identify(java.io.DataInput modStream)
                        throws java.io.IOException
Returns:
true if stream contains a valid MOD file.
Throws:
java.io.IOException

read

public static Module read(java.io.DataInput dataInput)
                   throws java.io.IOException,
                          java.lang.IllegalArgumentException
Throws:
java.io.IOException
java.lang.IllegalArgumentException

getFormatInfo

protected static ModuleLoader.ModFormatInfo getFormatInfo(java.lang.String id)
                                                   throws java.lang.IllegalArgumentException
Returns:
Bits 0-11 gives number of channels, bit 12 is set if format uses the panning commands. Returns zero if mod is unrecognized.
Throws:
java.lang.IllegalArgumentException

readPattern

protected static Sequence.Pattern readPattern(java.io.DataInput dataInput,
                                              int numChannels)
                                       throws java.io.IOException
Read the data for a Pattern into a new Pattern object and return it.

Throws:
java.io.IOException

readInstrument

protected static Instrument readInstrument(java.io.DataInput dataInput)
                                    throws java.io.IOException
Read in the data for an Instrument, and return a new Instrument containing that data.

Throws:
java.io.IOException

readSampleData

protected static void readSampleData(Instrument instrument,
                                     java.io.DataInput dataInput)
                              throws java.io.IOException
Read the number of bytes specified by the Instrument's sampleLength field into the Instrument's data array, and zero the first 2 samples, as ProTracker is supposed to do (According to Lars Hamre's modspec.txt)

Throws:
java.io.IOException

nibbleDecimal2Bin

protected static byte nibbleDecimal2Bin(byte decValue)
Return a 2-digit decimal value written as hex as a binary number.