libsidplayfp
2.0.2
|
#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 (unsigned int cycles, short *buf) |
void | clockSilent (unsigned int cycles) |
void | setFilter6581Curve (double filterCurve) |
void | setFilter8580Curve (double filterCurve) |
void | enableFilter (bool enable) |
MOS6581/MOS8580 emulation.
RESID_INLINE int reSIDfp::SID::clock | ( | unsigned int | cycles, |
short * | buf | ||
) |
Clock SID forward using chosen output sampling algorithm.
cycles | c64 clocks to clock |
buf | audio output buffer |
void reSIDfp::SID::clockSilent | ( | unsigned int | cycles | ) |
void reSIDfp::SID::enableFilter | ( | bool | enable | ) |
Enable filter emulation.
enable | false to turn off filter emulation |
|
inline |
Get currently emulated chip model.
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.
value | input level to set |
|
inline |
SID voice muting.
channel | channel to modify |
enable | is muted? |
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. NOTE: 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.
offset | SID register to read |
void reSIDfp::SID::reset | ( | ) |
SID reset.
void reSIDfp::SID::setChipModel | ( | ChipModel | model | ) |
void reSIDfp::SID::setFilter6581Curve | ( | double | filterCurve | ) |
Set filter curve parameter for 6581 model.
void reSIDfp::SID::setFilter8580Curve | ( | double | filterCurve | ) |
Set filter curve parameter for 8580 model.
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.
clockFrequency | System clock frequency at Hz |
method | sampling method to use |
samplingFrequency | Desired output sampling rate |
highestAccurateFrequency |
SIDError |
void reSIDfp::SID::write | ( | int | offset, |
unsigned char | value | ||
) |
Write registers.
offset | chip register to write |
value | value to write |