libsidplayfp 2.15.0
Public Member Functions | List of all members
reSIDfp::SincResampler Class Referencefinal

#include <SincResampler.h>

Inheritance diagram for reSIDfp::SincResampler:
Inheritance graph
[legend]
Collaboration diagram for reSIDfp::SincResampler:
Collaboration graph
[legend]

Public Member Functions

 SincResampler (double clockFrequency, double samplingFrequency, double highestAccurateFrequency)
 
bool input (int input) override
 
int output () const override
 
void reset () override
 
- Public Member Functions inherited from reSIDfp::Resampler
short getOutput (int scaleFactor) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from reSIDfp::Resampler
static short softClip (int x)
 

Detailed Description

This is the theoretically correct (and computationally intensive) audio sample generation. The samples are generated by resampling to the specified sampling frequency. The work rate is inversely proportional to the percentage of the bandwidth allocated to the filter transition band.

This implementation is based on the paper "A Flexible Sampling-Rate Conversion Method", by J. O. Smith and P. Gosset, or rather on the expanded tutorial on the Digital Audio Resampling Home Page.

By building shifted FIR tables with samples according to the sampling frequency, this implementation dramatically reduces the computational effort in the filter convolutions, without any loss of accuracy. The filter convolutions are also vectorizable on current hardware.

Constructor & Destructor Documentation

◆ SincResampler()

reSIDfp::SincResampler::SincResampler ( double  clockFrequency,
double  samplingFrequency,
double  highestAccurateFrequency 
)

Use a clock freqency of 985248Hz for PAL C64, 1022730Hz for NTSC C64.

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.

Parameters
clockFrequencySystem clock frequency at Hz
samplingFrequencyDesired output sampling rate
highestAccurateFrequencypassband frequency limit

Member Function Documentation

◆ input()

bool reSIDfp::SincResampler::input ( int  sample)
overridevirtual

Input a sample into resampler. Output "true" when resampler is ready with new sample.

Parameters
sampleinput sample
Returns
true when a sample is ready

Implements reSIDfp::Resampler.

◆ output()

int reSIDfp::SincResampler::output ( ) const
inlineoverridevirtual

Implements reSIDfp::Resampler.

◆ reset()

void reSIDfp::SincResampler::reset ( )
overridevirtual

Implements reSIDfp::Resampler.


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