uk.co.javagear
Class NoiseGenerator

java.lang.Object
  extended by uk.co.javagear.NoiseGenerator

public final class NoiseGenerator
extends java.lang.Object

Texas SN76496 noise generator emulation.

Version:
18th January 2003
Author:
Copyright (C) 2002-2003 Chris White
See Also:
"JavaGear Final Project Report"

Field Summary
private  boolean amplitudeFlipFlop
          Positive/Negative output.
private  ToneGenerator chan2
          Pointer to Channel 2 / Tone Generator 3.
private  double counter
          Counter for square waves.
private  boolean enabled
          Channel Enabled.
private  int firstByte
          First byte of frequency.
private  int frequency
          Frequency of channel.
private  int noise
          Pointer to Noise.
private static int[] PARITY
           
private  double psgCycles
          PSG Cycles Per Sample.
private static int RESET
          Shift Register Reset Value SMS Specific (Bit 13).
private  int shift
          Noise Source.
private static int SYNC_NOISE
          Sync/Periodic Noise (values from Maxim).
private  int tappedBits
           
private  boolean useChan2Freq
          Use Channel 2's Frequency.
private  int volume
          Volume of channel.
private static int WHITE_NOISE
          White Noise (values from Maxim).
 
Constructor Summary
NoiseGenerator(double clockSpeed, int sampleRate, ToneGenerator t)
          NoiseGenerator Constructor.
 
Method Summary
 int getSample()
          Return a single sample from noise generator.
 int getVolume()
          Returns the value of property volume.
 void reset()
          Reset Noise Generator to Default Values.
 void setEnabled()
          Toggle channel On/Off.
 void setFrequency(int f)
          Set channel frequency.
 void setVolume(int volume)
          Sets the value of property volume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARITY

private static final int[] PARITY

RESET

private static final int RESET
Shift Register Reset Value SMS Specific (Bit 13).

See Also:
Constant Field Values

WHITE_NOISE

private static final int WHITE_NOISE
White Noise (values from Maxim).

See Also:
Constant Field Values

SYNC_NOISE

private static final int SYNC_NOISE
Sync/Periodic Noise (values from Maxim).

See Also:
Constant Field Values

volume

private int volume
Volume of channel.


frequency

private int frequency
Frequency of channel.


firstByte

private int firstByte
First byte of frequency.


counter

private double counter
Counter for square waves.


amplitudeFlipFlop

private boolean amplitudeFlipFlop
Positive/Negative output.


psgCycles

private double psgCycles
PSG Cycles Per Sample.


enabled

private boolean enabled
Channel Enabled.


shift

private int shift
Noise Source.


tappedBits

private int tappedBits

noise

private int noise
Pointer to Noise.


chan2

private ToneGenerator chan2
Pointer to Channel 2 / Tone Generator 3.


useChan2Freq

private boolean useChan2Freq
Use Channel 2's Frequency.

Constructor Detail

NoiseGenerator

public NoiseGenerator(double clockSpeed,
                      int sampleRate,
                      ToneGenerator t)
NoiseGenerator Constructor.

Parameters:
clockSpeed - Clock Speed (Hz)
sampleRate - Sample Rate (Hz)
t - Pointer to Tone Generator
Method Detail

reset

public void reset()
Reset Noise Generator to Default Values.


setEnabled

public void setEnabled()
Toggle channel On/Off.


setFrequency

public void setFrequency(int f)
Set channel frequency.

Parameters:
f - frequency.

getSample

public int getSample()
Return a single sample from noise generator.

Returns:
sample (0 to +15)

getVolume

public int getVolume()
Returns the value of property volume. The channel's volume.

Returns:
the value of property volume. The channel's volume.

setVolume

public void setVolume(int volume)
Sets the value of property volume. The channel's volume.

Parameters:
volume - the new value of property volume.


Copyright © 2007 JavaGear. All Rights Reserved.