SidDatabase.h   SidDatabase.h 
skipping to change at line 27 skipping to change at line 27
#ifndef _siddatabase_h_ #ifndef _siddatabase_h_
#define _siddatabase_h_ #define _siddatabase_h_
#include "sidplayfp/sidconfig.h" #include "sidplayfp/sidconfig.h"
#include "sidplayfp/sidtypes.h" #include "sidplayfp/sidtypes.h"
class SidTuneMod; class SidTuneMod;
class iniParser; class iniParser;
/**
* SidDatabase
* An utility class to deal with the songlength DataBase.
*/
class SID_EXTERN SidDatabase class SID_EXTERN SidDatabase
{ {
private: private:
static const char *ERR_DATABASE_CORRUPT; static const char *ERR_DATABASE_CORRUPT;
static const char *ERR_NO_DATABASE_LOADED; static const char *ERR_NO_DATABASE_LOADED;
static const char *ERR_NO_SELECTED_SONG; static const char *ERR_NO_SELECTED_SONG;
static const char *ERR_MEM_ALLOC; static const char *ERR_MEM_ALLOC;
static const char *ERR_UNABLE_TO_LOAD_DATABASE; static const char *ERR_UNABLE_TO_LOAD_DATABASE;
iniParser *m_parser; iniParser *m_parser;
const char *errorString; const char *errorString;
class parseError {}; class parseError {};
static const char* parseTime(const char* str, long &result); static const char* parseTime(const char* str, long &result);
public: public:
SidDatabase (); SidDatabase ();
~SidDatabase (); ~SidDatabase ();
/**
* Open the songlength DataBase.
* @param filename songlengthDB file name with full path.
* @return -1 in case of errors, 0 otherwise.
*/
int open (const char *filename); int open (const char *filename);
/**
* Close the songlength DataBase.
*/
void close (); void close ();
/**
* Get the length of the current subtune.
* @param tune
* @return tune length in seconds, -1 in case of errors.
*/
int_least32_t length (SidTuneMod &tune); int_least32_t length (SidTuneMod &tune);
/**
* Get the length of the selected subtune.
* @param md5 the md5 hash of the tune.
* @param song the subtune.
* @return tune length in seconds, -1 in case of errors.
*/
int_least32_t length (const char *md5, uint_least16_t song); int_least32_t length (const char *md5, uint_least16_t song);
/// Get descriptive error message.
const char * error (void) { return errorString; } const char * error (void) { return errorString; }
}; };
#endif // _siddatabase_h_ #endif // _siddatabase_h_
 End of changes. 6 change blocks. 
0 lines changed or deleted 26 lines changed or added


 SidTune.h   SidTune.h 
skipping to change at line 28 skipping to change at line 28
#ifndef SIDTUNE_H #ifndef SIDTUNE_H
#define SIDTUNE_H #define SIDTUNE_H
#include "sidtypes.h" #include "sidtypes.h"
#include "Buffer.h" #include "Buffer.h"
#include "SmartPtr.h" #include "SmartPtr.h"
#include <fstream> #include <fstream>
/// Also PSID file format limit.
const uint_least16_t SIDTUNE_MAX_SONGS = 256; const uint_least16_t SIDTUNE_MAX_SONGS = 256;
// Also PSID file format limit.
const uint_least16_t SIDTUNE_MAX_CREDIT_STRINGS = 10; const uint_least16_t SIDTUNE_MAX_CREDIT_STRINGS = 10;
/// 80 characters plus terminating zero.
const uint_least16_t SIDTUNE_MAX_CREDIT_STRLEN = 80+1; const uint_least16_t SIDTUNE_MAX_CREDIT_STRLEN = 80+1;
// 80 characters plus terminating zero.
const uint_least32_t SIDTUNE_MAX_MEMORY = 65536; const uint_least32_t SIDTUNE_MAX_MEMORY = 65536;
/// C64KB+LOAD+PSID
const uint_least32_t SIDTUNE_MAX_FILELEN = 65536+2+0x7C; const uint_least32_t SIDTUNE_MAX_FILELEN = 65536+2+0x7C;
// C64KB+LOAD+PSID
const int SIDTUNE_SPEED_VBI = 0; // Vertical-Blanking-Interrupt /// Vertical-Blanking-Interrupt
const int SIDTUNE_SPEED_CIA_1A = 60; // CIA 1 Timer A const int SIDTUNE_SPEED_VBI = 0;
/// CIA 1 Timer A
const int SIDTUNE_SPEED_CIA_1A = 60;
const int SIDTUNE_CLOCK_UNKNOWN = 0x00; const int SIDTUNE_CLOCK_UNKNOWN = 0x00;
const int SIDTUNE_CLOCK_PAL = 0x01; // These are also used in the const int SIDTUNE_CLOCK_PAL = 0x01; // These are also used in the
const int SIDTUNE_CLOCK_NTSC = 0x02; // emulator engine! const int SIDTUNE_CLOCK_NTSC = 0x02; // emulator engine!
const int SIDTUNE_CLOCK_ANY = (SIDTUNE_CLOCK_PAL | SIDTUNE_CLOCK_NTSC); const int SIDTUNE_CLOCK_ANY = (SIDTUNE_CLOCK_PAL | SIDTUNE_CLOCK_NTSC);
const int SIDTUNE_SIDMODEL_UNKNOWN = 0x00; const int SIDTUNE_SIDMODEL_UNKNOWN = 0x00;
const int SIDTUNE_SIDMODEL_6581 = 0x01; // These are also used in the const int SIDTUNE_SIDMODEL_6581 = 0x01; // These are also used in the
const int SIDTUNE_SIDMODEL_8580 = 0x02; // emulator engine! const int SIDTUNE_SIDMODEL_8580 = 0x02; // emulator engine!
const int SIDTUNE_SIDMODEL_ANY = (SIDTUNE_SIDMODEL_6581 | SIDTUNE_SIDMO DEL_8580); const int SIDTUNE_SIDMODEL_ANY = (SIDTUNE_SIDMODEL_6581 | SIDTUNE_SIDMO DEL_8580);
const int SIDTUNE_COMPATIBILITY_C64 = 0x00; // File is C64 compatible const int SIDTUNE_COMPATIBILITY_C64 = 0x00; ///< File is C64 compatible
const int SIDTUNE_COMPATIBILITY_PSID = 0x01; // File is PSID specific const int SIDTUNE_COMPATIBILITY_PSID = 0x01; ///< File is PSID specific
const int SIDTUNE_COMPATIBILITY_R64 = 0x02; // File is Real C64 only const int SIDTUNE_COMPATIBILITY_R64 = 0x02; ///< File is Real C64 only
const int SIDTUNE_COMPATIBILITY_BASIC = 0x03; // File requires C64 Basic const int SIDTUNE_COMPATIBILITY_BASIC = 0x03; ///< File requires C64 Basic
template class SID_EXTERN Buffer_sidtt<const uint_least8_t>; template class SID_EXTERN Buffer_sidtt<const uint_least8_t>;
/**
* An instance of this structure is used to transport values to
* and from SidTune objects.
*
* You must read (i.e. activate) sub-song specific information
* via:
* const SidTuneInfo& tuneInfo = SidTune[songNumber];
* const SidTuneInfo& tuneInfo = SidTune.getInfo();
* void SidTune.getInfo(tuneInfo&);
*
* Consider the following fields as read-only, because the SidTune class
* does not provide an implementation of: bool setInfo(const SidTuneInfo&).
* Currently, the only way to get the class to accept values which
* are written to these fields is by creating a derived class.
*/
struct SidTuneInfo struct SidTuneInfo
{ {
// An instance of this structure is used to transport values to /// the name of the identified file format
// and from SidTune objects. const char* formatString;
// You must read (i.e. activate) sub-song specific information /// error/status message of last operation
// via: const char* statusString;
// const SidTuneInfo& tuneInfo = SidTune[songNumber];
// const SidTuneInfo& tuneInfo = SidTune.getInfo();
// void SidTune.getInfo(tuneInfo&);
// Consider the following fields as read-only, because the SidTune clas
s
// does not provide an implementation of: bool setInfo(const SidTuneInf
o&).
// Currently, the only way to get the class to accept values which
// are written to these fields is by creating a derived class.
const char* formatString; // the name of the identified file format /// describing the speed a song is running at
const char* statusString; // error/status message of last operation const char* speedString;
const char* speedString; // describing the speed a song is running a
t
uint_least16_t loadAddr; uint_least16_t loadAddr;
uint_least16_t initAddr; uint_least16_t initAddr;
uint_least16_t playAddr; uint_least16_t playAddr;
uint_least16_t songs; uint_least16_t songs;
uint_least16_t startSong; uint_least16_t startSong;
// The SID chip base address(es) used by the sidtune. /**
uint_least16_t sidChipBase1; // 0xD400 (normal, 1st SID) * @name Base addresses
uint_least16_t sidChipBase2; // 0xD?00 (2nd SID) or 0 (no 2nd SID) * The SID chip base address(es) used by the sidtune.
*/
// Available after song initialization. //@{
// uint_least16_t sidChipBase1; ///< 0xD400 (normal, 1st SID)
uint_least16_t currentSong; // the one that has been initialized uint_least16_t sidChipBase2; ///< 0xD?00 (2nd SID) or 0 (no 2nd SID)
uint_least8_t songSpeed; // intended speed, see top //@}
uint_least8_t clockSpeed; // -"-
uint_least8_t relocStartPage; // First available page for relocation /// Available after song initialization.
uint_least8_t relocPages; // Number of pages available for relocat /// the one that has been initialized
ion uint_least16_t currentSong;
bool musPlayer; // whether Sidplayer routine has been in
stalled /// intended speed, see top
int sidModel1; // Sid Model required for first sid uint_least8_t songSpeed;
int sidModel2; // Sid Model required for second sid
int compatibility; // compatibility requirements /// -"-
bool fixLoad; // whether load address might be duplica uint_least8_t clockSpeed;
te
uint_least16_t songLength; // --- not yet supported --- /// First available page for relocation
// uint_least8_t relocStartPage;
// Song title, credits, ...
// 0 = Title, 1 = Author, 2 = Copyright/Publisher /// Number of pages available for relocation
// uint_least8_t relocPages;
uint_least8_t numberOfInfoStrings; // the number of available text inf
o lines /// whether Sidplayer routine has been installed
bool musPlayer;
/// Sid Model required for first sid
int sidModel1;
/// Sid Model required for second sid
int sidModel2;
/// compatibility requirements
int compatibility;
/// whether load address might be duplicate
bool fixLoad;
/// --- not yet supported ---
uint_least16_t songLength;
/**
* Song title, credits, ...
* 0 = Title, 1 = Author, 2 = Copyright/Publisher
*/
uint_least8_t numberOfInfoStrings;
/// the number of available text info lines
char* infoString[SIDTUNE_MAX_CREDIT_STRINGS]; char* infoString[SIDTUNE_MAX_CREDIT_STRINGS];
//
uint_least16_t numberOfCommentStrings; // --- not yet supported --- /// --- not yet supported ---
char ** commentString; // --- not yet supported --- uint_least16_t numberOfCommentStrings;
//
uint_least32_t dataFileLen; // length of single-file sidtune file /// --- not yet supported ---
uint_least32_t c64dataLen; // length of raw C64 data without load a char ** commentString;
ddress
char* path; // path to sidtune files; "", if cwd /// length of single-file sidtune file
char* dataFileName; // a first file: e.g. "foo.c64"; "", if uint_least32_t dataFileLen;
none
char* infoFileName; // a second file: e.g. "foo.sid"; "", if /// length of raw C64 data without load address
none uint_least32_t c64dataLen;
//
/// path to sidtune files; "", if cwd
char* path;
/// a first file: e.g. "foo.c64"; "", if none
char* dataFileName;
/// a second file: e.g. "foo.sid"; "", if none
char* infoFileName;
}; };
/**
* SidTune
*/
class SID_EXTERN SidTune class SID_EXTERN SidTune
{ {
private: private:
typedef enum typedef enum
{ {
LOAD_NOT_MINE = 0, LOAD_NOT_MINE = 0,
LOAD_OK, LOAD_OK,
LOAD_ERROR LOAD_ERROR
} LoadStatus; } LoadStatus;
public: // -------------------------------------------------------------- -- public: // -------------------------------------------------------------- --
// If your opendir() and readdir()->d_name return path names /**
// that contain the forward slash (/) as file separator, but * Load a sidtune from a file.
// your operating system uses a different character, there are *
// extra functions that can deal with this special case. Set * To retrieve data from standard input pass in filename "-".
// separatorIsSlash to true if you like path names to be split * If you want to override the default filename extensions use this
// correctly. * contructor. Please note, that if the specified ``sidTuneFileName''
// You do not need these extra functions if your systems file * does exist and the loader is able to determine its file format,
// separator is the forward slash. * this function does not try to append any file name extension.
// * See ``sidtune.cpp'' for the default list of file name extensions.
// Load a sidtune from a file. * You can specific ``sidTuneFileName = 0'', if you do not want to
// * load a sidtune. You can later load one with open().
// 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.
// You can specific ``sidTuneFileName = 0'', if you do not want to
// load a sidtune. You can later load one with open().
SidTune(const char* fileName, const char **fileNameExt = 0, SidTune(const char* fileName, const char **fileNameExt = 0,
const bool separatorIsSlash = false); const bool separatorIsSlash = false);
// Load a single-file sidtune from a memory buffer. /**
// Currently supported: PSID format * Load a single-file sidtune from a memory buffer.
* Currently supported: PSID format
*/
SidTune(const uint_least8_t* oneFileFormatSidtune, const uint_least32_t sidtuneLength); SidTune(const uint_least8_t* oneFileFormatSidtune, const uint_least32_t sidtuneLength);
virtual ~SidTune(); virtual ~SidTune();
// The sidTune class does not copy the list of file name extensions, /**
// so make sure you keep it. If the provided pointer is 0, the * The sidTune class does not copy the list of file name extensions,
// default list will be activated. This is a static list which * so make sure you keep it. If the provided pointer is 0, the
// is used by all SidTune objects. * default list will be activated. This is a static list which
*
* is used by all SidTune objects.
*/
void setFileNameExtensions(const char **fileNameExt); void setFileNameExtensions(const char **fileNameExt);
// Load a sidtune into an existing object. /**
// From a file. * Load a sidtune into an existing object.
* From a file.
*/
bool load(const char* fileName, const bool separatorIsSlash = false); bool load(const char* fileName, const bool separatorIsSlash = false);
// From a buffer. /**
* From a buffer.
*/
bool read(const uint_least8_t* sourceBuffer, const uint_least32_t buffe rLen); bool read(const uint_least8_t* sourceBuffer, const uint_least32_t buffe rLen);
// Select sub-song (0 = default starting song) /**
// and retrieve active song information. * Select sub-song (0 = default starting song)
* and retrieve active song information.
*/
const SidTuneInfo& operator[](const uint_least16_t songNum); const SidTuneInfo& operator[](const uint_least16_t songNum);
// Select sub-song (0 = default starting song) /**
// and return active song number out of [1,2,..,SIDTUNE_MAX_SONGS]. * Select sub-song (0 = default starting song)
* and return active song number out of [1,2,..,SIDTUNE_MAX_SONGS].
*/
uint_least16_t selectSong(const uint_least16_t songNum); uint_least16_t selectSong(const uint_least16_t songNum);
// Retrieve sub-song specific information. /**
// Beware! Still member-wise copy! * Retrieve sub-song specific information.
* Beware! Still member-wise copy!
*/
const SidTuneInfo& getInfo(); const SidTuneInfo& getInfo();
// Get a copy of sub-song specific information. /**
// Beware! Still member-wise copy! * Get a copy of sub-song specific information.
* Beware! Still member-wise copy!
*/
void getInfo(SidTuneInfo&); void getInfo(SidTuneInfo&);
// Determine current state of object (true = okay, false = error). /**
// Upon error condition use ``getInfo'' to get a descriptive * Determine current state of object (true = okay, false = error).
// text string in ``SidTuneInfo.statusString''. * Upon error condition use ``getInfo'' to get a descriptive
* text string in ``SidTuneInfo.statusString''.
*/
operator bool() { return status; } operator bool() { return status; }
bool getStatus() { return status; } bool getStatus() { return status; }
// Whether sidtune uses two SID chips. /**
* Whether sidtune uses two SID chips.
*/
bool isStereo() bool isStereo()
{ {
return (info.sidChipBase1!=0 && info.sidChipBase2!=0); return (info.sidChipBase1!=0 && info.sidChipBase2!=0);
} }
// Copy sidtune into C64 memory (64 KB). /**
* Copy sidtune into C64 memory (64 KB).
*/
bool placeSidTuneInC64mem(uint_least8_t* c64buf); bool placeSidTuneInC64mem(uint_least8_t* c64buf);
// --- file save & format conversion --- // --- file save & format conversion ---
// These functions work for any successfully created object. /**
// overWriteFlag: true = Overwrite existing file. * These functions work for any successfully created object.
// false = Default, return error when file already * overWriteFlag: true = Overwrite existing file.
// exists. * false = Default, return error when file already
// One could imagine an "Are you sure ?"-checkbox before overwriting * exists.
// any file. * One could imagine an "Are you sure ?"-checkbox before overwriting
// returns: true = Successful, false = Error condition. * any file.
* returns: true = Successful, false = Error condition.
*/
bool saveC64dataFile( const char* destFileName, const bool overWriteFla g = false ); bool saveC64dataFile( const char* destFileName, const bool overWriteFla g = false );
bool saveSIDfile( const char* destFileName, const bool overWriteFlag = false ); bool saveSIDfile( const char* destFileName, const bool overWriteFlag = false );
bool savePSIDfile( const char* destFileName, const bool overWriteFlag = false ); bool savePSIDfile( const char* destFileName, const bool overWriteFlag = false );
// This function can be used to remove a duplicate C64 load address in /**
// the C64 data (example: FE 0F 00 10 4C ...). A duplicate load address * This function can be used to remove a duplicate C64 load address in
// of offset 0x02 is indicated by the ``fixLoad'' flag in the SidTuneIn * the C64 data (example: FE 0F 00 10 4C ...). A duplicate load address
fo * of offset 0x02 is indicated by the ``fixLoad'' flag in the SidTuneInf
// structure. o
// * structure.
// The ``force'' flag here can be used to remove the first load address *
// and set new INIT/PLAY addresses regardless of whether a duplicate * The ``force'' flag here can be used to remove the first load address
// load address has been detected and indicated by ``fixLoad''. * and set new INIT/PLAY addresses regardless of whether a duplicate
// For instance, some position independent sidtunes contain a load addr * load address has been detected and indicated by ``fixLoad''.
ess * For instance, some position independent sidtunes contain a load addre
// of 0xE000, but are loaded to 0x0FFE and call the player code at 0x10 ss
00. * of 0xE000, but are loaded to 0x0FFE and call the player code at 0x100
// 0.
// Do not forget to save the sidtune file. *
* Do not forget to save the sidtune file.
*/
void fixLoadAddress(const bool force = false, uint_least16_t initAddr = 0, void fixLoadAddress(const bool force = false, uint_least16_t initAddr = 0,
uint_least16_t playAddr = 0); uint_least16_t playAddr = 0);
// Does not affect status of object, and therefore can be used /**
// to load files. Error string is put into info.statusString, though. * Does not affect status of object, and therefore can be used
* to load files. Error string is put into info.statusString, though.
*/
bool loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& bufferRef); bool loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& bufferRef);
bool saveToOpenFile( std::ofstream& toFile, const uint_least8_t* buffer , uint_least32_t bufLen ); bool saveToOpenFile( std::ofstream& toFile, const uint_least8_t* buffer , uint_least32_t bufLen );
protected: // ----------------------------------------------------------- -- protected: // ----------------------------------------------------------- --
SidTuneInfo info; SidTuneInfo info;
bool status; bool status;
uint_least8_t songSpeed[SIDTUNE_MAX_SONGS]; uint_least8_t songSpeed[SIDTUNE_MAX_SONGS];
uint_least8_t clockSpeed[SIDTUNE_MAX_SONGS]; uint_least8_t clockSpeed[SIDTUNE_MAX_SONGS];
uint_least16_t songLength[SIDTUNE_MAX_SONGS]; uint_least16_t songLength[SIDTUNE_MAX_SONGS];
// holds text info from the format headers etc. /// holds text info from the format headers etc.
char infoString[SIDTUNE_MAX_CREDIT_STRINGS][SIDTUNE_MAX_CREDIT_STRLEN]; char infoString[SIDTUNE_MAX_CREDIT_STRINGS][SIDTUNE_MAX_CREDIT_STRLEN];
// See instructions at top. /**
* If 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.
*/
bool isSlashedFileName; bool isSlashedFileName;
// For files with header: offset to real data /// For files with header: offset to real data
uint_least32_t fileOffset; uint_least32_t fileOffset;
// Needed for MUS/STR player installation. /// Needed for MUS/STR player installation.
uint_least16_t musDataLen; uint_least16_t musDataLen;
Buffer_sidtt<const uint_least8_t> cache; Buffer_sidtt<const uint_least8_t> cache;
// Filename extensions to append for various file types. /// Filename extensions to append for various file types.
static const char** fileNameExtensions; static const char** fileNameExtensions;
// --- protected member functions --- // --- protected member functions ---
// Convert 32-bit PSID-style speed word to internal tables. /// Convert 32-bit PSID-style speed word to internal tables.
void convertOldStyleSpeedToTables(uint_least32_t speed, void convertOldStyleSpeedToTables(uint_least32_t speed,
int clock = SIDTUNE_CLOCK_PAL); int clock = SIDTUNE_CLOCK_PAL);
virtual int convertPetsciiToAscii (SmartPtr_sidtt<const uint_least8_t>& , char*); virtual int convertPetsciiToAscii (SmartPtr_sidtt<const uint_least8_t>& , char*);
// Check compatibility details are sensible /// Check compatibility details are sensible
bool checkCompatibility(void); bool checkCompatibility(void);
// Check for valid relocation information /// Check for valid relocation information
bool checkRelocInfo(void); bool checkRelocInfo(void);
// Common address resolution procedure /// Common address resolution procedure
bool resolveAddrs(const uint_least8_t* c64data); bool resolveAddrs(const uint_least8_t* c64data);
// Support for various file formats. // Support for various file formats.
virtual LoadStatus PSID_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf); virtual LoadStatus PSID_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf);
virtual bool PSID_fileSupportSave(std::ofstream& toFile, const ui nt_least8_t* dataBuffer); virtual bool PSID_fileSupportSave(std::ofstream& toFile, const ui nt_least8_t* dataBuffer);
virtual LoadStatus SID_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf, virtual LoadStatus SID_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf,
Buffer_sidtt<const uint_least8_ t>& sidBuf); Buffer_sidtt<const uint_least8_ t>& sidBuf);
virtual bool SID_fileSupportSave (std::ofstream& toFile); virtual bool SID_fileSupportSave (std::ofstream& toFile);
skipping to change at line 311 skipping to change at line 394
virtual void MUS_setPlayerAddress(); virtual void MUS_setPlayerAddress();
virtual void MUS_installPlayer (uint_least8_t *c64buf); virtual void MUS_installPlayer (uint_least8_t *c64buf);
virtual LoadStatus INFO_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf, virtual LoadStatus INFO_fileSupport (Buffer_sidtt<const uint_least8_ t>& dataBuf,
Buffer_sidtt<const uint_least8_ t>& infoBuf); Buffer_sidtt<const uint_least8_ t>& infoBuf);
virtual LoadStatus PRG_fileSupport (const char* fileName, virtual LoadStatus PRG_fileSupport (const char* fileName,
Buffer_sidtt<const uint_least8_ t>& dataBuf); Buffer_sidtt<const uint_least8_ t>& dataBuf);
virtual LoadStatus X00_fileSupport (const char* fileName, virtual LoadStatus X00_fileSupport (const char* fileName,
Buffer_sidtt<const uint_least8_ t>& dataBuf); Buffer_sidtt<const uint_least8_ t>& dataBuf);
// Error and status message strings. /// @name Error and status message strings.
//@{
static const char* txt_songNumberExceed; static const char* txt_songNumberExceed;
static const char* txt_empty; static const char* txt_empty;
static const char* txt_unrecognizedFormat; static const char* txt_unrecognizedFormat;
static const char* txt_noDataFile; static const char* txt_noDataFile;
static const char* txt_notEnoughMemory; static const char* txt_notEnoughMemory;
static const char* txt_cantLoadFile; static const char* txt_cantLoadFile;
static const char* txt_cantOpenFile; static const char* txt_cantOpenFile;
static const char* txt_fileTooLong; static const char* txt_fileTooLong;
static const char* txt_dataTooLong; static const char* txt_dataTooLong;
static const char* txt_cantCreateFile; static const char* txt_cantCreateFile;
static const char* txt_fileIoError; static const char* txt_fileIoError;
static const char* txt_VBI; static const char* txt_VBI;
static const char* txt_CIA; static const char* txt_CIA;
static const char* txt_noErrors; static const char* txt_noErrors;
static const char* txt_na; static const char* txt_na;
static const char* txt_badAddr; static const char* txt_badAddr;
static const char* txt_badReloc; static const char* txt_badReloc;
static const char* txt_corrupt; static const char* txt_corrupt;
//@}
private: // ------------------------------------------------------------- -- private: // ------------------------------------------------------------- --
void init(); void init();
void cleanup(); void cleanup();
#if !defined(SIDTUNE_NO_STDIN_LOADER) #if !defined(SIDTUNE_NO_STDIN_LOADER)
void getFromStdIn(); void getFromStdIn();
#endif #endif
void getFromFiles(const char* name); void getFromFiles(const char* name);
void deleteFileNameCopies(); void deleteFileNameCopies();
// Try to retrieve single-file sidtune from specified buffer. /// Try to retrieve single-file sidtune from specified buffer.
void getFromBuffer(const uint_least8_t* const buffer, const uint_least3 2_t bufferLen); void getFromBuffer(const uint_least8_t* const buffer, const uint_least3 2_t bufferLen);
// Cache the data of a single-file or two-file sidtune and its /**
// corresponding file names. * Cache the data of a single-file or two-file sidtune and its
* corresponding file names.
*/
bool acceptSidTune(const char* dataFileName, const char* infoFileName, bool acceptSidTune(const char* dataFileName, const char* infoFileName,
Buffer_sidtt<const uint_least8_t>& buf); Buffer_sidtt<const uint_least8_t>& buf);
bool createNewFileName(Buffer_sidtt<char>& destString, bool createNewFileName(Buffer_sidtt<char>& destString,
const char* sourceName, const char* sourceExt); const char* sourceName, const char* sourceExt);
int decompressPP20(Buffer_sidtt<const uint_least8_t>& buf); int decompressPP20(Buffer_sidtt<const uint_least8_t>& buf);
private: // prevent copying private: // prevent copying
SidTune(const SidTune&); SidTune(const SidTune&);
 End of changes. 43 change blocks. 
145 lines changed or deleted 222 lines changed or added


 SidTuneMod.h   SidTuneMod.h 
skipping to change at line 24 skipping to change at line 24
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U SA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U SA
*/ */
#ifndef SIDTUNEMOD_H #ifndef SIDTUNEMOD_H
#define SIDTUNEMOD_H #define SIDTUNEMOD_H
#include "sidplayfp/SidTune.h" #include "sidplayfp/SidTune.h"
#define SIDTUNE_MD5_LENGTH 32 #define SIDTUNE_MD5_LENGTH 32
/**
* SidTuneMod
* A wrapper around SidTune class which provides the ability
* to calculate the tune's md5 hash to match against songlenth DB.
*/
class SID_EXTERN SidTuneMod : public SidTune class SID_EXTERN SidTuneMod : public SidTune
{ {
private: private:
char m_md5[SIDTUNE_MD5_LENGTH+1]; char m_md5[SIDTUNE_MD5_LENGTH+1];
public: // --------------------------------------------------------- publ ic public: // --------------------------------------------------------- publ ic
SidTuneMod(const char* fileName) : SidTune(fileName) SidTuneMod(const char* fileName) : SidTune(fileName)
{ ; } { ; }
// Not providing an md5 buffer will cause the internal one to be used /**
const char *createMD5(char *md5 = 0); // Buffer must be SIDTUNE_MD5_LEN * Calculates the MD5 hash of the tune.
GTH + 1 * Not providing an md5 buffer will cause the internal one to be used.
* If provided, buffer must be SIDTUNE_MD5_LENGTH + 1
* @return a pointer to the buffer containing the md5 string.
*/
const char *createMD5(char *md5 = 0);
}; };
#endif /* SIDTUNEMOD_H */ #endif /* SIDTUNEMOD_H */
 End of changes. 2 change blocks. 
3 lines changed or deleted 12 lines changed or added


 SidUsage.h   SidUsage.h 
skipping to change at line 26 skipping to change at line 26
************************************************************************** */ ************************************************************************** */
#ifndef _SidUsage_h_ #ifndef _SidUsage_h_
#define _SidUsage_h_ #define _SidUsage_h_
#include "sidplayfp/sidusage.h" #include "sidplayfp/sidusage.h"
#include "SidTuneMod.h" #include "SidTuneMod.h"
struct SidTuneInfo; struct SidTuneInfo;
// Extended usuage information /**
* Extended usage information
*/
struct sid2_usage_t: public sid_usage_t struct sid2_usage_t: public sid_usage_t
{ {
uint_least16_t start; // Load image start address uint_least16_t start; ///< Load image start address
uint_least16_t end; // Load image end address uint_least16_t end; ///< Load image end address
char md5[SIDTUNE_MD5_LENGTH + 1]; // Tunes MD5 key char md5[SIDTUNE_MD5_LENGTH + 1]; ///< Tunes MD5 key
uint_least16_t length; // usage scan length uint_least16_t length; ///< usage scan length
// Copy common parts of basic usage to extended usage. /// Copy common parts of basic usage to extended usage.
sid2_usage_t &operator= (const sid_usage_t &usage) sid2_usage_t &operator= (const sid_usage_t &usage)
{ {
*((sid_usage_t *) this) = usage; *((sid_usage_t *) this) = usage;
return *this; return *this;
} }
}; };
/**
* SidUsage
*/
class SID_EXTERN SidUsage class SID_EXTERN SidUsage
{ {
private: private:
char m_decodeMAP[0x100][3]; char m_decodeMAP[0x100][3];
// Ignore errors // Ignore errors
uint_least8_t m_filterMAP[0x10000]; uint_least8_t m_filterMAP[0x10000];
protected: protected:
bool m_status; bool m_status;
const char *m_errorString; const char *m_errorString;
 End of changes. 4 change blocks. 
6 lines changed or deleted 11 lines changed or added


 c64env.h   c64env.h 
skipping to change at line 38 skipping to change at line 38
class c64env class c64env
{ {
private: private:
EventContext &m_context; EventContext &m_context;
public: public:
c64env (EventContext *context) c64env (EventContext *context)
:m_context (*context) {} :m_context (*context) {}
EventContext &context (void) const { return m_context; } EventContext &context (void) const { return m_context; }
virtual void interruptIRQ (bool state) = 0; virtual void interruptIRQ (const bool state) = 0;
virtual void interruptNMI (void) = 0; virtual void interruptNMI (void) = 0;
virtual void interruptRST (void) = 0; virtual void interruptRST (void) = 0;
virtual void signalAEC (bool state) = 0; virtual void signalAEC (const bool state) = 0;
virtual uint8_t readMemRamByte (uint_least16_t addr) = 0; virtual uint8_t readMemRamByte (const uint_least16_t addr) = 0;
virtual void sid2crc (uint8_t data) = 0; virtual void sid2crc (const uint8_t data) = 0;
virtual void lightpen () = 0; virtual void lightpen () = 0;
}; };
#endif // _c64env_h_ #endif // _c64env_h_
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 event.h   event.h 
skipping to change at line 24 skipping to change at line 24
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
************************************************************************** */ ************************************************************************** */
#ifndef _event_h_ #ifndef _event_h_
#define _event_h_ #define _event_h_
#include "sidtypes.h" #include "sidtypes.h"
typedef uint_fast32_t event_clock_t; typedef int_fast64_t event_clock_t;
/**
* C64 system runs actions at system clock high and low
* states. The PHI1 corresponds to the auxiliary chip activity
* and PHI2 to CPU activity. For any clock, PHI1s are before
* PHI2s.
*/
typedef enum {EVENT_CLOCK_PHI1 = 0, EVENT_CLOCK_PHI2 = 1} event_phase_t; typedef enum {EVENT_CLOCK_PHI1 = 0, EVENT_CLOCK_PHI2 = 1} event_phase_t;
#define EVENT_CONTEXT_MAX_PENDING_EVENTS 0x100
/**
* Event scheduler (based on alarm from Vice). Created in 2001 by Simon A.
* White.
*
* Optimized EventScheduler and corresponding Event class by Antti S. Lankil
a
* in 2009.
*
* @author Antti Lankila
*/
class SID_EXTERN Event class SID_EXTERN Event
{ {
friend class EventScheduler; friend class EventScheduler;
private: private:
class EventContext *m_context SID_DEPRECATED;
/** Describe event for humans. */
const char * const m_name; const char * const m_name;
class EventContext *m_context;
event_clock_t m_clk;
/* This variable is set by the event context /** The clock this event fires */
when it is scheduled */ event_clock_t triggerTime;
/**
* This variable is set by the event context
* when it is scheduled
*/
bool m_pending; bool m_pending;
/* Link to the next and previous events in the /** The next event in sequence */
list. */ Event *next;
Event *m_next, *m_prev;
public: public:
/**
* Events are used for delayed execution. Name is
* not used by code, but is useful for debugging.
*
* @param name Descriptive string of the event.
*/
Event(const char * const name) Event(const char * const name)
: m_name(name), : m_name(name),
m_pending(false) {} m_pending(false) {}
~Event() {} ~Event() {}
/**
* Event code to be executed. Events are allowed to safely
* reschedule themselves with the EventScheduler during
* invocations.
*/
virtual void event (void) = 0; virtual void event (void) = 0;
bool pending () { return m_pending; }
void cancel (); /** Is Event scheduled? */
void schedule(EventContext &context, event_clock_t cycles, bool pending () const { return m_pending; }
/**
* Cancel the specified event.
*
* @deprecated use EventContext::cancel
*/
SID_DEPRECATED void cancel ();
/**
* Add event to pending queue.
*
* @deprecated use EventContext::schedule
*/
SID_DEPRECATED void schedule(EventContext &context, event_clock_t cy
cles,
event_phase_t phase); event_phase_t phase);
}; };
template< class This > template< class This >
class EventCallback: public Event class EventCallback: public Event
{ {
private: private:
typedef void (This::*Callback) (); typedef void (This::*Callback) ();
This &m_this; This &m_this;
Callback const m_callback; Callback const m_callback;
skipping to change at line 80 skipping to change at line 125
m_callback(callback) {} m_callback(callback) {}
}; };
// Public Event Context // Public Event Context
class EventContext class EventContext
{ {
friend class Event; friend class Event;
public: public:
virtual void cancel (Event &event) = 0; virtual void cancel (Event &event) = 0;
virtual void schedule (Event &event, event_clock_t cycles, virtual void schedule (Event &event, const event_clock_t cycles,
event_phase_t phase) = 0; const event_phase_t phase) = 0;
virtual event_clock_t getTime (event_phase_t phase) const = 0; virtual void schedule (Event &event, const event_clock_t cycles) = 0;
virtual event_clock_t getTime (event_clock_t clock, event_phase_t phase virtual event_clock_t getTime (const event_phase_t phase) const = 0;
) const = 0; virtual event_clock_t getTime (const event_clock_t clock, const event_p
hase_t phase) const = 0;
virtual event_phase_t phase () const = 0; virtual event_phase_t phase () const = 0;
}; };
// Private Event Context Object (The scheduler) /**
class EventScheduler: public EventContext, public Event * Fast EventScheduler, which maintains a linked list of Events.
* This scheduler takes neglible time even when it is used to
* schedule events for nearly every clock.
*
* Events occur on an internal clock which is 2x the visible clock.
* The visible clock is divided to two phases called phi1 and phi2.
*
* The phi1 clocks are used by VIC and CIA chips, phi2 clocks by CPU.
*
* Scheduling an event for a phi1 clock when system is in phi2 causes the
* event to be moved to the next cycle. (This behavior may be a bug of the
* original EventScheduler specification. Likely reason is to avoid
* scheduling an event into past.)
*
* Getting a phi1 time when system is in phi2 causes the next phi1 clock
* to be returned.
*
* To make scheduling even faster, I am considering making event cancellatio
n
* before rescheduling mandatory, as caller is generally in position to
* automatically know if the event needs to be canceled first.
*
* @author Antti S. Lankila
*/
class EventScheduler: public EventContext
{ {
private: private:
EventCallback<EventScheduler> m_timeWarp; event_clock_t currentTime;
uint m_events; Event *firstEvent;
uint m_events_future;
private: private:
void event (void); void event (void);
/**
* Scan the event queue and schedule event for execution.
*
* @param event The event to add
*/
void schedule(Event &event) {
if (event.m_pending)
cancel(event);
event.m_pending = true;
/* find the right spot where to tuck this new event */
Event **scan = &firstEvent;
for (;;) {
if (*scan == 0 || (*scan)->triggerTime > event.triggerTime) {
event.next = *scan;
*scan = &event;
break;
}
scan = &((*scan)->next);
}
}
protected: protected:
void schedule (Event &event, event_clock_t cycles, /** Add event to pending queue.
event_phase_t phase); *
void cancel (Event &event) * @param event the event to add
{ * @param cycles the clock to fire
event.m_pending = false; * @param phase when to fire the event
event.m_prev->m_next = event.m_next; */
event.m_next->m_prev = event.m_prev; void schedule (Event &event, const event_clock_t cycles,
m_events--; const event_phase_t phase) {
event.triggerTime = (cycles << 1) + currentTime + (currentTime & 1
^ (phase == EVENT_CLOCK_PHI1 ? 0 : 1));
schedule(event);
}
/** Add event to pending queue in the same phase as current event.
*
* @param event the event to add
* @param cycles how many cycles from now to fire
*/
void schedule(Event &event, const event_clock_t cycles) {
event.triggerTime = (cycles << 1) + currentTime;
schedule(event);
} }
/** Cancel the specified event.
*
* @param event the event to cancel
*/
void cancel (Event &event);
public: public:
EventScheduler (const char * const name); EventScheduler ()
: currentTime(0),
firstEvent(0) {}
/** Cancel all pending events and reset time. */
void reset (void); void reset (void);
/** Fire next event, advance system time to that event */
void clock (void) void clock (void)
{ {
// m_clk++; Event &event = *firstEvent;
// while (m_events && (m_clk >= m_next->m_clk)) firstEvent = firstEvent->next;
// dispatch (*m_next); event.m_pending = false;
Event &e = *m_next; currentTime = event.triggerTime;
m_clk = e.m_clk; event.event();
cancel (e);
//printf ("Event \"%s\"\n", e.m_name);
e.event();
} }
// Get time with respect to a specific clock phase /** Get time with respect to a specific clock phase
event_clock_t getTime (event_phase_t phase) const *
{ return (m_clk + (phase ^ 1)) >> 1; } * @param phase the phase
event_clock_t getTime (event_clock_t clock, event_phase_t phase) const * @return the time according to specified phase.
{ return ((getTime (phase) - clock) << 1) >> 1; } // 31 bit res. */
event_phase_t phase () const { return (event_phase_t) (m_clk & 1); } event_clock_t getTime (const event_phase_t phase) const
{ return (currentTime + (phase ^ 1)) >> 1; }
/** Get clocks since specified clock in given phase.
*
* @param clock the time to compare to
* @param phase the phase to comapre to
* @return the time between specified clock and now
*/
event_clock_t getTime (const event_clock_t clock, const event_phase_t p
hase) const
{ return getTime (phase) - clock; }
/** Return current clock phase
*
* @return The current phase
*/
event_phase_t phase () const { return (event_phase_t) (currentTime & 1)
; }
}; };
inline void Event::schedule (EventContext &context, event_clock_t cycles, inline void Event::schedule (EventContext &context, event_clock_t cycles,
event_phase_t phase) event_phase_t phase)
{ {
context.schedule (*this, cycles, phase); m_context = &context;
m_context->schedule (*this, cycles, phase);
} }
inline void Event::cancel () inline void Event::cancel ()
{ {
if (m_pending) if (m_pending)
m_context->cancel (*this); m_context->cancel (*this);
} }
#endif // _event_h_ #endif // _event_h_
 End of changes. 21 change blocks. 
46 lines changed or deleted 181 lines changed or added


 hardsid.h   hardsid.h 
skipping to change at line 41 skipping to change at line 41
* *
* *
************************************************************************** */ ************************************************************************** */
#ifndef _hardsid_h_ #ifndef _hardsid_h_
#define _hardsid_h_ #define _hardsid_h_
#include <vector> #include <vector>
#include "sidplayfp/sidbuilder.h" #include "sidplayfp/sidbuilder.h"
/**
* HardSID Builder Class
*/
class SID_EXTERN HardSIDBuilder: public sidbuilder class SID_EXTERN HardSIDBuilder: public sidbuilder
{ {
private: private:
static bool m_initialised; static bool m_initialised;
char m_errorBuffer[100]; char m_errorBuffer[100];
std::vector<sidemu *> sidobjs; std::vector<sidemu *> sidobjs;
#ifndef _WIN32 #ifndef _WIN32
static uint m_count; static uint m_count;
#endif #endif
int init (void); int init (void);
public: public:
HardSIDBuilder (const char * const name); HardSIDBuilder (const char * const name);
~HardSIDBuilder (void); ~HardSIDBuilder (void);
// true will give you the number of used devices.
// return values: 0 none, positive is used sids /**
// false will give you all available sids. * true will give you the number of used devices.
// return values: 0 endless, positive is available sids. * return values: 0 none, positive is used sids
// use bool operator to determine error * false will give you all available sids.
* return values: 0 endless, positive is available sids.
* use bool operator to determine error
*/
uint devices (bool used); uint devices (bool used);
sidemu *lock (c64env *env, sid2_model_t model); sidemu *lock (c64env *env, sid2_model_t model);
void unlock (sidemu *device); void unlock (sidemu *device);
void remove (void); void remove (void);
const char *error (void) const { return m_errorBuffer; } const char *error (void) const { return m_errorBuffer; }
const char *credits (void); const char *credits (void);
void flush (void); void flush (void);
void filter (bool enable); void filter (bool enable);
uint create (uint sids); uint create (uint sids);
 End of changes. 2 change blocks. 
5 lines changed or deleted 11 lines changed or added


 resid.h   resid.h 
skipping to change at line 28 skipping to change at line 28
#ifndef _resid_h_ #ifndef _resid_h_
#define _resid_h_ #define _resid_h_
/* Since ReSID is not part of this project we are actually /* Since ReSID is not part of this project we are actually
* creating a wrapper instead of implementing a SID emulation * creating a wrapper instead of implementing a SID emulation
*/ */
#include <vector> #include <vector>
#include "sidplayfp/sidbuilder.h" #include "sidplayfp/sidbuilder.h"
/************************************************************************** /**
* * ReSID Builder Class
* ReSID Builder Class */
**************************************************************************
*/
// Create the SID builder object
class SID_EXTERN ReSIDBuilder: public sidbuilder class SID_EXTERN ReSIDBuilder: public sidbuilder
{ {
protected: protected:
std::vector<sidemu *> sidobjs; std::vector<sidemu *> sidobjs;
private: private:
static const char *ERR_FILTER_DEFINITION; static const char *ERR_FILTER_DEFINITION;
char m_errorBuffer[100];
const char *m_error; const char *m_error;
char m_errorBuffer[100];
public: public:
ReSIDBuilder (const char * const name); ReSIDBuilder (const char * const name);
~ReSIDBuilder (void); ~ReSIDBuilder (void);
// true will give you the number of used devices.
// return values: 0 none, positive is used sids /**
// false will give you all available sids. * true will give you the number of used devices.
// return values: 0 endless, positive is available sids. * return values: 0 none, positive is used sids
// use bool operator to determine error * false will give you all available sids.
* return values: 0 endless, positive is available sids.
* use bool operator to determine error
*/
uint devices (bool used); uint devices (bool used);
uint create (uint sids); uint create (uint sids);
sidemu *lock (c64env *env, sid2_model_t model); sidemu *lock (c64env *env, sid2_model_t model);
void unlock (sidemu *device); void unlock (sidemu *device);
void remove (void); void remove (void);
const char *error (void) const { return m_error; } const char *error (void) const { return m_error; }
const char *credits (void); const char *credits (void);
// Settings that affect all SIDs /// @name global settings
/// Settings that affect all SIDs
//@{
/// enable/disable filter
void filter (bool enable); void filter (bool enable);
/// @deprecated does nothing
SID_DEPRECATED void filter (const sid_filter_t *filter) {}; SID_DEPRECATED void filter (const sid_filter_t *filter) {};
/* The bias is given in millivolts, and a maximum reasonable control ra /**
nge is * The bias is given in millivolts, and a maximum reasonable
approximately -500 to 500. */ * control range is approximately -500 to 500.
*/
void bias (const double dac_bias); void bias (const double dac_bias);
//@}
}; };
#endif // _resid_h_ #endif // _resid_h_
 End of changes. 8 change blocks. 
16 lines changed or deleted 23 lines changed or added


 residfp.h   residfp.h 
skipping to change at line 28 skipping to change at line 28
#ifndef _residfp_h_ #ifndef _residfp_h_
#define _residfp_h_ #define _residfp_h_
/* Since ReSID is not part of this project we are actually /* Since ReSID is not part of this project we are actually
* creating a wrapper instead of implementing a SID emulation * creating a wrapper instead of implementing a SID emulation
*/ */
#include <vector> #include <vector>
#include "sidplayfp/sidbuilder.h" #include "sidplayfp/sidbuilder.h"
/************************************************************************** /**
* * ReSIDfp Builder Class
* ReSID Builder Class */
**************************************************************************
*/
// Create the SID builder object
class SID_EXTERN ReSIDfpBuilder: public sidbuilder class SID_EXTERN ReSIDfpBuilder: public sidbuilder
{ {
protected: protected:
std::vector<sidemu *> sidobjs; std::vector<sidemu *> sidobjs;
private: private:
static const char *ERR_FILTER_DEFINITION; static const char *ERR_FILTER_DEFINITION;
char m_errorBuffer[100];
const char *m_error; const char *m_error;
char m_errorBuffer[100];
public: public:
ReSIDfpBuilder (const char * const name); ReSIDfpBuilder (const char * const name);
~ReSIDfpBuilder (void); ~ReSIDfpBuilder (void);
// true will give you the number of used devices.
// return values: 0 none, positive is used sids /**
// false will give you all available sids. * true will give you the number of used devices.
// return values: 0 endless, positive is available sids. * return values: 0 none, positive is used sids
// use bool operator to determine error * false will give you all available sids.
* return values: 0 endless, positive is available sids.
* use bool operator to determine error
*/
uint devices (bool used); uint devices (bool used);
uint create (uint sids); uint create (uint sids);
sidemu *lock (c64env *env, sid2_model_t model); sidemu *lock (c64env *env, sid2_model_t model);
void unlock (sidemu *device); void unlock (sidemu *device);
void remove (void); void remove (void);
const char *error (void) const { return m_error; } const char *error (void) const { return m_error; }
const char *credits (void); const char *credits (void);
// Settings that affect all SIDs /// @name global settings
/// Settings that affect all SIDs
//@{
/// enable/disable filter
void filter (bool enable); void filter (bool enable);
/// @deprecated does nothing
SID_DEPRECATED void filter (const sid_filterfp_t *filter) {}; SID_DEPRECATED void filter (const sid_filterfp_t *filter) {};
/**
* Set 6581 filter curve
*
* @param filterCurve from 0.0 (light) to 1.0 (dark) (default 0.5)
*/
void filter6581Curve (const double filterCurve); void filter6581Curve (const double filterCurve);
/**
* Set 8580 filter curve
*
* @param filterCurve curve center frequency (default 12500)
*/
void filter8580Curve (const double filterCurve); void filter8580Curve (const double filterCurve);
//@}
}; };
#endif // _resid_h_ #endif // _resid_h_
 End of changes. 9 change blocks. 
13 lines changed or deleted 30 lines changed or added


 sid2types.h   sid2types.h 
skipping to change at line 39 skipping to change at line 39
// Maximum values // Maximum values
// Delays <= MAX produce constant results. // Delays <= MAX produce constant results.
// Delays > MAX produce random results // Delays > MAX produce random results
const uint_least16_t SID2_MAX_POWER_ON_DELAY = 0x1FFF; const uint_least16_t SID2_MAX_POWER_ON_DELAY = 0x1FFF;
// Default settings // Default settings
const uint_least32_t SID2_DEFAULT_SAMPLING_FREQ = 44100; const uint_least32_t SID2_DEFAULT_SAMPLING_FREQ = 44100;
const bool SID2_DEFAULT_SID_SAMPLES = true; // Samples thr ough sid const bool SID2_DEFAULT_SID_SAMPLES = true; // Samples thr ough sid
const uint_least16_t SID2_DEFAULT_POWER_ON_DELAY = SID2_MAX_POWER_ON_DE LAY + 1; const uint_least16_t SID2_DEFAULT_POWER_ON_DELAY = SID2_MAX_POWER_ON_DE LAY + 1;
#endif // SIDPLAY2_DEFAULTS #endif // SIDPLAY2_DEFAULTS
typedef enum {sid2_playing = 0, sid2_paused, sid2_stopped} sid2_pla yer_t; typedef enum {sid2_playing = 0, sid2_paused, sid2_stopped} sid2_player_t;
typedef enum {sid2_mono = 1, sid2_stereo} sid2_playback_t; typedef enum {sid2_mono = 1, sid2_stereo} sid2_playback_t;
typedef enum {sid2_envPS = 0, sid2_envTP, sid2_envBS, sid2_envR, typedef enum {sid2_envPS = 0, sid2_envTP, sid2_envBS, sid2_envR, sid2_envTR
sid2_envTR} sid2_env_t; } sid2_env_t;
typedef enum {SID2_MODEL_CORRECT, SID2_MOS6581, SID2_MOS8580} sid2_mod typedef enum {SID2_MODEL_CORRECT, SID2_MOS6581, SID2_MOS8580} sid2_model_t;
el_t;
typedef enum {SID2_CLOCK_CORRECT, SID2_CLOCK_PAL, SID2_CLOCK_NTSC} sid2_clo ck_t; typedef enum {SID2_CLOCK_CORRECT, SID2_CLOCK_PAL, SID2_CLOCK_NTSC} sid2_clo ck_t;
typedef enum {SID2_INTERPOLATE, SID2_RESAMPLE_INTERPOLATE} sampling_method_ t;
typedef enum { SID2_INTERPOLATE, SID2_RESAMPLE_INTERPOLATE } sampling_metho /**
d_t; * sid2_config_t
/* Environment Modes
sid2_envPS = Playsid
sid2_envTP = Sidplay - Transparent Rom
sid2_envBS = Sidplay - Bankswitching
sid2_envR = Sidplay2 - Real C64 Environment
*/ */
struct sid2_config_t struct sid2_config_t
{ {
sid2_clock_t clockDefault; // Intended tune speed when unknown /// Intended tune speed when unknown
sid2_clock_t clockDefault;
bool clockForced; bool clockForced;
sid2_clock_t clockSpeed; // User requested emulation speed /// User requested emulation speed
sid2_clock_t clockSpeed;
/**
* Environment Modes
* - sid2_envPS = Playsid
* - sid2_envTP = Sidplay - Transparent Rom
* - sid2_envBS = Sidplay - Bankswitching
* - sid2_envR = Sidplay2 - Real C64 Environment
*/
sid2_env_t environment; sid2_env_t environment;
bool forceDualSids; bool forceDualSids;
bool emulateStereo; bool emulateStereo;
uint_least32_t frequency; uint_least32_t frequency;
/**
* Playbak mode
* - sid2_mono
* - sid2_stereo
*/
sid2_playback_t playback; sid2_playback_t playback;
sid2_model_t sidDefault; // Intended sid model when unknown /**
* Intended sid model when unknown
* - SID2_MODEL_CORRECT
* - SID2_MOS6581
* - SID2_MOS8580
*/
sid2_model_t sidDefault;
sidbuilder *sidEmulation; sidbuilder *sidEmulation;
sid2_model_t sidModel; // User requested sid model /// User requested sid model
sid2_model_t sidModel;
bool sidSamples; bool sidSamples;
uint_least32_t leftVolume; uint_least32_t leftVolume;
uint_least32_t rightVolume; uint_least32_t rightVolume;
uint_least16_t powerOnDelay; uint_least16_t powerOnDelay;
uint_least32_t sid2crcCount; // Max sid writes to form crc /// Max sid writes to form crc
uint_least32_t sid2crcCount;
/**
* Sampling method
* - SID2_INTERPOLATE
* - SID2_RESAMPLE_INTERPOLATE
*/
sampling_method_t samplingMethod; sampling_method_t samplingMethod;
bool fastSampling; // Faster low-quality emulation /**
* Faster low-quality emulation
* available only for reSID
*/
bool fastSampling;
}; };
/**
* sid2_info_t
*/
struct sid2_info_t struct sid2_info_t
{ {
const char **credits; const char **credits;
uint channels; uint channels;
uint_least16_t driverAddr; uint_least16_t driverAddr;
uint_least16_t driverLength; uint_least16_t driverLength;
const char *name; const char *name;
const SidTuneInfo *tuneInfo; // May not need this const SidTuneInfo *tuneInfo; // May not need this
const char *version; const char *version;
// load, config and stop calls will reset this // load, config and stop calls will reset this
// and remove all pending events! 10th sec resolution. // and remove all pending events! 10th sec resolution.
EventContext *eventContext; EventContext *eventContext;
uint maxsids; uint maxsids;
sid2_env_t environment; sid2_env_t environment;
uint_least16_t powerOnDelay; uint_least16_t powerOnDelay;
uint_least32_t sid2crc; uint_least32_t sid2crc;
uint_least32_t sid2crcCount; // Number of sid writes forming crc /// Number of sid writes forming crc
uint_least32_t sid2crcCount;
}; };
#endif // _sid2types_h_ #endif // _sid2types_h_
 End of changes. 14 change blocks. 
21 lines changed or deleted 49 lines changed or added


 sidbuilder.h   sidbuilder.h 
skipping to change at line 70 skipping to change at line 70
class sidbuilder class sidbuilder
{ {
private: private:
const char * const m_name; const char * const m_name;
protected: protected:
bool m_status; bool m_status;
public: public:
// Determine current state of object (true = okay, false = error).
sidbuilder(const char * const name) sidbuilder(const char * const name)
: m_name(name), m_status (true) {;} : m_name(name), m_status (true) {;}
virtual ~sidbuilder() {;} virtual ~sidbuilder() {;}
virtual sidemu *lock (c64env *env, sid2_model_t model) = 0; virtual sidemu *lock (c64env *env, sid2_model_t model) = 0;
virtual void unlock (sidemu *device) = 0; virtual void unlock (sidemu *device) = 0;
const char *name (void) const { return m_name; } const char *name (void) const { return m_name; }
virtual const char *error (void) const = 0; virtual const char *error (void) const = 0;
virtual const char *credits (void) = 0; virtual const char *credits (void) = 0;
virtual void filter (bool enable) = 0; virtual void filter (bool enable) = 0;
// Determine current state of object (true = okay, false = error).
operator bool() const { return m_status; } operator bool() const { return m_status; }
}; };
#endif // _sidbuilder_h_ #endif // _sidbuilder_h_
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 sidplay2.h   sidplay2.h 
skipping to change at line 35 skipping to change at line 35
#include "sidversion.h" #include "sidversion.h"
class SidTune; class SidTune;
// Private Sidplayer // Private Sidplayer
namespace SIDPLAY2_NAMESPACE namespace SIDPLAY2_NAMESPACE
{ {
class Player; class Player;
} }
/**
* sidplay2
*/
class SID_EXTERN sidplay2 class SID_EXTERN sidplay2
{ {
private: private:
SIDPLAY2_NAMESPACE::Player &sidplayer; SIDPLAY2_NAMESPACE::Player &sidplayer;
public: public:
sidplay2 (); sidplay2 ();
virtual ~sidplay2 (); virtual ~sidplay2 ();
const sid2_config_t &config (void) const; const sid2_config_t &config (void) const;
const sid2_info_t &info (void) const; const sid2_info_t &info (void) const;
/**
* Configure the engine.
*
* @param cfg
* @return 0 on sucess, -1 otherwise.
*/
int config (const sid2_config_t &cfg); int config (const sid2_config_t &cfg);
/**
* Error message
*
* @return string error message.
*/
const char *error (void) const; const char *error (void) const;
/**
*
*
* @param percent
*/
int fastForward (uint percent); int fastForward (uint percent);
/**
* Load a tune
*
* @param tune the SidTune to load, 0 unloads current tune
* @return 0 on sucess, -1 otherwise
*/
int load (SidTune *tune); int load (SidTune *tune);
/**
* Pause the engine
*/
void pause (void); void pause (void);
/**
* Produce samples to play
*
* @param buffer pointer to the buffer to fill with samples.
* @param count the size of the buffer.
* @return the number of produced samples.
*/
uint_least32_t play (short *buffer, uint_least32_t count); uint_least32_t play (short *buffer, uint_least32_t count);
/**
* Check the state of the engine.
*
* @return
*/
sid2_player_t state (void) const; sid2_player_t state (void) const;
/**
* Stop engine
*/
void stop (void); void stop (void);
/**
* Control debugging
*
* @param enable enable/disable debugging.
* @param out the file where to redirect the debug info.
*/
void debug (bool enable, FILE *out); void debug (bool enable, FILE *out);
void mute (int voice, bool enable); void mute (int voice, bool enable);
// Timer functions with respect to resolution returned by timebase //@{
uint_least32_t timebase (void) const; /// Timer functions with respect to resolution returned by timebase
SID_DEPRECATED uint_least32_t timebase (void) const { return 1; }
uint_least32_t time (void) const; uint_least32_t time (void) const;
uint_least32_t mileage (void) const; uint_least32_t mileage (void) const;
//@}
operator bool() const { return (&sidplayer ? true: false); } operator bool() const { return (&sidplayer ? true: false); }
bool operator!() const { return (&sidplayer ? false: true); } bool operator!() const { return (&sidplayer ? false: true); }
}; };
#endif // _sidplay2_h_ #endif // _sidplay2_h_
 End of changes. 12 change blocks. 
2 lines changed or deleted 61 lines changed or added


 sidversion.h   sidversion.h 
#ifndef LIBSIDPLAYFP_VERSION_H #ifndef LIBSIDPLAYFP_VERSION_H
#define LIBSIDPLAYFP_VERSION_H #define LIBSIDPLAYFP_VERSION_H
#ifndef _sidplay2_h_ #ifndef _sidplay2_h_
# error Do not include directly. # error Do not include directly.
#endif #endif
#define LIBSIDPLAYFP_VERSION_MAJ 0 #define LIBSIDPLAYFP_VERSION_MAJ 0
#define LIBSIDPLAYFP_VERSION_MIN 2 #define LIBSIDPLAYFP_VERSION_MIN 3
#define LIBSIDPLAYFP_VERSION_LEV 0 #define LIBSIDPLAYFP_VERSION_LEV 0
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/