micromod
Class Synthesizer

java.lang.Object
  extended bymicromod.Synthesizer

public class Synthesizer
extends java.lang.Object

The Synthesizer represents a bunch of Modulators, each with an associated Channel. Methods are provided for setting up/updating the Modulators, and for extracting audio from the channels.


Field Summary
static int CBM_AMIGA_NTSC_CLOCK
           
static int CBM_AMIGA_PAL_CLOCK
           
protected  Channel[] channels
           
protected  int ciaPreCalc
           
protected  int ciaTickSamples
           
protected  Modulator[] modulators
           
protected  Module module
           
protected  int numberOfChannels
           
protected  boolean pal
           
protected  int samplingRate
           
 
Constructor Summary
Synthesizer(Module mod, int mixingRate)
          Constructor.
 
Method Summary
 Channel getChannel(int channel)
           
 int getCiaTickSamples()
           
 int getNumberOfChannels()
           
 void initialiseFX(int channel, int period, int instrument, int effectCommand, int effectValue)
          Call this method at the start of every row to assign instruments and initialise effects
 boolean isPAL()
           
 void reset()
          Silence the channels and reset panning to the default values.
 void setBPM(int bpm)
          Set the BPM of the playback (which directly affects the number of samples produced per tick of the CIA clock)
 void setModule(Module mod)
          Reconfigure the Synthesizer for a new module.
 void setSamplingRate(int rate)
          Set the Synthesizer to produce audio at the specified sampling rate.
 void updateFX()
          This method is called every tick except the first in a row to update the effect currently active on each channel.
 void usePAL(boolean p)
          Set whether to decode audio in PAL or NTSC mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CBM_AMIGA_PAL_CLOCK

public static final int CBM_AMIGA_PAL_CLOCK
See Also:
Constant Field Values

CBM_AMIGA_NTSC_CLOCK

public static final int CBM_AMIGA_NTSC_CLOCK
See Also:
Constant Field Values

module

protected Module module

modulators

protected Modulator[] modulators

channels

protected Channel[] channels

numberOfChannels

protected int numberOfChannels

samplingRate

protected int samplingRate

ciaTickSamples

protected int ciaTickSamples

ciaPreCalc

protected int ciaPreCalc

pal

protected boolean pal
Constructor Detail

Synthesizer

public Synthesizer(Module mod,
                   int mixingRate)
Constructor.

Parameters:
mod - The module to use initially.
mixingRate - The sampling rate.
Method Detail

setModule

public void setModule(Module mod)
Reconfigure the Synthesizer for a new module.


setSamplingRate

public void setSamplingRate(int rate)
Set the Synthesizer to produce audio at the specified sampling rate.


usePAL

public void usePAL(boolean p)
Set whether to decode audio in PAL or NTSC mode.

Parameters:
p - If true, use PAL pitch, else use NTSC pitch and tempo.

isPAL

public boolean isPAL()
Returns:
true if the Synthesizer is configured for PAL, otherwise NTSC

reset

public void reset()
Silence the channels and reset panning to the default values.


setBPM

public void setBPM(int bpm)
Set the BPM of the playback (which directly affects the number of samples produced per tick of the CIA clock)


getCiaTickSamples

public int getCiaTickSamples()
Returns:
The current number of samples of output per tick.

getNumberOfChannels

public int getNumberOfChannels()
Returns:
the number of channels the Synthesizer is configured for

getChannel

public Channel getChannel(int channel)
Returns:
The specified Channel object

initialiseFX

public void initialiseFX(int channel,
                         int period,
                         int instrument,
                         int effectCommand,
                         int effectValue)
Call this method at the start of every row to assign instruments and initialise effects


updateFX

public void updateFX()
This method is called every tick except the first in a row to update the effect currently active on each channel.