diff src/xs_sidplay2.cc @ 660:b0743dc9165d

Change tabs to 4 spaces, everywhere.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Apr 2008 22:10:05 +0300
parents acaba070cf49
children 0126579b6652
line wrap: on
line diff
--- a/src/xs_sidplay2.cc	Wed Apr 02 21:29:26 2008 +0300
+++ b/src/xs_sidplay2.cc	Wed Apr 02 22:10:05 2008 +0300
@@ -39,12 +39,12 @@
 
 
 typedef struct {
-	sidplay2 *currEng;
-	sidbuilder *currBuilder;
-	sid2_config_t currConfig;
-	SidTune *currTune;
-	guint8 *buf;
-	size_t bufSize;
+    sidplay2 *currEng;
+    sidbuilder *currBuilder;
+    sid2_config_t currConfig;
+    SidTune *currTune;
+    guint8 *buf;
+    size_t bufSize;
 } xs_sidplay2_t;
 
 
@@ -54,11 +54,11 @@
 
 /* Return song information
  */
-#define TFUNCTION	xs_sidplay2_getinfo
-#define TFUNCTION2	xs_sidplay2_updateinfo
-#define TTUNEINFO	SidTuneInfo
-#define TTUNE		SidTune
-#define TENGINE		xs_sidplay2_t
+#define TFUNCTION    xs_sidplay2_getinfo
+#define TFUNCTION2    xs_sidplay2_updateinfo
+#define TTUNEINFO    SidTuneInfo
+#define TTUNE        SidTune
+#define TENGINE        xs_sidplay2_t
 #include "xs_sidplay.h"
 
 
@@ -66,17 +66,17 @@
  */
 gboolean xs_sidplay2_probe(xs_file_t *f)
 {
-	gchar tmpBuf[4];
-	
-	if (!f) return FALSE;
-	
-	if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4)
-		return FALSE;
-	
-	if (!strncmp(tmpBuf, "PSID", 4) || !strncmp(tmpBuf, "RSID", 4))
-		return TRUE;
-	else
-		return FALSE;
+    gchar tmpBuf[4];
+    
+    if (!f) return FALSE;
+    
+    if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4)
+        return FALSE;
+    
+    if (!strncmp(tmpBuf, "PSID", 4) || !strncmp(tmpBuf, "RSID", 4))
+        return TRUE;
+    else
+        return FALSE;
 }
 
 
@@ -84,282 +84,282 @@
  */
 gboolean xs_sidplay2_init(xs_status_t * myStatus)
 {
-	gint tmpFreq, i;
-	xs_sidplay2_t *myEngine;
-	sid_filter_t tmpFilter;
-	t_xs_sid2_filter *f;
-	assert(myStatus);
+    gint tmpFreq, i;
+    xs_sidplay2_t *myEngine;
+    sid_filter_t tmpFilter;
+    t_xs_sid2_filter *f;
+    assert(myStatus);
 
-	/* Allocate internal structures */
-	myEngine = (xs_sidplay2_t *) g_malloc0(sizeof(xs_sidplay2_t));
-	myStatus->sidEngine = myEngine;
-	if (!myEngine) return FALSE;
+    /* Allocate internal structures */
+    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");
-		return FALSE;
-	}
+    /* Initialize the engine */
+    myEngine->currEng = new sidplay2;
+    if (!myEngine->currEng) {
+        xs_error("[SIDPlay2] Could not initialize emulation engine.\n");
+        return FALSE;
+    }
 
-	/* Get current configuration */
-	myEngine->currConfig = myEngine->currEng->config();
+    /* Get current configuration */
+    myEngine->currConfig = myEngine->currEng->config();
 
-	/* Configure channels and stuff */
-	switch (myStatus->audioChannels) {
+    /* Configure channels and stuff */
+    switch (myStatus->audioChannels) {
 
-	case XS_CHN_AUTOPAN:
-		myEngine->currConfig.playback = sid2_stereo;
-		break;
+    case XS_CHN_AUTOPAN:
+        myEngine->currConfig.playback = sid2_stereo;
+        break;
 
-	case XS_CHN_STEREO:
-		myEngine->currConfig.playback = sid2_stereo;
-		break;
+    case XS_CHN_STEREO:
+        myEngine->currConfig.playback = sid2_stereo;
+        break;
 
-	case XS_CHN_MONO:
-	default:
-		myEngine->currConfig.playback = sid2_mono;
-		myStatus->audioChannels = XS_CHN_MONO;
-		break;
-	}
+    case XS_CHN_MONO:
+    default:
+        myEngine->currConfig.playback = sid2_mono;
+        myStatus->audioChannels = XS_CHN_MONO;
+        break;
+    }
 
 
-	/* Memory mode settings */
-	switch (xs_cfg.memoryMode) {
-	case XS_MPU_BANK_SWITCHING:
-		myEngine->currConfig.environment = sid2_envBS;
-		break;
+    /* Memory mode settings */
+    switch (xs_cfg.memoryMode) {
+    case XS_MPU_BANK_SWITCHING:
+        myEngine->currConfig.environment = sid2_envBS;
+        break;
 
-	case XS_MPU_TRANSPARENT_ROM:
-		myEngine->currConfig.environment = sid2_envTP;
-		break;
+    case XS_MPU_TRANSPARENT_ROM:
+        myEngine->currConfig.environment = sid2_envTP;
+        break;
 
-	case XS_MPU_PLAYSID_ENVIRONMENT:
-		myEngine->currConfig.environment = sid2_envPS;
-		break;
+    case XS_MPU_PLAYSID_ENVIRONMENT:
+        myEngine->currConfig.environment = sid2_envPS;
+        break;
 
-	case XS_MPU_REAL:
-	default:
-		myEngine->currConfig.environment = sid2_envR;
-		xs_cfg.memoryMode = XS_MPU_REAL;
-		break;
-	}
+    case XS_MPU_REAL:
+    default:
+        myEngine->currConfig.environment = sid2_envR;
+        xs_cfg.memoryMode = XS_MPU_REAL;
+        break;
+    }
 
 
-	/* Audio parameters sanity checking and setup */
-	myEngine->currConfig.precision = myStatus->audioBitsPerSample;
-	tmpFreq = myStatus->audioFrequency;
+    /* Audio parameters sanity checking and setup */
+    myEngine->currConfig.precision = myStatus->audioBitsPerSample;
+    tmpFreq = myStatus->audioFrequency;
 
-	if (myStatus->oversampleEnable)
-		tmpFreq = (tmpFreq * myStatus->oversampleFactor);
+    if (myStatus->oversampleEnable)
+        tmpFreq = (tmpFreq * myStatus->oversampleFactor);
 
-	myEngine->currConfig.frequency = tmpFreq;
+    myEngine->currConfig.frequency = tmpFreq;
 
-	switch (myStatus->audioBitsPerSample) {
-	case XS_RES_8BIT:
-		myStatus->audioFormat = FMT_U8;
-		myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
-		break;
+    switch (myStatus->audioBitsPerSample) {
+    case XS_RES_8BIT:
+        myStatus->audioFormat = FMT_U8;
+        myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
+        break;
 
-	case XS_RES_16BIT:
-	default:
-		switch (myStatus->audioFormat) {
-		case FMT_U16_LE:
-			myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
-			break;
+    case XS_RES_16BIT:
+    default:
+        switch (myStatus->audioFormat) {
+        case FMT_U16_LE:
+            myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
+            break;
 
-		case FMT_U16_BE:
-			myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
-			break;
+        case FMT_U16_BE:
+            myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
+            break;
 
-		case FMT_U16_NE:
+        case FMT_U16_NE:
 #if G_BYTE_ORDER == G_BIG_ENDIAN
-			myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
+            myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
 #else
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-			myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
+            myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
 #else
 #error Unsupported endianess!
 #endif
 #endif
-			break;
+            break;
 
-		case FMT_S16_LE:
-			myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
-			break;
+        case FMT_S16_LE:
+            myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
+            break;
 
-		case FMT_S16_BE:
-			myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
-			break;
+        case FMT_S16_BE:
+            myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
+            break;
 
-		default:
-			myStatus->audioFormat = FMT_S16_NE;
+        default:
+            myStatus->audioFormat = FMT_S16_NE;
 #if G_BYTE_ORDER == G_BIG_ENDIAN
-			myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
+            myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
 #else
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-			myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
+            myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
 #else
 #error Unsupported endianess!
 #endif
 #endif
-			break;
+            break;
 
-		}
-		break;
-	}
-	
-	/* Convert filter */
-	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",
-			f->npoints, XS_SIDPLAY2_NFPOINTS);
-		f->npoints = XS_SIDPLAY2_NFPOINTS;
-	}
-	
-	tmpFilter.points = f->npoints;
-	for (i = 0; i < f->npoints; i++) {
-		tmpFilter.cutoff[i][0] = f->points[i].x;
-		tmpFilter.cutoff[i][1] = f->points[i].y;
-	}
+        }
+        break;
+    }
+    
+    /* Convert filter */
+    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",
+            f->npoints, XS_SIDPLAY2_NFPOINTS);
+        f->npoints = XS_SIDPLAY2_NFPOINTS;
+    }
+    
+    tmpFilter.points = f->npoints;
+    for (i = 0; i < f->npoints; i++) {
+        tmpFilter.cutoff[i][0] = f->points[i].x;
+        tmpFilter.cutoff[i][1] = f->points[i].y;
+    }
 
-	/* Initialize builder object */
-	XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids);
+    /* Initialize builder object */
+    XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids);
 #ifdef HAVE_RESID_BUILDER
-	if (xs_cfg.sid2Builder == XS_BLD_RESID) {
-		ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
-		myEngine->currBuilder = (sidbuilder *) rs;
-		if (rs) {
-			/* Builder object created, initialize it */
-			rs->create((myEngine->currEng->info()).maxsids);
-			if (!*rs) {
-				xs_error("reSID->create() failed.\n");
-				return FALSE;
-			}
+    if (xs_cfg.sid2Builder == XS_BLD_RESID) {
+        ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
+        myEngine->currBuilder = (sidbuilder *) rs;
+        if (rs) {
+            /* Builder object created, initialize it */
+            rs->create((myEngine->currEng->info()).maxsids);
+            if (!*rs) {
+                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);
-				return FALSE;
-			}
+            rs->filter(xs_cfg.emulateFilters);
+            if (!*rs) {
+                xs_error("reSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
+                return FALSE;
+            }
 
-			// FIXME FIX ME: support other configurable parameters ...
-			// ... WHEN/IF resid-builder+libsidplay2 gets fixed
-			rs->sampling(tmpFreq);
-			if (!*rs) {
-				xs_error("reSID->sampling(%d) failed.\n", tmpFreq);
-				return FALSE;
-			}
-			
-			if (tmpFilter.points > 0)
-				rs->filter((sid_filter_t *) &tmpFilter);
-			else
-				rs->filter((sid_filter_t *) NULL);
-			
-			if (!*rs) {
-				xs_error("reSID->filter(NULL) failed.\n");
-				return FALSE;
-			}
-		}
-	}
+            // FIXME FIX ME: support other configurable parameters ...
+            // ... WHEN/IF resid-builder+libsidplay2 gets fixed
+            rs->sampling(tmpFreq);
+            if (!*rs) {
+                xs_error("reSID->sampling(%d) failed.\n", tmpFreq);
+                return FALSE;
+            }
+            
+            if (tmpFilter.points > 0)
+                rs->filter((sid_filter_t *) &tmpFilter);
+            else
+                rs->filter((sid_filter_t *) NULL);
+            
+            if (!*rs) {
+                xs_error("reSID->filter(NULL) failed.\n");
+                return FALSE;
+            }
+        }
+    }
 #endif
 #ifdef HAVE_HARDSID_BUILDER
-	if (xs_cfg.sid2Builder == XS_BLD_HARDSID) {
-		HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder");
-		myEngine->currBuilder = (sidbuilder *) hs;
-		if (hs) {
-			/* Builder object created, initialize it */
-			hs->create((myEngine->currEng->info()).maxsids);
-			if (!*hs) {
-				xs_error("hardSID->create() failed.\n");
-				return FALSE;
-			}
+    if (xs_cfg.sid2Builder == XS_BLD_HARDSID) {
+        HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder");
+        myEngine->currBuilder = (sidbuilder *) hs;
+        if (hs) {
+            /* Builder object created, initialize it */
+            hs->create((myEngine->currEng->info()).maxsids);
+            if (!*hs) {
+                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);
-				return FALSE;
-			}
-		}
-	}
+            hs->filter(xs_cfg.emulateFilters);
+            if (!*hs) {
+                xs_error("hardSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
+                return FALSE;
+            }
+        }
+    }
 #endif
 
-	if (!myEngine->currBuilder) {
-		xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n");
-		return FALSE;
-	}
+    if (!myEngine->currBuilder) {
+        xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n");
+        return FALSE;
+    }
 
-	XSDEBUG("%s\n", myEngine->currBuilder->credits());
+    XSDEBUG("%s\n", myEngine->currBuilder->credits());
 
 
-	/* Clockspeed settings */
-	switch (xs_cfg.clockSpeed) {
-	case XS_CLOCK_NTSC:
-		myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC;
-		break;
+    /* Clockspeed settings */
+    switch (xs_cfg.clockSpeed) {
+    case XS_CLOCK_NTSC:
+        myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC;
+        break;
 
-	default:
-		xs_error("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n",
-			xs_cfg.clockSpeed);
+    default:
+        xs_error("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n",
+            xs_cfg.clockSpeed);
 
-	case XS_CLOCK_PAL:
-		myEngine->currConfig.clockDefault = SID2_CLOCK_PAL;
-		xs_cfg.clockSpeed = XS_CLOCK_PAL;
-		break;
-	}
+    case XS_CLOCK_PAL:
+        myEngine->currConfig.clockDefault = SID2_CLOCK_PAL;
+        xs_cfg.clockSpeed = XS_CLOCK_PAL;
+        break;
+    }
 
 
-	/* Configure rest of the emulation */
-	myEngine->currConfig.sidEmulation = myEngine->currBuilder;
-	
-	if (xs_cfg.forceSpeed) { 
-		myEngine->currConfig.clockForced = true;
-		myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault;
-	} else {
-		myEngine->currConfig.clockForced = false;
-		myEngine->currConfig.clockSpeed = SID2_CLOCK_CORRECT;
-	}
-	
-	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_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION);
-		
-		xs_cfg.sid2OptLevel =
-		myEngine->currConfig.optimisation = SID2_DEFAULT_OPTIMISATION;
-	}
+    /* Configure rest of the emulation */
+    myEngine->currConfig.sidEmulation = myEngine->currBuilder;
+    
+    if (xs_cfg.forceSpeed) { 
+        myEngine->currConfig.clockForced = true;
+        myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault;
+    } else {
+        myEngine->currConfig.clockForced = false;
+        myEngine->currConfig.clockSpeed = SID2_CLOCK_CORRECT;
+    }
+    
+    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_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION);
+        
+        xs_cfg.sid2OptLevel =
+        myEngine->currConfig.optimisation = SID2_DEFAULT_OPTIMISATION;
+    }
 
-	if (xs_cfg.mos8580)
-		myEngine->currConfig.sidDefault = SID2_MOS8580;
-	else
-		myEngine->currConfig.sidDefault = SID2_MOS6581;
+    if (xs_cfg.mos8580)
+        myEngine->currConfig.sidDefault = SID2_MOS8580;
+    else
+        myEngine->currConfig.sidDefault = SID2_MOS6581;
 
-	if (xs_cfg.forceModel)
-		myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault;
-	else
-		myEngine->currConfig.sidModel = SID2_MODEL_CORRECT;
+    if (xs_cfg.forceModel)
+        myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault;
+    else
+        myEngine->currConfig.sidModel = SID2_MODEL_CORRECT;
 
-	
-	/* XXX: Should this be configurable? libSIDPlay1 does not support it, though */
-	myEngine->currConfig.sidSamples = TRUE;
+    
+    /* XXX: Should this be configurable? libSIDPlay1 does not support it, though */
+    myEngine->currConfig.sidSamples = TRUE;
 
 
-	/* Now set the emulator configuration */
-	if (myEngine->currEng->config(myEngine->currConfig) < 0) {
-		xs_error("[SIDPlay2] Emulator engine configuration failed!\n");
-		return FALSE;
-	}
+    /* Now set the emulator configuration */
+    if (myEngine->currEng->config(myEngine->currConfig) < 0) {
+        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");
-		return FALSE;
-	}
+    /* Create the sidtune */
+    myEngine->currTune = new SidTune(0);
+    if (!myEngine->currTune) {
+        xs_error("[SIDPlay2] Could not initialize SIDTune object.\n");
+        return FALSE;
+    }
 
-	return TRUE;
+    return TRUE;
 }
 
 
@@ -367,31 +367,31 @@
  */
 void xs_sidplay2_close(xs_status_t * myStatus)
 {
-	xs_sidplay2_t *myEngine;
-	assert(myStatus);
+    xs_sidplay2_t *myEngine;
+    assert(myStatus);
 
-	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
+    myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
 
-	/* Free internals */
-	if (myEngine->currBuilder) {
-		delete myEngine->currBuilder;
-		myEngine->currBuilder = NULL;
-	}
+    /* Free internals */
+    if (myEngine->currBuilder) {
+        delete myEngine->currBuilder;
+        myEngine->currBuilder = NULL;
+    }
 
-	if (myEngine->currEng) {
-		delete myEngine->currEng;
-		myEngine->currEng = NULL;
-	}
+    if (myEngine->currEng) {
+        delete myEngine->currEng;
+        myEngine->currEng = NULL;
+    }
 
-	if (myEngine->currTune) {
-		delete myEngine->currTune;
-		myEngine->currTune = NULL;
-	}
+    if (myEngine->currTune) {
+        delete myEngine->currTune;
+        myEngine->currTune = NULL;
+    }
 
-	xs_sidplay2_delete(myStatus);
+    xs_sidplay2_delete(myStatus);
 
-	g_free(myEngine);
-	myStatus->sidEngine = NULL;
+    g_free(myEngine);
+    myStatus->sidEngine = NULL;
 }
 
 
@@ -399,25 +399,25 @@
  */
 gboolean xs_sidplay2_initsong(xs_status_t * myStatus)
 {
-	xs_sidplay2_t *myEngine;
-	assert(myStatus);
+    xs_sidplay2_t *myEngine;
+    assert(myStatus);
 
-	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
-	if (!myEngine) return FALSE;
+    myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
+    if (!myEngine) return FALSE;
 
-	if (!myEngine->currTune->selectSong(myStatus->currSong)) {
-		xs_error("[SIDPlay2] currTune->selectSong() failed\n");
-		return FALSE;
-	}
+    if (!myEngine->currTune->selectSong(myStatus->currSong)) {
+        xs_error("[SIDPlay2] currTune->selectSong() failed\n");
+        return FALSE;
+    }
 
-	if (myEngine->currEng->load(myEngine->currTune) < 0) {
-		xs_error("[SIDPlay2] currEng->load() failed\n");
-		return FALSE;
-	}
-	
-	myStatus->isInitialized = TRUE;
+    if (myEngine->currEng->load(myEngine->currTune) < 0) {
+        xs_error("[SIDPlay2] currEng->load() failed\n");
+        return FALSE;
+    }
+    
+    myStatus->isInitialized = TRUE;
 
-	return TRUE;
+    return TRUE;
 }
 
 
@@ -425,13 +425,13 @@
  */
 guint xs_sidplay2_fillbuffer(xs_status_t * myStatus, gchar * audioBuffer, guint audioBufSize)
 {
-	xs_sidplay2_t *myEngine;
-	assert(myStatus);
+    xs_sidplay2_t *myEngine;
+    assert(myStatus);
 
-	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
-	if (!myEngine) return 0;
+    myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
+    if (!myEngine) return 0;
 
-	return myEngine->currEng->play(audioBuffer, audioBufSize);
+    return myEngine->currEng->play(audioBuffer, audioBufSize);
 }
 
 
@@ -439,23 +439,23 @@
  */
 gboolean xs_sidplay2_load(xs_status_t * myStatus, gchar * pcFilename)
 {
-	xs_sidplay2_t *myEngine;
-	assert(myStatus);
-	myStatus->isInitialized = FALSE;
+    xs_sidplay2_t *myEngine;
+    assert(myStatus);
+    myStatus->isInitialized = FALSE;
 
-	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
-	if (!myEngine) return FALSE;
+    myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
+    if (!myEngine) return FALSE;
 
-	/* Try to get the tune */
-	if (!pcFilename) return FALSE;
+    /* Try to get the tune */
+    if (!pcFilename) return FALSE;
 
-	if (xs_fload_buffer(pcFilename, &(myEngine->buf), &(myEngine->bufSize)) != 0)
-		return FALSE;
-	
-	if (!myEngine->currTune->read(myEngine->buf, myEngine->bufSize))
-		return FALSE;
+    if (xs_fload_buffer(pcFilename, &(myEngine->buf), &(myEngine->bufSize)) != 0)
+        return FALSE;
+    
+    if (!myEngine->currTune->read(myEngine->buf, myEngine->bufSize))
+        return FALSE;
 
-	return TRUE;
+    return TRUE;
 }
 
 
@@ -463,15 +463,15 @@
  */
 void xs_sidplay2_delete(xs_status_t * myStatus)
 {
-	xs_sidplay2_t *myEngine;
-	assert(myStatus);
+    xs_sidplay2_t *myEngine;
+    assert(myStatus);
 
-	myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
-	if (!myEngine) return;
-	
-	g_free(myEngine->buf);
-	myEngine->buf = NULL;
-	myEngine->bufSize = 0;
+    myEngine = (xs_sidplay2_t *) myStatus->sidEngine;
+    if (!myEngine) return;
+    
+    g_free(myEngine->buf);
+    myEngine->buf = NULL;
+    myEngine->bufSize = 0;
 }
 
 
@@ -479,20 +479,20 @@
  */
 void xs_sidplay2_flush(xs_status_t * myStatus)
 {
-	assert(myStatus);
+    assert(myStatus);
 
 #ifdef HAVE_HARDSID_BUILDER
 #ifdef HSID_SID2_COM
-	IfPtr<HardSIDBuilder> hs(myStatus->currBuilder);
-	if (hs)
-		hs->flush();
+    IfPtr<HardSIDBuilder> hs(myStatus->currBuilder);
+    if (hs)
+        hs->flush();
 #else
-	if (xs_cfg.sid2Builder == XS_BLD_HARDSID)
-		((HardSIDBuilder *) myStatus->currBuilder)->flush();
+    if (xs_cfg.sid2Builder == XS_BLD_HARDSID)
+        ((HardSIDBuilder *) myStatus->currBuilder)->flush();
 #endif
 #endif
 }
 
 
-}	/* extern "C" */
-#endif	/* HAVE_SIDPLAY2 */
+}    /* extern "C" */
+#endif    /* HAVE_SIDPLAY2 */