com.vwp.sound.mod.modplay.loader
Class ModUnits

java.lang.Object
  extended by com.vwp.sound.mod.modplay.loader.ModUnits
All Implemented Interfaces:
ModuleUnits

public class ModUnits
extends Object
implements ModuleUnits

Conversions between notes, rates and periods used by .MODs

Author:
torkjel

Field Summary
static String NAME
           
static double NEW_MAX_PERIOD
          The "new" maximum period
static double NEW_MIN_PERIOD
          The "new" minimum period
static double NTSC
          the clock frequency used by NTSC amiga machines
static double PAL
          the clock frequency used by PAL amiga machines
static double TRADITIONAL_MAX_PERIOD
          The traditional maximum period
static double TRADITIONAL_MIN_PERIOD
          The traditional minimum period
 
Constructor Summary
ModUnits(double amigaClock, boolean traditional)
           
 
Method Summary
 double addPeriod(double note, double period)
          adds a period value to a note value
 double getAmigaClock()
           
 double getLowerNoteLimit()
          gets the lowest note that can be played in a module
 String getName()
           
 double getUpperNoteLimit()
          gets the highest note that can be played in a module
 double note2period(double note)
          converts a note value to a period value
 double note2rate(double note)
          converts a note value to a rate value
 double period2note(double period)
          converts a period value to a note value
 double period2rate(double period)
           
 double rate2note(double rate)
          converts a rate value to a note value
 double rate2period(double rate)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values

TRADITIONAL_MAX_PERIOD

public static final double TRADITIONAL_MAX_PERIOD
The traditional maximum period

See Also:
Constant Field Values

TRADITIONAL_MIN_PERIOD

public static final double TRADITIONAL_MIN_PERIOD
The traditional minimum period

See Also:
Constant Field Values

NEW_MAX_PERIOD

public static final double NEW_MAX_PERIOD
The "new" maximum period

See Also:
Constant Field Values

NEW_MIN_PERIOD

public static final double NEW_MIN_PERIOD
The "new" minimum period

See Also:
Constant Field Values

PAL

public static final double PAL
the clock frequency used by PAL amiga machines

See Also:
Constant Field Values

NTSC

public static final double NTSC
the clock frequency used by NTSC amiga machines

See Also:
Constant Field Values
Constructor Detail

ModUnits

public ModUnits(double amigaClock,
                boolean traditional)
Parameters:
amigaClock - the clock-frequency of the machine where the module was created
traditional - if true: use traditional octaves 1 - 3, if false: use octaves 0 - 4
Method Detail

period2rate

public double period2rate(double period)

rate2period

public double rate2period(double rate)

period2note

public double period2note(double period)
Description copied from interface: ModuleUnits
converts a period value to a note value

Specified by:
period2note in interface ModuleUnits

note2period

public double note2period(double note)
Description copied from interface: ModuleUnits
converts a note value to a period value

Specified by:
note2period in interface ModuleUnits

note2rate

public double note2rate(double note)
Description copied from interface: ModuleUnits
converts a note value to a rate value

Specified by:
note2rate in interface ModuleUnits

rate2note

public double rate2note(double rate)
Description copied from interface: ModuleUnits
converts a rate value to a note value

Specified by:
rate2note in interface ModuleUnits

addPeriod

public double addPeriod(double note,
                        double period)
Description copied from interface: ModuleUnits
adds a period value to a note value

Specified by:
addPeriod in interface ModuleUnits

getUpperNoteLimit

public double getUpperNoteLimit()
Description copied from interface: ModuleUnits
gets the highest note that can be played in a module

Specified by:
getUpperNoteLimit in interface ModuleUnits

getLowerNoteLimit

public double getLowerNoteLimit()
Description copied from interface: ModuleUnits
gets the lowest note that can be played in a module

Specified by:
getLowerNoteLimit in interface ModuleUnits

getAmigaClock

public double getAmigaClock()

getName

public String getName()
Specified by:
getName in interface ModuleUnits