diff src/xs_sidplay2.cc @ 657:acaba070cf49

Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Apr 2008 19:46:59 +0300
parents fdddab8f0c1b
children b0743dc9165d
line wrap: on
line diff
--- a/src/xs_sidplay2.cc	Wed Mar 26 08:55:29 2008 +0200
+++ b/src/xs_sidplay2.cc	Wed Apr 02 19:46:59 2008 +0300
@@ -45,7 +45,7 @@
 	SidTune *currTune;
 	guint8 *buf;
 	size_t bufSize;
-} t_xs_sidplay2;
+} xs_sidplay2_t;
 
 
 /* We need to 'export' all this pseudo-C++ crap */
@@ -58,13 +58,13 @@
 #define TFUNCTION2	xs_sidplay2_updateinfo
 #define TTUNEINFO	SidTuneInfo
 #define TTUNE		SidTune
-#define TENGINE		t_xs_sidplay2
+#define TENGINE		xs_sidplay2_t
 #include "xs_sidplay.h"
 
 
 /* Check if we can play the given file
  */
-gboolean xs_sidplay2_probe(t_xs_file *f)
+gboolean xs_sidplay2_probe(xs_file_t *f)
 {
 	gchar tmpBuf[4];
 	
@@ -82,23 +82,23 @@
 
 /* Initialize SIDPlay2
  */
-gboolean xs_sidplay2_init(t_xs_status * myStatus)
+gboolean xs_sidplay2_init(xs_status_t * myStatus)
 {
 	gint tmpFreq, i;
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	sid_filter_t tmpFilter;
 	t_xs_sid2_filter *f;
 	assert(myStatus);
 
 	/* Allocate internal structures */
-	myEngine = (t_xs_sidplay2 *) g_malloc0(sizeof(t_xs_sidplay2));
+	myEngine = (xs_sidplay2_t *) g_malloc0(sizeof(xs_sidplay2_t));
 	myStatus->sidEngine = myEngine;
 	if (!myEngine) return FALSE;
 
 	/* Initialize the engine */
 	myEngine->currEng = new sidplay2;
 	if (!myEngine->currEng) {
-		xs_error(_("[SIDPlay2] Could not initialize emulation engine.\n"));
+		xs_error("[SIDPlay2] Could not initialize emulation engine.\n");
 		return FALSE;
 	}
 
@@ -173,10 +173,14 @@
 			break;
 
 		case FMT_U16_NE:
-#ifdef WORDS_BIGENDIAN
+#if G_BYTE_ORDER == G_BIG_ENDIAN
 			myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
 #else
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
 			myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
+#else
+#error Unsupported endianess!
+#endif
 #endif
 			break;
 
@@ -190,10 +194,14 @@
 
 		default:
 			myStatus->audioFormat = FMT_S16_NE;
-#ifdef WORDS_BIGENDIAN
+#if G_BYTE_ORDER == G_BIG_ENDIAN
 			myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
 #else
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
 			myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
+#else
+#error Unsupported endianess!
+#endif
 #endif
 			break;
 
@@ -205,7 +213,7 @@
 	f = &(xs_cfg.sid2Filter);
 	XSDEBUG("using filter '%s', %d points\n", f->name, f->npoints);
 	if (f->npoints > XS_SIDPLAY2_NFPOINTS) {
-		xs_error(_("[SIDPlay2] Invalid number of filter curve points (%d > %d)\n"),
+		xs_error("[SIDPlay2] Invalid number of filter curve points (%d > %d)\n",
 			f->npoints, XS_SIDPLAY2_NFPOINTS);
 		f->npoints = XS_SIDPLAY2_NFPOINTS;
 	}
@@ -226,13 +234,13 @@
 			/* Builder object created, initialize it */
 			rs->create((myEngine->currEng->info()).maxsids);
 			if (!*rs) {
-				xs_error(_("reSID->create() failed.\n"));
+				xs_error("reSID->create() failed.\n");
 				return FALSE;
 			}
 
 			rs->filter(xs_cfg.emulateFilters);
 			if (!*rs) {
-				xs_error(_("reSID->filter(%d) failed.\n"), xs_cfg.emulateFilters);
+				xs_error("reSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
 				return FALSE;
 			}
 
@@ -240,7 +248,7 @@
 			// ... WHEN/IF resid-builder+libsidplay2 gets fixed
 			rs->sampling(tmpFreq);
 			if (!*rs) {
-				xs_error(_("reSID->sampling(%d) failed.\n"), tmpFreq);
+				xs_error("reSID->sampling(%d) failed.\n", tmpFreq);
 				return FALSE;
 			}
 			
@@ -250,7 +258,7 @@
 				rs->filter((sid_filter_t *) NULL);
 			
 			if (!*rs) {
-				xs_error(_("reSID->filter(NULL) failed.\n"));
+				xs_error("reSID->filter(NULL) failed.\n");
 				return FALSE;
 			}
 		}
@@ -264,13 +272,13 @@
 			/* Builder object created, initialize it */
 			hs->create((myEngine->currEng->info()).maxsids);
 			if (!*hs) {
-				xs_error(_("hardSID->create() failed.\n"));
+				xs_error("hardSID->create() failed.\n");
 				return FALSE;
 			}
 
 			hs->filter(xs_cfg.emulateFilters);
 			if (!*hs) {
-				xs_error(_("hardSID->filter(%d) failed.\n"), xs_cfg.emulateFilters);
+				xs_error("hardSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
 				return FALSE;
 			}
 		}
@@ -278,7 +286,7 @@
 #endif
 
 	if (!myEngine->currBuilder) {
-		xs_error(_("[SIDPlay2] Could not initialize SIDBuilder object.\n"));
+		xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n");
 		return FALSE;
 	}
 
@@ -292,7 +300,7 @@
 		break;
 
 	default:
-		xs_error(_("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n"),
+		xs_error("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n",
 			xs_cfg.clockSpeed);
 
 	case XS_CLOCK_PAL:
@@ -316,7 +324,7 @@
 	if ((xs_cfg.sid2OptLevel >= 0) && (xs_cfg.sid2OptLevel <= SID2_MAX_OPTIMISATION))
 		myEngine->currConfig.optimisation = xs_cfg.sid2OptLevel;
 	else {
-		xs_error(_("Invalid sid2OptLevel=%d, falling back to %d.\n"),
+		xs_error("Invalid sid2OptLevel=%d, falling back to %d.\n",
 			xs_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION);
 		
 		xs_cfg.sid2OptLevel =
@@ -340,14 +348,14 @@
 
 	/* Now set the emulator configuration */
 	if (myEngine->currEng->config(myEngine->currConfig) < 0) {
-		xs_error(_("[SIDPlay2] Emulator engine configuration failed!\n"));
+		xs_error("[SIDPlay2] Emulator engine configuration failed!\n");
 		return FALSE;
 	}
 
 	/* Create the sidtune */
 	myEngine->currTune = new SidTune(0);
 	if (!myEngine->currTune) {
-		xs_error(_("[SIDPlay2] Could not initialize SIDTune object.\n"));
+		xs_error("[SIDPlay2] Could not initialize SIDTune object.\n");
 		return FALSE;
 	}
 
@@ -357,12 +365,12 @@
 
 /* Close SIDPlay2 engine
  */
-void xs_sidplay2_close(t_xs_status * myStatus)
+void xs_sidplay2_close(xs_status_t * myStatus)
 {
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	assert(myStatus);
 
-	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 
 	/* Free internals */
 	if (myEngine->currBuilder) {
@@ -389,21 +397,21 @@
 
 /* Initialize current song and sub-tune
  */
-gboolean xs_sidplay2_initsong(t_xs_status * myStatus)
+gboolean xs_sidplay2_initsong(xs_status_t * myStatus)
 {
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	assert(myStatus);
 
-	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 	if (!myEngine) return FALSE;
 
 	if (!myEngine->currTune->selectSong(myStatus->currSong)) {
-		xs_error(_("[SIDPlay2] currTune->selectSong() failed\n"));
+		xs_error("[SIDPlay2] currTune->selectSong() failed\n");
 		return FALSE;
 	}
 
 	if (myEngine->currEng->load(myEngine->currTune) < 0) {
-		xs_error(_("[SIDPlay2] currEng->load() failed\n"));
+		xs_error("[SIDPlay2] currEng->load() failed\n");
 		return FALSE;
 	}
 	
@@ -415,12 +423,12 @@
 
 /* Emulate and render audio data to given buffer
  */
-guint xs_sidplay2_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize)
+guint xs_sidplay2_fillbuffer(xs_status_t * myStatus, gchar * audioBuffer, guint audioBufSize)
 {
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	assert(myStatus);
 
-	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 	if (!myEngine) return 0;
 
 	return myEngine->currEng->play(audioBuffer, audioBufSize);
@@ -429,13 +437,13 @@
 
 /* Load a given SID-tune file
  */
-gboolean xs_sidplay2_load(t_xs_status * myStatus, gchar * pcFilename)
+gboolean xs_sidplay2_load(xs_status_t * myStatus, gchar * pcFilename)
 {
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	assert(myStatus);
 	myStatus->isInitialized = FALSE;
 
-	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 	if (!myEngine) return FALSE;
 
 	/* Try to get the tune */
@@ -453,12 +461,12 @@
 
 /* Delete INTERNAL information
  */
-void xs_sidplay2_delete(t_xs_status * myStatus)
+void xs_sidplay2_delete(xs_status_t * myStatus)
 {
-	t_xs_sidplay2 *myEngine;
+	xs_sidplay2_t *myEngine;
 	assert(myStatus);
 
-	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 	if (!myEngine) return;
 	
 	g_free(myEngine->buf);
@@ -469,7 +477,7 @@
 
 /* Hardware backend flushing
  */
-void xs_sidplay2_flush(t_xs_status * myStatus)
+void xs_sidplay2_flush(xs_status_t * myStatus)
 {
 	assert(myStatus);