# HG changeset patch # User Matti Hamalainen # Date 1171990385 0 # Node ID fa95d942f2267193b3eec3a53e5376c8990a2978 # Parent 9395961504c1fd0f7baa77a0156ca0dd4988c10a Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions. diff -r 9395961504c1 -r fa95d942f226 src/xmms-sid.c --- a/src/xmms-sid.c Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xmms-sid.c Tue Feb 20 16:53:05 2007 +0000 @@ -43,6 +43,7 @@ #include "xs_fileinfo.h" #include "xs_interface.h" #include "xs_glade.h" +#include "xs_player.h" /* * Include player engines @@ -61,20 +62,22 @@ t_xs_player xs_playerlist[] = { #ifdef HAVE_SIDPLAY1 {XS_ENG_SIDPLAY1, - xs_sidplay1_isourfile, + xs_sidplay1_probe, xs_sidplay1_init, xs_sidplay1_close, xs_sidplay1_initsong, xs_sidplay1_fillbuffer, xs_sidplay1_load, xs_sidplay1_delete, - xs_sidplay1_getinfo, xs_sidplay1_updateinfo + xs_sidplay1_getinfo, xs_sidplay1_updateinfo, + NULL }, #endif #ifdef HAVE_SIDPLAY2 {XS_ENG_SIDPLAY2, - xs_sidplay2_isourfile, + xs_sidplay2_probe, xs_sidplay2_init, xs_sidplay2_close, xs_sidplay2_initsong, xs_sidplay2_fillbuffer, xs_sidplay2_load, xs_sidplay2_delete, - xs_sidplay2_getinfo, xs_sidplay2_updateinfo + xs_sidplay2_getinfo, xs_sidplay2_updateinfo, + xs_sidplay2_flush }, #endif }; @@ -274,7 +277,7 @@ if (xs_cfg.detectMagic) { t_xs_file *f; if ((f = xs_fopen(pcFilename, "rb")) != NULL) { - if (xs_status.sidPlayer->plrIsOurFile(f)) + if (xs_status.sidPlayer->plrProbe(f)) return TRUE; xs_fclose(f); } diff -r 9395961504c1 -r fa95d942f226 src/xmms-sid.h --- a/src/xmms-sid.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xmms-sid.h Tue Feb 20 16:53:05 2007 +0000 @@ -20,8 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef _XMMS_SID_H -#define _XMMS_SID_H +#ifndef XMMS_SID_H +#define XMMS_SID_H #include "xs_support.h" #include @@ -165,50 +165,10 @@ } t_xs_tuneinfo; -struct t_xs_status; - -typedef struct { - gint plrIdent; - gboolean (*plrIsOurFile)(t_xs_file *); - gboolean (*plrInit)(struct t_xs_status *); - void (*plrClose)(struct t_xs_status *); - gboolean (*plrInitSong)(struct t_xs_status *); - guint (*plrFillBuffer)(struct t_xs_status *, gchar *, guint); - gboolean (*plrLoadSID)(struct t_xs_status *, gchar *); - void (*plrDeleteSID)(struct t_xs_status *); - t_xs_tuneinfo* (*plrGetSIDInfo)(gchar *); - gboolean (*plrUpdateSIDInfo)(struct t_xs_status *); -} t_xs_player; - - -typedef struct t_xs_status { - gint audioFrequency, /* Audio settings */ - audioChannels, - audioBitsPerSample, - oversampleFactor; /* Factor of oversampling */ - AFormat audioFormat; - gboolean oversampleEnable; /* TRUE after sidEngine initialization, - if xs_cfg.oversampleEnable == TRUE and - emulation backend supports oversampling. - */ - void *sidEngine; /* SID-emulation internal engine data */ - t_xs_player *sidPlayer; /* Selected player engine */ - gboolean isError, isPlaying, isInitialized; - gint currSong, /* Current sub-tune */ - lastTime; - - t_xs_tuneinfo *tuneInfo; -} t_xs_status; - - /* Global variables */ extern InputPlugin xs_plugin_ip; -extern t_xs_status xs_status; -XS_MUTEX_H(xs_status); - - /* Plugin function prototypes */ @@ -250,4 +210,4 @@ #ifdef __cplusplus } #endif -#endif /* _XMMS_SID_H */ +#endif /* XMMS_SID_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_config.h --- a/src/xs_config.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_config.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_CONFIG_H -#define _XS_CONFIG_H +#ifndef XS_CONFIG_H +#define XS_CONFIG_H #include "xmms-sid.h" @@ -169,4 +169,4 @@ #ifdef __cplusplus } #endif -#endif /* _XS_CONFIG_H */ +#endif /* XS_CONFIG_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_curve.h --- a/src/xs_curve.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_curve.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_CURVE_H -#define _XS_CURVE_H +#ifndef XS_CURVE_H +#define XS_CURVE_H #include #include @@ -58,4 +58,4 @@ } #endif -#endif /* _XS_CURVE_H */ +#endif /* XS_CURVE_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_fileinfo.c --- a/src/xs_fileinfo.c Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_fileinfo.c Tue Feb 20 16:53:05 2007 +0000 @@ -24,6 +24,7 @@ #include #include "xs_fileinfo.h" +#include "xs_player.h" #include "xs_support.h" #include "xs_stil.h" #include "xs_config.h" diff -r 9395961504c1 -r fa95d942f226 src/xs_filter.h --- a/src/xs_filter.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_filter.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_FILTER_H -#define _XS_FILTER_H +#ifndef XS_FILTER_H +#define XS_FILTER_H #include "xmms-sid.h" @@ -18,4 +18,4 @@ #ifdef __cplusplus } #endif -#endif /* _XS_FILTER_H */ +#endif /* XS_FILTER_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_length.h --- a/src/xs_length.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_length.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_LENGTH_H -#define _XS_LENGTH_H +#ifndef XS_LENGTH_H +#define XS_LENGTH_H #include "xmms-sid.h" #include "xs_md5.h" @@ -35,4 +35,4 @@ #ifdef __cplusplus } #endif -#endif /* _XS_LENGTH_H */ +#endif /* XS_LENGTH_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_player.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/xs_player.h Tue Feb 20 16:53:05 2007 +0000 @@ -0,0 +1,59 @@ +#ifndef XS_PLAYER_H +#define XS_PLAYER_H + +#include "xmms-sid.h" +#include "xs_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct t_xs_status; + +typedef struct { + gint plrIdent; + gboolean (*plrProbe)(t_xs_file *); + gboolean (*plrInit)(struct t_xs_status *); + void (*plrClose)(struct t_xs_status *); + gboolean (*plrInitSong)(struct t_xs_status *); + guint (*plrFillBuffer)(struct t_xs_status *, gchar *, guint); + gboolean (*plrLoadSID)(struct t_xs_status *, gchar *); + void (*plrDeleteSID)(struct t_xs_status *); + t_xs_tuneinfo* (*plrGetSIDInfo)(gchar *); + gboolean (*plrUpdateSIDInfo)(struct t_xs_status *); + void (*plrFlush)(struct t_xs_status *); +} t_xs_player; + + +typedef struct t_xs_status { + gint audioFrequency, /* Audio settings */ + audioChannels, + audioBitsPerSample, + oversampleFactor; /* Factor of oversampling */ + AFormat audioFormat; + gboolean oversampleEnable; /* TRUE after sidEngine initialization, + if xs_cfg.oversampleEnable == TRUE and + emulation backend supports oversampling. + */ + void *sidEngine; /* SID-emulation internal engine data */ + t_xs_player *sidPlayer; /* Selected player engine */ + gboolean isError, isPlaying, isInitialized; + gint currSong, /* Current sub-tune */ + lastTime; + + t_xs_tuneinfo *tuneInfo; +} t_xs_status; + + +/* Global variables + */ +extern InputPlugin xs_plugin_ip; + +extern t_xs_status xs_status; +XS_MUTEX_H(xs_status); + + +#ifdef __cplusplus +} +#endif +#endif /* XS_PLAYER_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_sidplay.h --- a/src/xs_sidplay.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_sidplay.h Tue Feb 20 16:53:05 2007 +0000 @@ -45,10 +45,10 @@ } /* Get general tune information */ -#ifdef _XS_SIDPLAY1_H +#ifdef XS_SIDPLAY1_H myTune->getInfo(myInfo); #endif -#ifdef _XS_SIDPLAY2_H +#ifdef XS_SIDPLAY2_H myInfo = myTune->getInfo(); #endif @@ -91,10 +91,10 @@ return FALSE; /* Get currently playing tune information */ -#ifdef _XS_SIDPLAY1_H +#ifdef XS_SIDPLAY1_H myTune->getInfo(myInfo); #endif -#ifdef _XS_SIDPLAY2_H +#ifdef XS_SIDPLAY2_H myInfo = myTune->getInfo(); #endif diff -r 9395961504c1 -r fa95d942f226 src/xs_sidplay1.cc --- a/src/xs_sidplay1.cc Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_sidplay1.cc Tue Feb 20 16:53:05 2007 +0000 @@ -33,6 +33,10 @@ #include +/* Maximum audio frequency supported by libSIDPlay v1 */ +#define SIDPLAY1_MAX_FREQ (48000) + + typedef struct { emuEngine *currEng; emuConfig currConfig; @@ -56,7 +60,7 @@ /* Check if we can play the given file */ -gboolean xs_sidplay1_isourfile(t_xs_file *f) +gboolean xs_sidplay1_probe(t_xs_file *f) { gchar tmpBuf[4]; diff -r 9395961504c1 -r fa95d942f226 src/xs_sidplay1.h --- a/src/xs_sidplay1.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_sidplay1.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,17 +1,14 @@ -#ifndef _XS_SIDPLAY1_H -#define _XS_SIDPLAY1_H +#ifndef XS_SIDPLAY1_H +#define XS_SIDPLAY1_H -#include "xmms-sid.h" +#include "xs_player.h" #include "xs_support.h" -/* Maximum audio frequency supported by libSIDPlay v1 */ -#define SIDPLAY1_MAX_FREQ (48000) - #ifdef __cplusplus extern "C" { #endif -gboolean xs_sidplay1_isourfile(t_xs_file *); +gboolean xs_sidplay1_probe(t_xs_file *); void xs_sidplay1_close(t_xs_status *); gboolean xs_sidplay1_init(t_xs_status *); gboolean xs_sidplay1_initsong(t_xs_status *); @@ -24,4 +21,4 @@ #ifdef __cplusplus } #endif -#endif /* _XS_SIDPLAY1_H */ +#endif /* XS_SIDPLAY1_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_sidplay2.cc --- a/src/xs_sidplay2.cc Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_sidplay2.cc Tue Feb 20 16:53:05 2007 +0000 @@ -62,7 +62,7 @@ /* Check if we can play the given file */ -gboolean xs_sidplay2_isourfile(t_xs_file *f) +gboolean xs_sidplay2_probe(t_xs_file *f) { gchar tmpBuf[4]; @@ -311,6 +311,7 @@ else myEngine->currConfig.sidModel = SID2_MODEL_CORRECT; + /* XXX: Should this be configurable? libSIDPlay1 does not support it, though */ myEngine->currConfig.sidSamples = TRUE; @@ -432,7 +433,28 @@ { assert(myStatus); - /* With the current scheme of handling sidtune-loading, we don't do anything here. */ + /* With the current scheme of handling sidtune-loading, + * we don't do anything here. + */ +} + + +/* Hardware backend flushing + */ +void xs_sidplay2_flush(t_xs_status * myStatus) +{ + assert(myStatus); + +#ifdef HAVE_HARDSID_BUILDER +#ifdef HSID_SID2_COM + IfPtr hs(myStatus->currBuilder); + if (hs) + hs->flush(); +#else + if (xs_cfg.sid2Builder == XS_BLD_HARDSID) + ((HardSIDBuilder *) myStatus->currBuilder)->flush(); +#endif +#endif } diff -r 9395961504c1 -r fa95d942f226 src/xs_sidplay2.h --- a/src/xs_sidplay2.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_sidplay2.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,14 +1,14 @@ -#ifndef _XS_SIDPLAY2_H -#define _XS_SIDPLAY2_H +#ifndef XS_SIDPLAY2_H +#define XS_SIDPLAY2_H -#include "xmms-sid.h" +#include "xs_player.h" #include "xs_support.h" #ifdef __cplusplus extern "C" { #endif -gboolean xs_sidplay2_isourfile(t_xs_file *); +gboolean xs_sidplay2_probe(t_xs_file *); void xs_sidplay2_close(t_xs_status *); gboolean xs_sidplay2_init(t_xs_status *); gboolean xs_sidplay2_initsong(t_xs_status *); @@ -17,8 +17,9 @@ void xs_sidplay2_delete(t_xs_status *); t_xs_tuneinfo* xs_sidplay2_getinfo(gchar *); gboolean xs_sidplay2_updateinfo(t_xs_status *); +void xs_sidplay2_flush(t_xs_status *); #ifdef __cplusplus } #endif -#endif /* _XS_SIDPLAY2_H */ +#endif /* XS_SIDPLAY2_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_stil.h --- a/src/xs_stil.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_stil.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_STIL_H -#define _XS_STIL_H +#ifndef XS_STIL_H +#define XS_STIL_H #include "xmms-sid.h" @@ -7,8 +7,7 @@ extern "C" { #endif -/* - * Defines and typedefs +/* Types */ typedef struct { gchar *pName, @@ -34,16 +33,14 @@ } t_xs_stildb; -/* - * Functions +/* Functions */ gint xs_stildb_read(t_xs_stildb *, gchar *); gint xs_stildb_index(t_xs_stildb *); void xs_stildb_free(t_xs_stildb *); t_xs_stil_node * xs_stildb_get_node(t_xs_stildb *, gchar *); - #ifdef __cplusplus } #endif -#endif /* _XS_STIL_H */ +#endif /* XS_STIL_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_support.h --- a/src/xs_support.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_support.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_SUPPORT_H -#define _XS_SUPPORT_H +#ifndef XS_SUPPORT_H +#define XS_SUPPORT_H #ifdef __cplusplus extern "C" { @@ -81,4 +81,4 @@ #ifdef __cplusplus } #endif -#endif /* _XS_SUPPORT_H */ +#endif /* XS_SUPPORT_H */ diff -r 9395961504c1 -r fa95d942f226 src/xs_title.h --- a/src/xs_title.h Sat Feb 17 16:35:01 2007 +0000 +++ b/src/xs_title.h Tue Feb 20 16:53:05 2007 +0000 @@ -1,5 +1,5 @@ -#ifndef _XS_TITLE_H -#define _XS_TITLE_H +#ifndef XS_TITLE_H +#define XS_TITLE_H #include "xmms-sid.h" @@ -7,12 +7,9 @@ extern "C" { #endif -/* - * Functions - */ gchar *xs_make_titlestring(t_xs_tuneinfo *, gint); #ifdef __cplusplus } #endif -#endif /* _XS_TITLE_H */ +#endif /* XS_TITLE_H */