changeset 796:dfda3d47baf7

Clean up the variables etc.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Nov 2012 11:05:42 +0200
parents 3e305ce076e8
children 02512cbc6d9f
files src/xs_sidplay.h
diffstat 1 files changed, 32 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_sidplay.h	Wed Nov 07 11:05:24 2012 +0200
+++ b/src/xs_sidplay.h	Wed Nov 07 11:05:42 2012 +0200
@@ -26,50 +26,51 @@
  * (those variables that are only set by libSIDPlay when tune is initialized).
  * Rest of the information is acquired in TFUNCTION2()
  */
-XSTuneInfo *TFUNCTION(const gchar *sidFilename)
+XSTuneInfo *TFUNCTION(const gchar *filename)
 {
     XSTuneInfo *res;
-    TTUNEINFO myInfo;
-    TTUNE *myTune;
+    TTUNEINFO info;
+    TTUNE *tune;
     guint8 *buf = NULL;
     size_t bufSize = 0;
 
     /* Load file */
-    if (xs_fload_buffer(sidFilename, &buf, &bufSize) != 0)
+    if (xs_fload_buffer(filename, &buf, &bufSize) != 0)
         return NULL;
     
     /* Check if the tune exists and is readable */
-    if ((myTune = new TTUNE(buf, bufSize)) == NULL)
+    if ((tune = new TTUNE(buf, bufSize)) == NULL)
     {
         g_free(buf);
         return NULL;
     }
     g_free(buf);
 
-    if (!myTune->getStatus())
+    if (!tune->getStatus())
     {
-        delete myTune;
+        delete tune;
         return NULL;
     }
 
     /* Get general tune information */
 #ifdef XS_SIDPLAY1_H
-    myTune->getInfo(myInfo);
+    tune->getInfo(info);
 #endif
+
 #ifdef XS_SIDPLAY2_H
-    myInfo = myTune->getInfo();
+    info = tune->getInfo();
 #endif
 
     /* Allocate tuneinfo structure and set information */
-    res = xs_tuneinfo_new(sidFilename,
-        myInfo.songs, myInfo.startSong,
-        myInfo.infoString[0], myInfo.infoString[1], myInfo.infoString[2],
-        myInfo.loadAddr, myInfo.initAddr, myInfo.playAddr,
-        myInfo.dataFileLen, myInfo.formatString,
+    res = xs_tuneinfo_new(filename,
+        info.songs, info.startSong,
+        info.infoString[0], info.infoString[1], info.infoString[2],
+        info.loadAddr, info.initAddr, info.playAddr,
+        info.dataFileLen, info.formatString,
 #if defined(XS_SIDPLAY2_H) && defined(HAVE_SIDPLAY2_FP)
-        myInfo.sidModel1
+        info.sidModel1
 #else
-        myInfo.sidModel
+        info.sidModel
 #endif
         );
     
@@ -80,7 +81,7 @@
      * but at least we have a reasonable guesstimate.
      */
 
-    delete myTune;
+    delete tune;
 
     return res;
 }
@@ -90,43 +91,41 @@
  */
 gboolean TFUNCTION2(XSEngineState *state)
 {
-    TTUNEINFO myInfo;
-    TTUNE *myTune;
+    TTUNEINFO info;
+    TTUNE *tune;
     TENGINE *engine;
-    XSTuneInfo *i;
     
     /* Check if we have required structures initialized */
     if (!state || !state->tuneInfo || !state->internal)
         return FALSE;
 
     engine = (TENGINE *) state->internal;
-    myTune = engine->tune;
-    if (!myTune)
+    tune = engine->tune;
+    if (!tune)
         return FALSE;
 
     /* Get currently playing tune information */
 #ifdef XS_SIDPLAY1_H
-    myTune->getInfo(myInfo);
+    tune->getInfo(info);
 #endif
 #ifdef XS_SIDPLAY2_H
-    myInfo = myTune->getInfo();
+    info = tune->getInfo();
 #endif
 
     /* NOTICE! Here we assume that libSIDPlay[12] headers define
      * SIDTUNE_SIDMODEL_* similarly to our enums in xs_config.h ...
      */
-    i = state->tuneInfo;
 #if defined(XS_SIDPLAY2_H) && defined(HAVE_SIDPLAY2_FP)
-    i->sidModel = myInfo.sidModel1;
+    state->tuneInfo->sidModel = info.sidModel1;
 #else
-    i->sidModel = myInfo.sidModel;
+    state->tuneInfo->sidModel = info.sidModel;
 #endif
 
-    if (state->currSong > 0 && state->currSong <= i->nsubTunes)
+    if (state->currSong > 0 && state->currSong <= state->tuneInfo->nsubTunes)
     {
         gint tmpSpeed = -1;
         
-        switch (myInfo.clockSpeed)
+        switch (info.clockSpeed)
         {
             case SIDTUNE_CLOCK_PAL:
                 tmpSpeed = XS_CLOCK_PAL;
@@ -138,7 +137,7 @@
                 tmpSpeed = XS_CLOCK_ANY;
                 break;
             case SIDTUNE_CLOCK_UNKNOWN:
-                switch (myInfo.songSpeed)
+                switch (info.songSpeed)
                 {
                     case SIDTUNE_SPEED_VBI:
                         tmpSpeed = XS_CLOCK_VBI;
@@ -147,15 +146,15 @@
                         tmpSpeed = XS_CLOCK_CIA;
                         break;
                     default:
-                        tmpSpeed = myInfo.songSpeed;
+                        tmpSpeed = info.songSpeed;
                         break;
                 }
             default:
-                tmpSpeed = myInfo.clockSpeed;
+                tmpSpeed = info.clockSpeed;
                 break;
         }
             
-        i->subTunes[state->currSong - 1].tuneSpeed = tmpSpeed;
+        state->tuneInfo->subTunes[state->currSong - 1].tuneSpeed = tmpSpeed;
     }
 
     return TRUE;