com.vwp.sound.mod.modplay
Class Player

java.lang.Object
  extended by com.vwp.sound.mod.modplay.Player
Direct Known Subclasses:
ThreadedPlayer

public class Player
extends java.lang.Object

This is an application's main interface with JMOD. It contain methods for initalizing the player, loading, playing and closing a module. In addition it has varius methods for getting and setting the most important parameters like volume, balance and playing position. More fine grained control can be achieved by manipulating the ModuleState and Module object directly.


Constructor Summary
Player()
           
 
Method Summary
 boolean close()
           
 double getAmplification()
           
 double getBalance()
           
 double getDefaultAmplification()
          get the default amplification.
 int getDivision()
           
 Module getModule()
          get the current module;
 ModuleState getModuleState()
          get the state of the module.
 int getNote(int track)
           
 int getPosition()
           
 double getSeparation()
           
 int getTick()
           
 double getVolume()
           
 boolean init(Output output, boolean interpolate)
          initialize the player
 boolean load(java.io.InputStream in, java.lang.String name)
          Load a module from a opened input stream
 boolean load(Module module)
          Load a module
 boolean load(java.lang.String fileName)
          Load a module from a file
 void mute(boolean[] mute)
           
 void mute(int track, boolean mute)
           
 boolean play()
          play a tick of the the module
 void setAmplification(double amp)
           
 void setBalance(double balance)
           
 void setPosition(int pos)
           
 void setSeparation(double separation)
           
 void setVolume(double volume)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player()
Method Detail

init

public boolean init(Output output,
                    boolean interpolate)
initialize the player

Parameters:
output -
Returns:
true if initialization was successful

load

public boolean load(java.lang.String fileName)
             throws InvalidFormatException,
                    java.io.IOException
Load a module from a file

Parameters:
fileName - the file name of the module
Returns:
true if loading was successful, false else
Throws:
InvalidFormatException
java.io.IOException

load

public boolean load(java.io.InputStream in,
                    java.lang.String name)
             throws InvalidFormatException,
                    java.io.IOException
Load a module from a opened input stream

Parameters:
in - the opened InputStream of the module
name - the name or URL of the module or the suffix of its name to identify the format
Returns:
true if loading was successful, false else
Throws:
InvalidFormatException
java.io.IOException

load

public boolean load(Module module)
Load a module

Parameters:
module - the module to load
Returns:
true if loading was successful, false else

play

public boolean play()
             throws PlayerException
play a tick of the the module

Returns:
true if the module is still playing, false if the module is finished.
Throws:
PlayerException

close

public boolean close()

getModuleState

public ModuleState getModuleState()
get the state of the module. The ModuleState can be used for finding information about the playing module and for manipulating how the module should be played

Returns:
the state of the playing module

getModule

public Module getModule()
get the current module;

Returns:

getDefaultAmplification

public double getDefaultAmplification()
get the default amplification. The default amplification is calculated using the following formula: #tracks / 4. This should maintain a reasonable volume when playing modules with many channels while avoiding clipping in most cases. Note that for 4channel mods this will result in an amplification of 1.

Returns:

setAmplification

public void setAmplification(double amp)

getAmplification

public double getAmplification()

mute

public void mute(int track,
                 boolean mute)

mute

public void mute(boolean[] mute)

setVolume

public void setVolume(double volume)

getVolume

public double getVolume()

setBalance

public void setBalance(double balance)

getBalance

public double getBalance()

setSeparation

public void setSeparation(double separation)

getSeparation

public double getSeparation()

setPosition

public void setPosition(int pos)

getPosition

public int getPosition()

getDivision

public int getDivision()

getTick

public int getTick()

getNote

public int getNote(int track)