changeset 762:03c5cde1dfbb

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Nov 2012 22:38:41 +0200
parents 641b7693fecc
children 61a527ac3baa
files src/xs_sidplay.h
diffstat 1 files changed, 40 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_sidplay.h	Mon Nov 05 20:04:05 2012 +0200
+++ b/src/xs_sidplay.h	Mon Nov 05 22:38:41 2012 +0200
@@ -28,26 +28,26 @@
  */
 XSTuneInfo *TFUNCTION(const gchar *sidFilename)
 {
-    XSTuneInfo *pResult;
+    XSTuneInfo *res;
     TTUNEINFO myInfo;
     TTUNE *myTune;
     guint8 *buf = NULL;
     size_t bufSize = 0;
 
     /* Load file */
-    if (!sidFilename) return NULL;
-
     if (xs_fload_buffer(sidFilename, &buf, &bufSize) != 0)
         return NULL;
     
     /* Check if the tune exists and is readable */
-    if ((myTune = new TTUNE(buf, bufSize)) == NULL) {
+    if ((myTune = new TTUNE(buf, bufSize)) == NULL)
+    {
         g_free(buf);
         return NULL;
     }
     g_free(buf);
 
-    if (!myTune->getStatus()) {
+    if (!myTune->getStatus())
+    {
         delete myTune;
         return NULL;
     }
@@ -61,7 +61,7 @@
 #endif
 
     /* Allocate tuneinfo structure and set information */
-    pResult = xs_tuneinfo_new(sidFilename,
+    res = xs_tuneinfo_new(sidFilename,
         myInfo.songs, myInfo.startSong,
         myInfo.infoString[0], myInfo.infoString[1], myInfo.infoString[2],
         myInfo.loadAddr, myInfo.initAddr, myInfo.playAddr,
@@ -82,25 +82,25 @@
 
     delete myTune;
 
-    return pResult;
+    return res;
 }
 
 
 /* Updates the information of currently playing tune
  */
-gboolean TFUNCTION2(XSEngineState *myStatus)
+gboolean TFUNCTION2(XSEngineState *state)
 {
     TTUNEINFO myInfo;
     TTUNE *myTune;
-    TENGINE *myEngine;
+    TENGINE *engine;
     XSTuneInfo *i;
     
     /* Check if we have required structures initialized */
-    if (!myStatus || !myStatus->tuneInfo || !myStatus->internal)
+    if (!state || !state->tuneInfo || !state->internal)
         return FALSE;
 
-    myEngine = (TENGINE *) myStatus->internal;
-    myTune = myEngine->currTune;
+    engine = (TENGINE *) state->internal;
+    myTune = engine->tune;
     if (!myTune)
         return FALSE;
 
@@ -115,44 +115,47 @@
     /* NOTICE! Here we assume that libSIDPlay[12] headers define
      * SIDTUNE_SIDMODEL_* similarly to our enums in xs_config.h ...
      */
-    i = myStatus->tuneInfo;
+    i = state->tuneInfo;
 #if defined(XS_SIDPLAY2_H) && defined(HAVE_SIDPLAY2_FP)
     i->sidModel = myInfo.sidModel1;
 #else
     i->sidModel = myInfo.sidModel;
 #endif
 
-    if ((myStatus->currSong > 0) && (myStatus->currSong <= i->nsubTunes)) {
+    if (state->currSong > 0 && state->currSong <= i->nsubTunes)
+    {
         gint tmpSpeed = -1;
         
-        switch (myInfo.clockSpeed) {
-        case SIDTUNE_CLOCK_PAL:
-            tmpSpeed = XS_CLOCK_PAL;
-            break;
-        case SIDTUNE_CLOCK_NTSC:
-            tmpSpeed = XS_CLOCK_NTSC;
-            break;
-        case SIDTUNE_CLOCK_ANY:
-            tmpSpeed = XS_CLOCK_ANY;
-            break;
-        case SIDTUNE_CLOCK_UNKNOWN:
-            switch (myInfo.songSpeed) {
-            case SIDTUNE_SPEED_VBI:
-                tmpSpeed = XS_CLOCK_VBI;
+        switch (myInfo.clockSpeed)
+        {
+            case SIDTUNE_CLOCK_PAL:
+                tmpSpeed = XS_CLOCK_PAL;
+                break;
+            case SIDTUNE_CLOCK_NTSC:
+                tmpSpeed = XS_CLOCK_NTSC;
+                break;
+            case SIDTUNE_CLOCK_ANY:
+                tmpSpeed = XS_CLOCK_ANY;
                 break;
-            case SIDTUNE_SPEED_CIA_1A:
-                tmpSpeed = XS_CLOCK_CIA;
-                break;
+            case SIDTUNE_CLOCK_UNKNOWN:
+                switch (myInfo.songSpeed)
+                {
+                    case SIDTUNE_SPEED_VBI:
+                        tmpSpeed = XS_CLOCK_VBI;
+                        break;
+                    case SIDTUNE_SPEED_CIA_1A:
+                        tmpSpeed = XS_CLOCK_CIA;
+                        break;
+                    default:
+                        tmpSpeed = myInfo.songSpeed;
+                        break;
+                }
             default:
-                tmpSpeed = myInfo.songSpeed;
+                tmpSpeed = myInfo.clockSpeed;
                 break;
-            }
-        default:
-            tmpSpeed = myInfo.clockSpeed;
-            break;
         }
             
-        i->subTunes[myStatus->currSong - 1].tuneSpeed = tmpSpeed;
+        i->subTunes[state->currSong - 1].tuneSpeed = tmpSpeed;
     }
 
     return TRUE;