#include <residfp.h>
Cycle exact SID emulation
◆ clock()
| int residfp::clock |
( |
unsigned int |
cycles, |
|
|
short * |
buf |
|
) |
| |
Clock SID forward producing audio using chosen output sampling algorithm.
- Parameters
-
| cycles | c64 clocks to clock |
| buf | audio output buffer |
- Returns
- number of samples produced
◆ clockSilent()
| void residfp::clockSilent |
( |
unsigned int |
cycles | ) |
|
Clock SID forward with no audio production.
- Note
- 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::enableFilter |
( |
bool |
enable | ) |
|
Enable filter emulation.
- Parameters
-
| enable | false to turn off filter emulation |
◆ getChipModel()
Get currently emulated chip model.
◆ input()
| void residfp::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.
- Parameters
-
◆ read()
| unsigned char residfp::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 on the 6581 and dar longer on the 8580. 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 a number of cycles dependent on the chip model without modeling the bit fading.
- Parameters
-
| offset | SID register to read |
- Returns
- value read from chip
◆ reset()
◆ setChipModel()
| bool residfp::setChipModel |
( |
ChipModel |
model | ) |
|
Set chip model.
- Parameters
-
- Returns
- false on unrecognized model
◆ setCombinedWaveforms()
Set combined waveforms strength.
- Parameters
-
| cws | strength of combined waveforms |
- Returns
- false on unrecognized strength value
◆ setFilter6581Curve()
| void residfp::setFilter6581Curve |
( |
double |
filterCurve | ) |
|
◆ setFilter6581Range()
| void residfp::setFilter6581Range |
( |
double |
adjustment | ) |
|
◆ setFilter8580Curve()
| void residfp::setFilter8580Curve |
( |
double |
filterCurve | ) |
|
Set filter curve parameter for 8580 model.
- See also
- Filter8580::setFilterCurve(double)
◆ setSamplingParameters()
| bool residfp::setSamplingParameters |
( |
double |
clockFrequency, |
|
|
SamplingMethod |
method, |
|
|
double |
samplingFrequency |
|
) |
| |
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 |
- Returns
- false on unrecognized sampling method
◆ write()
| void residfp::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: