|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object micromod.Channel
A Channel attemps to do a bit of Amiga hardware emulation to play ProTracker modules a bit better than most. In my experience, this implementation can play some modules that even SurfSmurf can't manage. There are still one or two tunes that won't sound entirely correct, but I believe this is one of the better implementations. The justification for the design of this class is that it provides a protracker specific channel interface and allows the InstrumentPlayer,LoopDecoder,resampler interfaces to be reused in other mod players. In fact, InstrumentPlayer and LoopDecoder have been hacked to better emulate ProTracker. This is an advantage of using different codebases for each module type.
Field Summary | |
protected int |
amplitude
|
protected int |
fineTune
|
protected int[] |
fineTuneTable
A log table for calculating fine tuned periods. |
protected static int |
FIXED_POINT_SHIFT
|
protected InstrumentPlayer |
instrumentPlayer
|
protected int |
leftPan
|
protected int |
mixerStepPrecalc
|
protected int |
period
|
protected int |
rightPan
|
protected int |
volume
|
Constructor Summary | |
Channel(int samplingRate,
boolean pal)
Constructor |
Method Summary | |
protected void |
calculateMixerStep(int period,
int fineTune)
Calculate the step and subStep values for the resampler, from the specified period and fineTune value. |
void |
configure(int samplingRate,
boolean pal)
Configure the Channel to use the specified sampling rate and PAL/NTSC mode. |
void |
getAudio(short[] buffer,
int length,
Resampler resampler,
boolean snapBack)
Get resampled audio into the specified buffers. |
int |
getLeftAmplitude()
|
int |
getPeriod()
Get the current period of the channel.Used so the Modulator can, er, modulate |
int |
getRightAmplitude()
|
int |
getVolume()
Get the current ProTracker volume of the channel, from 0 to 64. |
boolean |
isSilent()
|
void |
reset()
Overrides reset() to reinitialise the default volume and period. |
void |
setFineTune(int fineTune)
Set the finetune. |
void |
setPanning(int left,
int right)
Set the leftAmp and rightAmp members to specify the panning. |
void |
setPeriod(int period,
boolean permanent)
Set the period using the conventional ProTracker period notation. |
void |
setSamplePosition(int samplePosition)
Set the current sample position |
void |
setVolume(int volume,
boolean permanent)
Set the volume from 0 to 64. |
protected void |
switchInstrument(boolean trig)
Play the assigned instrument. |
void |
trigger(Instrument instrument,
int period)
Trigger an instrument on the channel to play at the specified pitch. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int FIXED_POINT_SHIFT
protected int period
protected int volume
protected int fineTune
protected int amplitude
protected int leftPan
protected int rightPan
protected int mixerStepPrecalc
protected InstrumentPlayer instrumentPlayer
protected int[] fineTuneTable
Constructor Detail |
public Channel(int samplingRate, boolean pal)
Method Detail |
public void configure(int samplingRate, boolean pal)
public void reset()
public void trigger(Instrument instrument, int period)
public int getPeriod()
public int getVolume()
public void setPeriod(int period, boolean permanent)
permanent
- if false, the period change only affects one subsequent call to output()public void setVolume(int volume, boolean permanent)
permanent
- if false, the period change only affects one subsequent call to output()public void setSamplePosition(int samplePosition)
public void setFineTune(int fineTune)
public void setPanning(int left, int right)
public int getLeftAmplitude()
public int getRightAmplitude()
public boolean isSilent()
public void getAudio(short[] buffer, int length, Resampler resampler, boolean snapBack)
snapBack
- Do not update the sample-pointers, so the same audio can be retrieved again.protected void switchInstrument(boolean trig)
trig
- If true, will play instrument from start.protected void calculateMixerStep(int period, int fineTune)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |