diff src/xmms-sid.c @ 392:b09d74eb71e6

Working on getting STIL and SLDB using completely dynamically allocated structures. Indentation cleanups, etc.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 31 May 2006 10:02:00 +0000
parents e0caab85510e
children f997b79a7251
line wrap: on
line diff
--- a/src/xmms-sid.c	Tue May 30 04:50:04 2006 +0000
+++ b/src/xmms-sid.c	Wed May 31 10:02:00 2006 +0000
@@ -99,7 +99,7 @@
 /*
  * Error messages
  */
-void XSERR(const char *fmt, ...)
+void xs_error(const char *fmt, ...)
 {
 	va_list ap;
 	fprintf(stderr, "XMMS-SID: ");
@@ -197,13 +197,13 @@
 	/* Initialize song-length database */
 	xs_songlen_close();
 	if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) {
-		XSERR("Error initializing song-length database!\n");
+		xs_error("Error initializing song-length database!\n");
 	}
 
 	/* Initialize STIL database */
 	xs_stil_close();
 	if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) {
-		XSERR("Error initializing STIL database!\n");
+		xs_error("Error initializing STIL database!\n");
 	}
 }
 
@@ -298,7 +298,6 @@
 	t_xs_status myStatus;
 	t_xs_tuneinfo *myTune;
 	gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE;
-	gboolean playedTune[XS_STIL_MAXENTRY + 1];
 	gint audioGot, songLength, i;
 	gchar *audioBuffer = NULL, *oversampleBuffer = NULL;
 
@@ -316,14 +315,14 @@
 	/* Allocate audio buffer */
 	audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE);
 	if (audioBuffer == NULL) {
-		XSERR("Couldn't allocate memory for audio data buffer!\n");
+		xs_error("Couldn't allocate memory for audio data buffer!\n");
 		goto xs_err_exit;
 	}
 
 	if (myStatus.oversampleEnable) {
 		oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor);
 		if (oversampleBuffer == NULL) {
-			XSERR("Couldn't allocate memory for audio oversampling buffer!\n");
+			xs_error("Couldn't allocate memory for audio oversampling buffer!\n");
 			goto xs_err_exit;
 		}
 	}
@@ -396,7 +395,7 @@
 
 		/* Initialize song */
 		if (!myStatus.sidPlayer->plrInitSong(&myStatus)) {
-			XSERR("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n",
+			xs_error("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n",
 			      myTune->sidFilename, myStatus.currSong);
 			goto xs_err_exit;
 		}
@@ -405,7 +404,7 @@
 		/* Open the audio output */
 		if (!xs_plugin_ip.output->
 		    open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) {
-			XSERR("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n", myStatus.audioFormat,
+			xs_error("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n", myStatus.audioFormat,
 			      myStatus.audioFrequency, myStatus.audioChannels);
 
 			XS_MUTEX_LOCK(xs_status);
@@ -443,7 +442,7 @@
 				/* Execute rate-conversion with filtering */
 				if (xs_filter_rateconv(audioBuffer, oversampleBuffer,
 						       myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) {
-					XSERR("Oversampling rate-conversion pass failed.\n");
+					xs_error("Oversampling rate-conversion pass failed.\n");
 					XS_MUTEX_LOCK(xs_status);
 					xs_status.isError = TRUE;
 					XS_MUTEX_UNLOCK(xs_status);
@@ -555,7 +554,7 @@
 
 	/* Start the playing thread! */
 	if (pthread_create(&xs_decode_thread, NULL, xs_playthread, NULL) < 0) {
-		XSERR("Couldn't start playing thread!\n");
+		xs_error("Couldn't start playing thread!\n");
 		xs_tuneinfo_free(xs_status.tuneInfo);
 		xs_status.tuneInfo = NULL;
 		xs_status.sidPlayer->plrDeleteSID(&xs_status);
@@ -937,13 +936,13 @@
 	/* Allocate structure */
 	pResult = (t_xs_tuneinfo *) g_malloc0(sizeof(t_xs_tuneinfo));
 	if (!pResult) {
-		XSERR("Could not allocate memory for t_xs_tuneinfo ('%s')\n", pcFilename);
+		xs_error("Could not allocate memory for t_xs_tuneinfo ('%s')\n", pcFilename);
 		return NULL;
 	}
 
 	pResult->sidFilename = g_strdup(pcFilename);
 	if (!pResult->sidFilename) {
-		XSERR("Could not allocate sidFilename ('%s')\n", pcFilename);
+		xs_error("Could not allocate sidFilename ('%s')\n", pcFilename);
 		g_free(pResult);
 		return NULL;
 	}
@@ -952,7 +951,7 @@
 	if (nsubTunes > 0) {
 		pResult->subTunes = g_malloc0(sizeof(t_xs_subtuneinfo) * nsubTunes);
 		if (!pResult->subTunes) {
-			XSERR("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n", pcFilename, nsubTunes);
+			xs_error("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n", pcFilename, nsubTunes);
 
 			g_free(pResult->sidFilename);
 			g_free(pResult);