audio

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2021 License: GPL-3.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package audio implements the audio generation of the TIA. The implementation is taken almost directly from Ron Fries' original implementation, found in TIASound.c (easily searchable). The bit patterns are taken from there and the channels are mixed in the same way.

Unlike the Fries' implementation, the Mix() function is called every video cycle, returning a new sample every 114th video clock. The TIA_Process() function in Frie's implementation meanwhile is called to fill a buffer. The samepl buffer in this emulation must sit outside of the TIA emulation and somewhere inside the television implementation. TIASound.c is published under the GNU Library GPL v2.0

Some modifications were made to Fries' alogorithm in accordance to similar modifications made to the TIASnd.cxx file of the Stella emulator v5.1.3. Stella is published under the GNU GPL v2.0

Index

Constants

View Source
const SampleFreq = 31403

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

This section is empty.

Types

type Audio

type Audio struct {

	// state of Mix()
	MixUpdated bool
	MixVolume  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) Mix

func (au *Audio) Mix()

Mix the two VCS audio channels, returning a boolean indicating whether the sound has been updated and a single value representing the mixed volume.

func (*Audio) Snapshot added in v0.7.1

func (au *Audio) Snapshot() *Audio

Snapshot creates a copy of the TIA Audio sub-system in its current state.

func (*Audio) String

func (au *Audio) String() string

func (*Audio) UpdateRegisters

func (au *Audio) UpdateRegisters(data bus.ChipData) bool

UpdateRegisters 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL