Mercurial > hg > xmms-sid
view src/xs_sidplay.h @ 468:6963982fcbb6
New songinfo system.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 03:46:04 +0000 |
parents | 9e683fb666ba |
children | 3f02945a0c48 |
line wrap: on
line source
/* Here comes the really ugly code... Get all SID-tune information * for all sub-tunes, including name, length, etc. */ t_xs_tuneinfo *TFUNCTION(gchar *pcFilename) { t_xs_tuneinfo *pResult; TTUNEINFO tuneInfo; TTUNE *testTune; /* Check if the tune exists and is readable */ if ((testTune = new TTUNE(pcFilename)) == NULL) return NULL; if (!testTune->getStatus()) { delete testTune; return NULL; } /* Get general tune information */ #ifdef _XS_SIDPLAY1_H testTune->getInfo(tuneInfo); #endif #ifdef _XS_SIDPLAY2_H tuneInfo = testTune->getInfo(); #endif /* Allocate tuneinfo structure */ pResult = xs_tuneinfo_new(pcFilename, tuneInfo.songs, tuneInfo.startSong, tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2], tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, tuneInfo.dataFileLen, tuneInfo.formatString, -1); delete testTune; return pResult; } gboolean TFUNCTION2(t_xs_status *myStatus) { TTUNEINFO myInfo; TTUNE *myTune; TENGINE *myEngine; t_xs_tuneinfo *i; /* Check if we have required structures initialized */ if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine) return FALSE; myEngine = (TENGINE *) myStatus->sidEngine; myTune = myEngine->currTune; if (!myTune) return FALSE; /* Get currently playing tune information */ #ifdef _XS_SIDPLAY1_H myTune->getInfo(myInfo); #endif #ifdef _XS_SIDPLAY2_H myInfo = myTune->getInfo(); #endif /* Here we assume that libSIDPlay[12] headers define SIDTUNE_SIDMODEL_* * similarly to our enums in xs_config.h ... */ i = myStatus->tuneInfo; i->sidModel = myInfo.sidModel; if ((myStatus->currSong >= 1) && (myStatus->currSong < i->nsubTunes)) { t_xs_subtuneinfo *t = &(i->subTunes[myStatus->currSong - 1]); switch (myInfo.songSpeed) { case SIDTUNE_SPEED_VBI: switch (myInfo.clockSpeed) { case SIDTUNE_CLOCK_PAL: t->tuneSpeed = 50; break; case SIDTUNE_CLOCK_NTSC: t->tuneSpeed = 60; break; default: t->tuneSpeed = -1; break; } break; case SIDTUNE_SPEED_CIA_1A: t->tuneSpeed = 60; break; default: t->tuneSpeed = -1; break; } } return TRUE; } /* Undefine these */ #undef TFUNCTION #undef TFUNCTION2 #undef TTUNEINFO #undef TTUNE