libsidplayfp 3.0.0
sidplayfp Class Reference

#include <sidplayfp.h>

Public Member Functions

const SidConfigconfig () const
const SidInfoinfo () const
bool config (const SidConfig &cfg)
const char * error () const
bool load (SidTune *tune)
void buffers (short **buffers) const
int play (unsigned int cycles)
bool reset ()
unsigned int installedSIDs () const
void initMixer (bool stereo)
unsigned int mix (short *buffer, unsigned int samples)
void debug (bool enable, FILE *out)
void mute (unsigned int sidNum, unsigned int voice, bool enable)
void filter (unsigned int sidNum, bool enable)
uint_least32_t time () const
uint_least32_t timeMs () const
void setRoms (const uint8_t *kernal, const uint8_t *basic=0, const uint8_t *character=0)
void setKernal (const uint8_t *rom)
void setBasic (const uint8_t *rom)
void setChargen (const uint8_t *rom)
uint_least16_t getCia1TimerA () const
bool getSidStatus (unsigned int sidNum, uint8_t regs[32])
int getBufSize (unsigned int cycles)

Detailed Description

sidplayfp

Examples
demo.cpp.

Member Function Documentation

◆ buffers()

void sidplayfp::buffers ( short ** buffers) const

Get the buffer pointers for each of the installed SID chip.

Parameters
bufferspointer to the array of buffer pointers.
Since
2.14

◆ config() [1/2]

const SidConfig & sidplayfp::config ( ) const

Get the current engine configuration.

Returns
a const reference to the current configuration.
Examples
demo.cpp.

◆ config() [2/2]

bool sidplayfp::config ( const SidConfig & cfg)

Configure the engine. Check error for detailed message if something goes wrong.

Parameters
cfgthe new configuration
Returns
true on success, false otherwise.

◆ debug()

void sidplayfp::debug ( bool enable,
FILE * out )

Control CPU tracing.

Note
: Must be called before reset
Parameters
enableenable/disable debugging.
outthe file where to redirect the debug info.

◆ error()

const char * sidplayfp::error ( ) const

Error message.

Returns
string error message.
Examples
demo.cpp.

◆ filter()

void sidplayfp::filter ( unsigned int sidNum,
bool enable )

Enable/disable SID filter.

Note
: Must be called after config or it has no effect.
Parameters
sidNumthe SID chip, 0 for the first one, 1 for the second or 2 for the third.
enabletrue enable the filter, false disable it.
Since
2.10

◆ getBufSize()

int sidplayfp::getBufSize ( unsigned int cycles)

Get the required size of the buffer for the number of cycles to run, approximate value by excess. The mixer must have been initialized before with initMixer

Parameters
cyclesthe number of cycles.
Returns
size of buffer in bytes or zero if the mixer has not been initialized.
Since
3.0
Examples
demo.cpp.

◆ getCia1TimerA()

uint_least16_t sidplayfp::getCia1TimerA ( ) const

Get the CIA 1 Timer A programmed value.

◆ getSidStatus()

bool sidplayfp::getSidStatus ( unsigned int sidNum,
uint8_t regs[32] )

Get the SID registers programmed value.

Parameters
sidNumthe SID chip, 0 for the first one, 1 for the second and 2 for the third.
regsan array that will be filled with the last values written to the chip.
Returns
false if the requested chip doesn't exist.
Since
2.2

◆ info()

const SidInfo & sidplayfp::info ( ) const

Get the current player informations.

Returns
a const reference to the current info.

◆ initMixer()

void sidplayfp::initMixer ( bool stereo)

Initialize the mixer.

Parameters
stereowhether to mix in stereo or mono
Since
2.15
Examples
demo.cpp.

◆ installedSIDs()

unsigned int sidplayfp::installedSIDs ( ) const

Get the number of installed SID chips.

Returns
the number of SID chips.
Since
2.14

◆ load()

bool sidplayfp::load ( SidTune * tune)

Load a tune. Check error for detailed message if something goes wrong.

Parameters
tunethe SidTune to load, 0 unloads current tune.
Returns
true on sucess, false otherwise.
Examples
demo.cpp.

◆ mix()

unsigned int sidplayfp::mix ( short * buffer,
unsigned int samples )

Mix buffers.

Parameters
bufferthe output buffer
samplesnumber of samples to mix, returned from the play(unsigned int) function
Returns
number of samples generated (samples for mono, samples*2 for stereo)
Since
2.15
Examples
demo.cpp.

◆ mute()

void sidplayfp::mute ( unsigned int sidNum,
unsigned int voice,
bool enable )

Mute/unmute a SID channel.

Parameters
sidNumthe SID chip, 0 for the first one, 1 for the second or 2 for the third.
voicethe channel to mute/unmute, 0 to 2 for the voices or 3 for samples.
enabletrue unmutes the channel, false mutes it.

◆ play()

int sidplayfp::play ( unsigned int cycles)

Run the emulation for selected number of cycles. The value will be limited to a reasonable amount if too large.

Parameters
cyclesthe number of cycles to run.
Returns
the number of produced samples or zero for hardware devices. If negative an error occurred, use error() to get a detailed message.
Since
2.14
Examples
demo.cpp.

◆ reset()

bool sidplayfp::reset ( )

Reinitialize the engine.

Returns
false in case of error, use error() to get a detailed message.
Since
2.15

◆ setKernal()

void sidplayfp::setKernal ( const uint8_t * rom)

Set the ROM banks.

Parameters
rompointer to the ROM data.
Since
2.2

◆ setRoms()

void sidplayfp::setRoms ( const uint8_t * kernal,
const uint8_t * basic = 0,
const uint8_t * character = 0 )

Set ROM images.

Parameters
kernalpointer to Kernal ROM.
basicpointer to Basic ROM, generally needed only for BASIC tunes.
characterpointer to character generator ROM.
Examples
demo.cpp.

◆ time()

uint_least32_t sidplayfp::time ( ) const

Get the current playing time.

Returns
the current playing time measured in seconds.

◆ timeMs()

uint_least32_t sidplayfp::timeMs ( ) const

Get the current playing time.

Returns
the current playing time measured in milliseconds.
Since
2.0

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