tracker

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Packate tracker implements the audio.Tracker interface and can be used to record changes in the state of the TIA audio.

Also contains functions that can convert register values into meaningful descriptions.

Index

Constants

View Source
const (
	Noise   = MusicalNote("*")
	Silence = "-"
	Low     = "L"
)

Preset values that the MusicalNote can be. Other values should be musical notation. eg. "C4, D#4", etc.

View Source
const NoPianoKey = 0

NoPianoKey is pressed.

Variables

This section is empty.

Functions

func LookupDistortion

func LookupDistortion(reg audio.Registers) string

LookupDistortion converts the control register value into a text description.

Descriptions taken from Random Terrain's "The Atari 2600 Music and Sound Page"

https://www.randomterrain.com/atari-2600-memories-music-and-sound.html

Types

type Emulation added in v0.19.3

type Emulation interface {
	State() govern.State
	TV() *television.Television
}

type Entry

type Entry struct {
	// the (TV) time the change occurred
	Coords coords.TelevisionCoords

	// which channel the Registers field refers to
	Channel   int
	Registers audio.Registers

	// description of the change. the Registers field by comparison contains the
	// numeric information of the audio change
	Distortion  string
	MusicalNote MusicalNote
	PianoKey    PianoKey
	Volume      VolumeChange
}

Entry represents a single change of audio for a channel

func (Entry) IsMusical added in v0.22.0

func (e Entry) IsMusical() bool

IsMusical returns true if entry represents a musical note

type History added in v0.22.0

type History struct {

	// list of tracker Entries. length is capped to maxTrackerEntries
	Entries []Entry

	// the most recent information for each channel. the entries do no need to
	// have happened at the same time. ie. Recent[0] might refer to an audio
	// change on frame 10 and Recent[1] on frame 20
	Recent [2]Entry
	// contains filtered or unexported fields
}

type MusicalNote

type MusicalNote string

MusicalNote defines the musical note (C#, D, D#, etc.) of an TIA audio channel register group.

func LookupMusicalNote

func LookupMusicalNote(tv *television.Television, reg audio.Registers) MusicalNote

LookupMusicalNote converts the current register values for a channel into a musical note.

Descriptions taken from Random Terrain's "The Atari 2600 Music and Sound Page"

https://www.randomterrain.com/atari-2600-memories-music-and-sound.html

type PianoKey

type PianoKey int

PianoKey is the key number on a piano keyboard.

func NoteToPianoKey

func NoteToPianoKey(note MusicalNote) PianoKey

NoteToPianoKey converts the musical note to the corresponding piano key.

Black notes are negative values of the white note it is associated with.

type Rewind added in v0.22.0

type Rewind interface {
	GetState(frame int) *rewind.State
}

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker implements the audio.Tracker interface and keeps a history of the audio registers over time

func NewTracker

func NewTracker(emulation Emulation, rewind Rewind) *Tracker

NewTracker is the preferred method of initialisation for the Tracker type

func (*Tracker) AudioTick added in v0.22.0

func (tr *Tracker) AudioTick(env audio.TrackerEnvironment, channel int, reg audio.Registers)

AudioTick implements the audio.Tracker interface

func (*Tracker) BorrowTracker added in v0.22.0

func (tr *Tracker) BorrowTracker(f func(*History))

BorrowTracker will lock the Tracker history for the duration of the supplied function, which will be exectued with the History structure as an argument.

Should not be called from the emulation goroutine.

func (*Tracker) Replay added in v0.22.0

func (tr *Tracker) Replay(start int, end int, mixer television.AudioMixer, onEnd func())

Replay audio from start to end indexes

The onEnd argument is a function to run when the replay has concluded

func (*Tracker) Reset

func (tr *Tracker) Reset()

Reset removes all entries from tracker list

type VolumeChange added in v0.22.0

type VolumeChange int

VolumeChange indicates whether the volume of the channel is rising or falling or staying steady

const (
	VolumeSteady VolumeChange = iota
	VolumeRising
	VolumeFalling
)

List of values for the Volume type

func (VolumeChange) String added in v0.22.0

func (v VolumeChange) String() string

Jump to

Keyboard shortcuts

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