com.vwp.sound.mod.modplay.player
Class TrackState

java.lang.Object
  extended by com.vwp.sound.mod.modplay.player.TrackState

public class TrackState
extends java.lang.Object

Together with ModuleState this is the heart of JMOD. TrackState represents the state of a track in the module. It deals with local effects, notes and instruments started in a track.


Constructor Summary
TrackState(ModuleState moduleState, Module module, Mixer mixer, int trackNumber)
           
 
Method Summary
 void doEffects(int pattern, int division, int tick)
          do the effects
 int getInstrument()
           
 Module getModule()
           
 ModuleState getModuleState()
           
 int getNote()
           
 Sample getSample()
           
 double getVolume()
           
 void loadTick(int pattern, int division, int tick)
          load new intruments, notes and autoeffects, and do whatever needs to be done to volume and panning
 void postEffects(int pattern, int division, int tick)
          the effects may need to do some stuff after a tick is played
 void preEffect(int pattern, int division, int tick)
          the effects may need to do some stuff before a tick is played
 void setEnvelopePanning(double envPan)
          sets the envelope panning for this track
 void setEnvelopePosition(int pos)
          sets the current position in any volume/panning envelope for the instrument playing in this track
 void setEnvelopeVolume(double envVol)
          sets the envelope volume for this track
 void setFadeoutVolume(double fadeVol)
           
 void setFineTune(double tune)
          sets the finetune
 void setPanning(double pan)
          sets the panning used by this track
 void setSampleDelay(int delay)
          sets the delay of the sample playing in this track
 void setSampleOffset(double offset)
          sets the current position in the sample playing in this track
 void setupMixer(int pattern, int division, int tick, double time)
          Initialize the mixer for playing this track volume formula used: volume = (trackVolume + volumeSlide + volumeTune) * envelopeVolume * fadeoutVolume panning formula used: p = panning + effects.panningSlide panning = p + min(p,1-p) * (envelopePanning - 0.5) * 2 the rate is calculated in a format specific way using: note + fineTune + relativeNote + noteTune + noteSlide
 void setVolume(double vol)
          sets the volume of this track
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackState

public TrackState(ModuleState moduleState,
                  Module module,
                  Mixer mixer,
                  int trackNumber)
Parameters:
moduleState - the associated module state
module - the module being played
mixer - the mixer
trackNumber - the track number of this track
Method Detail

preEffect

public void preEffect(int pattern,
                      int division,
                      int tick)
the effects may need to do some stuff before a tick is played

Parameters:
pattern - the current pattern position
division - the current division
tick - the current tick

loadTick

public void loadTick(int pattern,
                     int division,
                     int tick)
load new intruments, notes and autoeffects, and do whatever needs to be done to volume and panning

Parameters:
pattern -
division -
tick -

doEffects

public void doEffects(int pattern,
                      int division,
                      int tick)
do the effects

Parameters:
pattern - current
division -
tick -

setupMixer

public void setupMixer(int pattern,
                       int division,
                       int tick,
                       double time)
                throws PlayerException
Initialize the mixer for playing this track volume formula used: volume = (trackVolume + volumeSlide + volumeTune) * envelopeVolume * fadeoutVolume panning formula used: p = panning + effects.panningSlide panning = p + min(p,1-p) * (envelopePanning - 0.5) * 2 the rate is calculated in a format specific way using: note + fineTune + relativeNote + noteTune + noteSlide

Parameters:
pattern -
division -
tick -
time -
Throws:
PlayerException

postEffects

public void postEffects(int pattern,
                        int division,
                        int tick)
the effects may need to do some stuff after a tick is played

Parameters:
pattern -
division -
tick -

getModuleState

public ModuleState getModuleState()
Returns:
the modulestate associated with this trackstate

getModule

public Module getModule()
Returns:
the module played

setVolume

public void setVolume(double vol)
sets the volume of this track

Parameters:
vol - new volume

getVolume

public double getVolume()
Returns:
the volume of this track

setPanning

public void setPanning(double pan)
sets the panning used by this track

Parameters:
pan - the new panning

setFineTune

public void setFineTune(double tune)
sets the finetune

Parameters:
tune -

setSampleOffset

public void setSampleOffset(double offset)
sets the current position in the sample playing in this track

Parameters:
offset -

setSampleDelay

public void setSampleDelay(int delay)
sets the delay of the sample playing in this track

Parameters:
delay -

setEnvelopePosition

public void setEnvelopePosition(int pos)
sets the current position in any volume/panning envelope for the instrument playing in this track

Parameters:
pos -

getNote

public int getNote()
Returns:
the note playing in this track

setEnvelopePanning

public void setEnvelopePanning(double envPan)
sets the envelope panning for this track

Parameters:
envPan -

setEnvelopeVolume

public void setEnvelopeVolume(double envVol)
sets the envelope volume for this track

Parameters:
envVol -

setFadeoutVolume

public void setFadeoutVolume(double fadeVol)
Parameters:
fadeVol -

getSample

public Sample getSample()

getInstrument

public int getInstrument()