libsidplayfp  2.0.2
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
libsidplayfp::SidTuneBase Class Reference

#include <SidTuneBase.h>

Inheritance diagram for libsidplayfp::SidTuneBase:
Inheritance graph
[legend]
Collaboration diagram for libsidplayfp::SidTuneBase:
Collaboration graph
[legend]

Public Member Functions

unsigned int selectSong (unsigned int songNum)
 
const SidTuneInfogetInfo () const
 
const SidTuneInfogetInfo (unsigned int songNum)
 
virtual void placeSidTuneInC64mem (sidmemory &mem)
 
virtual const char * createMD5 (char *)
 
virtual const char * createMD5New (char *)
 
const uint_least8_t * c64Data () const
 

Static Public Member Functions

static SidTuneBaseload (const char *fileName, const char **fileNameExt, bool separatorIsSlash)
 
static SidTuneBaseread (const uint_least8_t *sourceBuffer, uint_least32_t bufferLen)
 

Protected Types

typedef std::vector< uint8_t > buffer_t
 

Protected Member Functions

void convertOldStyleSpeedToTables (uint_least32_t speed, SidTuneInfo::clock_t clock=SidTuneInfo::CLOCK_PAL)
 
bool checkCompatibility ()
 
bool checkRelocInfo ()
 
void resolveAddrs (const uint_least8_t *c64data)
 
virtual void acceptSidTune (const char *dataFileName, const char *infoFileName, buffer_t &buf, bool isSlashedFileName)
 
std::string petsciiToAscii (SmartPtr_sidtt< const uint8_t > &spPet)
 

Static Protected Member Functions

static void loadFile (const char *fileName, buffer_t &bufferRef)
 

Protected Attributes

std::unique_ptr< SidTuneInfoImplinfo
 
uint_least8_t songSpeed [MAX_SONGS]
 
SidTuneInfo::clock_t clockSpeed [MAX_SONGS]
 
uint_least32_t fileOffset
 For files with header: offset to real data.
 
buffer_t cache
 

Static Protected Attributes

static const unsigned int MAX_SONGS = 256
 Also PSID file format limit.
 
static const char ERR_TRUNCATED [] = "SIDTUNE ERROR: File is most likely truncated"
 
static const char ERR_INVALID [] = "SIDTUNE ERROR: File contains invalid data"
 

Detailed Description

SidTuneBaseBase

Member Function Documentation

◆ acceptSidTune()

void libsidplayfp::SidTuneBase::acceptSidTune ( const char *  dataFileName,
const char *  infoFileName,
buffer_t &  buf,
bool  isSlashedFileName 
)
protectedvirtual

Cache the data of a single-file or two-file sidtune and its corresponding file names.

Parameters
dataFileName
infoFileName
buf
isSlashedFileNameIf your opendir() and readdir()->d_name return path names that contain the forward slash (/) as file separator, but your operating system uses a different character, there are extra functions that can deal with this special case. Set separatorIsSlash to true if you like path names to be split correctly. You do not need these extra functions if your systems file separator is the forward slash.
Exceptions
loadError

Reimplemented in libsidplayfp::MUS.

◆ c64Data()

const uint_least8_t* libsidplayfp::SidTuneBase::c64Data ( ) const
inline

Get the pointer to the tune data.

◆ checkCompatibility()

bool libsidplayfp::SidTuneBase::checkCompatibility ( )
protected

Check if compatibility constraints are fulfilled.

◆ checkRelocInfo()

bool libsidplayfp::SidTuneBase::checkRelocInfo ( )
protected

Check for valid relocation information.

◆ convertOldStyleSpeedToTables()

void libsidplayfp::SidTuneBase::convertOldStyleSpeedToTables ( uint_least32_t  speed,
SidTuneInfo::clock_t  clock = SidTuneInfo::CLOCK_PAL 
)
protected

Convert 32-bit PSID-style speed word to internal tables.

Parameters
speed
clock

◆ createMD5()

virtual const char* libsidplayfp::SidTuneBase::createMD5 ( char *  )
inlinevirtual

Calculates the MD5 hash of the tune. Not providing an md5 buffer will cause the internal one to be used. If provided, buffer must be MD5_LENGTH + 1

Returns
a pointer to the buffer containing the md5 string.

Reimplemented in libsidplayfp::PSID.

◆ createMD5New()

virtual const char* libsidplayfp::SidTuneBase::createMD5New ( char *  )
inlinevirtual

Calculates the MD5 hash of the tune. Not providing an md5 buffer will cause the internal one to be used. If provided, buffer must be MD5_LENGTH + 1

Returns
a pointer to the buffer containing the md5 string.

Reimplemented in libsidplayfp::PSID.

◆ getInfo() [1/2]

const SidTuneInfo * libsidplayfp::SidTuneBase::getInfo ( ) const

Retrieve sub-song specific information.

◆ getInfo() [2/2]

const SidTuneInfo * libsidplayfp::SidTuneBase::getInfo ( unsigned int  songNum)

Select sub-song (0 = default starting song) and retrieve active song information.

Parameters
songNum

◆ load()

SidTuneBase * libsidplayfp::SidTuneBase::load ( const char *  fileName,
const char **  fileNameExt,
bool  separatorIsSlash 
)
static

Load a sidtune from a file.

To retrieve data from standard input pass in filename "-". If you want to override the default filename extensions use this contructor. Please note, that if the specified "sidTuneFileName" does exist and the loader is able to determine its file format, this function does not try to append any file name extension. See "SidTune.cpp" for the default list of file name extensions.

Parameters
fileName
fileNameExt
separatorIsSlash
Returns
the sid tune
Exceptions
loadError

◆ loadFile()

void libsidplayfp::SidTuneBase::loadFile ( const char *  fileName,
buffer_t &  bufferRef 
)
staticprotected

Does not affect status of object, and therefore can be used to load files. Error string is put into info.statusString, though.

Parameters
fileName
bufferRef
Exceptions
loadError

◆ petsciiToAscii()

std::string libsidplayfp::SidTuneBase::petsciiToAscii ( SmartPtr_sidtt< const uint8_t > &  spPet)
protected

Petscii to Ascii converter.

◆ placeSidTuneInC64mem()

void libsidplayfp::SidTuneBase::placeSidTuneInC64mem ( sidmemory mem)
virtual

Copy sidtune into C64 memory (64 KB).

Parameters
mem

Reimplemented in libsidplayfp::MUS.

◆ read()

SidTuneBase * libsidplayfp::SidTuneBase::read ( const uint_least8_t *  sourceBuffer,
uint_least32_t  bufferLen 
)
static

Load a single-file sidtune from a memory buffer. Currently supported: PSID format

Parameters
sourceBuffer
bufferLen
Returns
the sid tune
Exceptions
loadError

◆ resolveAddrs()

void libsidplayfp::SidTuneBase::resolveAddrs ( const uint_least8_t *  c64data)
protected

Common address resolution procedure.

Parameters
c64data

◆ selectSong()

unsigned int libsidplayfp::SidTuneBase::selectSong ( unsigned int  songNum)

Select sub-song (0 = default starting song) and return active song number out of [1,2,..,SIDTUNE_MAX_SONGS].

Parameters
songNum
Returns
the active song

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