Documentation ¶
Overview ¶
Package audio implements the audio generation of the TIA. Originally, Gopher2600 used Ron Fries' audio implementation but this has now been completely superceded by the work of Chris Brenner.
Chris's work has been used in both the 6502.ts and Stella projects. Source from both projects was used as reference. Both projects are exactly equivalent.
6502.ts (published under the MIT licence) https://github.com/6502ts/6502.ts/blob/6f923e5fe693b82a2448ffac1f85aea9693cacff/src/machine/stella/tia/PCMAudio.ts https://github.com/6502ts/6502.ts/blob/6f923e5fe693b82a2448ffac1f85aea9693cacff/src/machine/stella/tia/PCMChannel.ts Stella (published under the GNU GPL v2.0 licence) https://github.com/stella-emu/stella/blob/e6af23d6c12893dd17711002971087f28f87c31f/src/emucore/tia/Audio.cxx https://github.com/stella-emu/stella/blob/e6af23d6c12893dd17711002971087f28f87c31f/src/emucore/tia/AudioChannel.cxx
Index ¶
Constants ¶
const SampleFreq = 31400
SampleFreq represents the number of samples generated per second. This is the 30Khz reference frequency desribed in the Stella Programmer's Guide.
Variables ¶
This section is empty.
Functions ¶
func CmpRegisters ¶ added in v0.15.0
CmpRegisters returns true if the two registers contain the same values
Types ¶
type Audio ¶
type Audio struct { // the volume output for each channel Vol0 uint8 Vol1 uint8 // contains filtered or unexported fields }
Audio is the implementation of the TIA audio sub-system, using Ron Fries' method. Reference source code here:
https://raw.githubusercontent.com/alekmaul/stella/master/emucore/TIASound.c
func NewAudio ¶
func NewAudio() *Audio
NewAudio is the preferred method of initialisation for the Audio sub-system.
func (*Audio) ReadMemRegisters ¶ added in v0.12.1
func (au *Audio) ReadMemRegisters(data chipbus.ChangedRegister) bool
ReadMemRegisters checks the TIA memory for changes to registers that are interesting to the audio sub-system
Returns true if memory.ChipData has not been serviced.
func (*Audio) SetTracker ¶ added in v0.15.0
SetTracker adds a Tracker implementation to the Audio sub-system.
func (*Audio) Snapshot ¶ added in v0.7.1
Snapshot creates a copy of the TIA Audio sub-system in its current state.
type Registers ¶ added in v0.15.0
each channel has three registers that control its output. from the "Stella Programmer's Guide":
"Each audio circuit has three registers that control a noise-tone generator (what kind of sound), a frequency selection (high or low pitch of the sound), and a volume control."
not all the bits are used in each register. the comments below indicate how many of the least-significant bits are used.