uk.co.javagear
Class ToneGenerator

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

public final class ToneGenerator
extends java.lang.Object

Texas SN76496 Tone 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  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  double psgCycles
          PSG cycles per sample.
private  int volume
          Volume of channel.
 
Constructor Summary
ToneGenerator(double clockSpeed, int sampleRate)
          ToneGenerator Constructor.
 
Method Summary
 int getFirstByte()
          Getter for property firstByte.
 int getFrequency()
          Getter for property frequency.
 int getSample()
          Return a single sample from Tone Generator.
 int getVolume()
          Getter for property volume.
 void reset()
          Reset Tone Generator to Default Values.
 void setEnabled()
          Toggle Channel On/Off.
 void setFirstByte(int firstByte)
          Setter for property firstByte.
 void setFreqSigf(int value)
          Set significant bits of frequency.
 void setFrequency(int frequency)
          Setter for property frequency.
 void setVolume(int volume)
          Setter for property volume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

Constructor Detail

ToneGenerator

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

Parameters:
clockSpeed - clock speed (Hz)
sampleRate - sample rate (Hz)
Method Detail

reset

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


setEnabled

public void setEnabled()
Toggle Channel On/Off.


setFreqSigf

public void setFreqSigf(int value)
Set significant bits of frequency.

Parameters:
value - high byte.

getSample

public int getSample()
Return a single sample from Tone Generator.

Returns:
Sample (-15 to +15)

getVolume

public int getVolume()
Getter for property volume. The channel's volume.

Returns:
Value of property volume. The channel's volume.

setVolume

public void setVolume(int volume)
Setter for property volume. The channel's volume.

Parameters:
volume - New value of property volume. The channel's volume.

getFrequency

public int getFrequency()
Getter for property frequency. The channel's frequency.

Returns:
Value of property frequency. The channel's frequency.

setFrequency

public void setFrequency(int frequency)
Setter for property frequency. The channel's frequency.

Parameters:
frequency - New value of property frequency. The channel's frequency.

getFirstByte

public int getFirstByte()
Getter for property firstByte. First byte of frequency.

Returns:
Value of property firstByte. First byte of frequency.

setFirstByte

public void setFirstByte(int firstByte)
Setter for property firstByte. First byte of frequency.

Parameters:
firstByte - New value of property firstByte. First byte of frequency.


Copyright © 2007 JavaGear. All Rights Reserved.