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(chipNum : Int32, absChipCount : Int32, vgm : VgmFile, playbackSampleRate : UInt32, newSamplingMode : UInt8, newPlayerSampleRate : UInt32, *, emuCore : Symbol | Nil = nil, flags : ChipFlags | Nil = nil) #

Creates a new instance of this chip.


[View source]

Class Method Detail

def self.defaultEmuCore : Symbol #

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


[View source]

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.


[View source]
abstract def emuCore : Symbol #

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


[View source]
abstract def getClock : UInt32 #

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


[View source]
def getStartFlags(vgm : VgmFile) : ChipFlags | Nil #

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


[View source]
def getVolModifier : UInt32 #

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


[View source]
abstract def id : UInt32 #

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


[View source]
abstract def name : String #

Returns the human-readable name for this chip.


[View source]
def playerSampleRate : UInt32 #

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


[View source]
abstract def read(chipIndex : UInt8, offset : Int) : UInt8 | UInt16 | UInt32 #

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


[View source]
def resamplerType : Resampler::ResamplerType #

What kind of resampling should be used for this chip.


[View source]
def resamplerType=(resamplerType : Resampler::ResamplerType) #

What kind of resampling should be used for this chip.


[View source]
abstract def reset(chipIndex : UInt8) : Nil #

Resets this chip to its initial state.


[View source]
def sampleRate : UInt32 #

The sample rate for this chip.


[View source]
def sampleRate=(sampleRate : UInt32) #

The sample rate for this chip.


[View source]
abstract def setMuteMask(chipIndex : UInt8, mask : UInt32) : Nil #

Sets the mute mask for this chip.


[View source]
def setStereoMask(chipIndex : UInt8, mask : UInt32) : Nil #

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


[View source]
abstract def shortName : String #

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


[View source]
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.


[View source]
abstract def type : ChipType #

Returns the ChipType for this chip.


[View source]
abstract def update(outputs : Array(Slice(Int32)), samples : Int) : Nil #

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


[View source]
def updatePaired(outputs : OutputBuffers, samples : UInt32) : Nil #

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


[View source]
def volume : UInt16 #

The output volume of the chip.


[View source]
def volume=(volume : UInt16) #

The output volume of the chip.


[View source]
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.


[View source]
def writeDac(port : Int, command : Int, data : Int) : Nil #

Writes DAC commands to this chip.


[View source]