reSIDfp::SID Class Reference

#include <SID.h>

List of all members.

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)
Filter6581getFilter6581 () const
Filter8580getFilter8580 () const


Detailed Description

MOS6581/MOS8580 emulation. Based on reSID 0.16 by Dag Lem, and then hacked on by Antti S. Lankila. Ported to Java by Ken Händel.

Author:
Ken Händel

Dag Lem

Antti Lankila

Leandro Nini


Member Function Documentation

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

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.

Filter6581* reSIDfp::SID::getFilter6581 (  )  const [inline]

Get chip's 6581 filter.

Returns:
filter

Filter8580* reSIDfp::SID::getFilter8580 (  )  const [inline]

Get chip's 8580 filter.

Returns:
filter

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

void reSIDfp::SID::mute ( int  channel,
bool  enable 
) [inline]

SID voice muting.

Parameters:
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. 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

void reSIDfp::SID::reset (  ) 

SID reset.

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

Set chip model.

Parameters:
model chip model to use

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 

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:

Generated on Sun Jul 14 23:13:00 2013 for libsidplayfp by  doxygen 1.5.9