libsidplayfp  0.3.5
Public Member Functions | Public Attributes | List of all members
reSIDfp::SID Class Reference

Public Member Functions

void setChipModel (const ChipModel model)
ChipModel getChipModel ()
void reset ()
void input (const int value)
unsigned char read (const int offset)
void write (const int offset, const unsigned char value)
void mute (const int channel, const bool enable)
void setSamplingParameters (const double clockFrequency, const SamplingMethod method, const double samplingFrequency, const double highestAccurateFrequency)
int clock (int cycles, short *buf)
void clockSilent (int cycles)
Filter6581getFilter6581 ()
Filter8580getFilter8580 ()

Public Attributes

Voicevoice [3]

Member Function Documentation

RESID_INLINE int reSIDfp::SID::clock ( int  cycles,
short *  buf 
)

Clock SID forward using chosen output sampling algorithm.

Parameters
delta_tc64 clocks to clock
bufaudio output buffer
Returns
void reSIDfp::SID::clockSilent ( int  cycles)

Clock SID forward with no audio production.

Warning: You can't mix this method of clocking with the audio-producing clock() because components that don't affect OSC3/ENV3 are not emulated.

Parameters
delta_tc64 clocks to clock.
Filter6581* reSIDfp::SID::getFilter6581 ( )
inline

Get chip's 6581 filter.

Returns
filter
Filter8580* reSIDfp::SID::getFilter8580 ( )
inline

Get chip's 8580 filter.

Returns
filter
void reSIDfp::SID::input ( const int  value)

16-bit input (EXT IN). Write 16-bit sample to audio input. NB! The caller is responsible for keeping the value within 16 bits. Note that to mix in an external audio signal, the signal should be resampled to 1MHz first to avoid sampling noise.

Parameters
valueinput level to set
RESID_INLINE void reSIDfp::SID::mute ( const int  channel,
const bool  enable 
)

SID voice muting.

Parameters
channelchannel to modify
enableis muted?
unsigned char reSIDfp::SID::read ( const int  offset)

Read registers.

Reading a write only register returns the last char written to any SID register. The individual bits in this value start to fade down towards zero after a few cycles. All bits reach zero within approximately $2000 - $4000 cycles. It has been claimed that this fading happens in an orderly fashion, however sampling of write only registers reveals that this is not the case. NB! This is not correctly modeled. The actual use of write only registers has largely been made in the belief that all SID registers are readable. To support this belief the read would have to be done immediately after a write to the same register (remember that an intermediate write to another register would yield that value instead). With this in mind we return the last value written to any SID register for $2000 cycles without modeling the bit fading.

Parameters
offsetSID register to read
Returns
value read from chip
void reSIDfp::SID::reset ( void  )

SID reset.

void reSIDfp::SID::setChipModel ( const ChipModel  model)

Set chip model.

Parameters
modelchip model to use
void reSIDfp::SID::setSamplingParameters ( const double  clockFrequency,
const SamplingMethod  method,
const double  samplingFrequency,
const double  highestAccurateFrequency 
)

Setting of SID sampling parameters.

Use a clock freqency of 985248Hz for PAL C64, 1022730Hz for NTSC C64. The default end of passband frequency is pass_freq = 0.9*sample_freq/2 for sample frequencies up to ~ 44.1kHz, and 20kHz for higher sample frequencies.

For resampling, the ratio between the clock frequency and the sample frequency is limited as follows: 125*clock_freq/sample_freq < 16384 E.g. provided a clock frequency of ~ 1MHz, the sample frequency can not be set lower than ~ 8kHz. A lower sample frequency would make the resampling code overfill its 16k sample ring buffer.

The end of passband frequency is also limited: pass_freq <= 0.9*sample_freq/2

E.g. for a 44.1kHz sampling rate the end of passband frequency is limited to slightly below 20kHz. This constraint ensures that the FIR table is not overfilled.

Parameters
clockFrequencySystem clock frequency at Hz
methodsampling method to use
samplingFrequencyDesired output sampling rate
Returns
success
void reSIDfp::SID::write ( const int  offset,
const unsigned char  value 
)

Write registers.

Parameters
offsetchip register to write
valuevalue to write

Member Data Documentation

Voice* reSIDfp::SID::voice[3]

SID voices


The documentation for this class was generated from the following files: