abstract class Yuno::AbstractChip

Overview

Base class for all chip implementations.

Direct Known Subclasses

Defined in:

yunosynth/abstract-chips.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(vgm : VgmFile, playbackSampleRate : UInt32, newSamplingMode : UInt8, newPlayerSampleRate : UInt32, *, emuCore : Symbol | Nil = nil, flags : ChipFlags | Nil = nil) #

Creates a new instance of this chip.


Class Method Detail

def self.defaultEmuCore : Symbol #

Returns a symbol representing the default emulation core that this chip is set up to use.


Instance Method Detail

abstract def baseVolume : UInt16 #

Returns the base volume for this chip. This is the value used by VgmFile#getChipVolume to calculate the appropriate output volume for a chip.


abstract def emuCore : Symbol #

Returns a symbol representing the emulation core that this chip is set up to use.


abstract def getClock : UInt32 #

Gets the correct clock value for this chip using the given VgmFile.


def getStartFlags(vgm : VgmFile) : ChipFlags | Nil #

Gets a set of flags, if any, that are needed to call the #start method.


def getVolModifier : UInt32 #

Gets a volume modification value for this chip. This is used because not all emulators output at the same level.


abstract def id : UInt32 #

A numeric ID that is used to identify the chip. This is used internally by VGM files.


abstract def name : String #

Returns the human-readable name for this chip.


def playerSampleRate : UInt32 #

The sample rate of the VGM player that will use this chip.


abstract def read(chipIndex : UInt8, offset : Int) : UInt8 | UInt16 | UInt32 #

Reads a value from the chip at the given memory offset.


def resamplerType : Resampler::ResamplerType #

What kind of resampling should be used for this chip.


def resamplerType=(resamplerType : Resampler::ResamplerType) #

What kind of resampling should be used for this chip.


abstract def reset(chipIndex : UInt8) : Nil #

Resets this chip to its initial state.


def sampleRate : UInt32 #

The sample rate for this chip.


def sampleRate=(sampleRate : UInt32) #

The sample rate for this chip.


abstract def setMuteMask(chipIndex : UInt8, mask : UInt32) : Nil #

Sets the mute mask for this chip.


def setStereoMask(chipIndex : UInt8, mask : UInt32) : Nil #

Sets the stereo mask for this chip. Not all chips may implement this.


abstract def shortName : String #

Returns a short version of the human-readable name for this chip.


abstract def start(chipIndex : UInt8, clock : UInt32, flags : ChipFlags | Nil = nil) : UInt32 #

Starts this chip, setting the clock rate to the given value. Not all chips use the flags parameter.


def toChipTable : ChipTable #

Creates a new ChipTable, with self as the first chip in the table. This essentially associates a set of chips such that it is a hash table of arrays instead of a linked list.


abstract def type : ChipType #

Returns the ChipType for this chip.


abstract def update(chipIndex : UInt8, outputs : Array(Slice(Int32)), samples : Int) : Nil #

Updates the chip's internal state, then writes the new audio data to outputs.


def updatePaired(chipIndex : UInt8, outputs : OutputBuffers, samples : UInt32) : Nil #

Renders PCM data from the paired chip to outputs. samples is the number of samples to render.


def volume : UInt16 #

The output volume of the chip.


def volume=(volume : UInt16) #

The output volume of the chip.


abstract def write(chipIndex : UInt8, offset : Int, data : Int, port : UInt8 = 0) : Nil #

Writes a value to the given memory offset for this chip. Not all chips use the port parameter.


def writeDac(port : Int, command : Int, data : Int) : Nil #

Writes DAC commands to this chip.