reSIDfp::SID Class Reference

`#include <SID.h>`

## Public Member Functions

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

## Detailed Description

MOS6581/MOS8580 emulation.

## Member Function Documentation

## clock()

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

Clock SID forward using chosen output sampling algorithm.

Parameters

  cycles | c64 clocks to clock
  buf | audio output buffer

Returns
  number of samples produced

## clockSilent()

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

  cycles | c64 clocks to clock.

## enableFilter()

void reSIDfp::SID::enableFilter | ( | bool | enable | ) |

Enable filter emulation.

Parameters

  enable | false to turn off filter emulation

## getChipModel()

ChipModel reSIDfp::SID::getChipModel | ( |  | ) | const

inline

Get currently emulated chip model.

## input()

void reSIDfp::SID::input | ( | 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

  value | input level to set

## mute()

void reSIDfp::SID::mute | ( | int | channel,
|  | bool | enable
| ) |  |

inline

SID voice muting.

Parameters

  channel | channel to modify
  enable | is muted?

## read()

unsigned char reSIDfp::SID::read | ( | 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

  offset | SID register to read

Returns
  value read from chip

## reset()

void reSIDfp::SID::reset | ( |  | ) |

SID reset.

## setChipModel()

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

Set chip model.

Parameters

  model | chip model to use

## setFilter6581Curve()

void reSIDfp::SID::setFilter6581Curve | ( | double | filterCurve | ) |

Set filter curve parameter for 6581 model.

See also
  Filter6581::setFilterCurve(double)

## setFilter8580Curve()

void reSIDfp::SID::setFilter8580Curve | ( | double | filterCurve | ) |

Set filter curve parameter for 8580 model.

See also
  Filter8580::setFilterCurve(double)

## setSamplingParameters()

void reSIDfp::SID::setSamplingParameters | ( | double | clockFrequency,
|  | SamplingMethod | method,
|  | double | samplingFrequency,
|  | 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

  clockFrequency | System clock frequency at Hz
  method | sampling method to use
  samplingFrequency | Desired output sampling rate
  highestAccurateFrequency |

## write()

void reSIDfp::SID::write | ( | int | offset,
|  | unsigned char | value
| ) |  |

Write registers.

Parameters

  offset | chip register to write
  value | value to write

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

- SID.h
- SID.cpp