annotate Plugins/Input/sid/xs_sidplay.h @ 621:86c09efdc4e7 trunk

[svn] Build fixes for SID by NhJm.
author chainsaw
date Mon, 06 Feb 2006 16:24:20 -0800
parents 1b82a9932b60
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
1 /*
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
2 * Here comes the really ugly code...
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
3 * Get all SID-tune information (for all sub-tunes)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
4 * including name, length, etc.
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
5 */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
6 t_xs_tuneinfo *TFUNCTION(gchar * pcFilename)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
7 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
8 t_xs_sldb_node *tuneLength = NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
9 t_xs_tuneinfo *pResult;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
10 TTUNEINFO tuneInfo;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
11 TTUNE *testTune;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
12 gboolean haveInfo = TRUE;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
13 gint i;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
14
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
15 /* Check if the tune exists and is readable */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
16 if ((testTune = new TTUNE(pcFilename)) == NULL)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
17 return NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
18
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
19 if (!testTune->getStatus()) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
20 delete testTune;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
21 return NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
22 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
23
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
24 /* Get general tune information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
25 #ifdef _XS_SIDPLAY1_H
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
26 haveInfo = testTune->getInfo(tuneInfo);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
27 #endif
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
28 #ifdef _XS_SIDPLAY2_H
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
29 testTune->getInfo(tuneInfo);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
30 haveInfo = TRUE;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
31 #endif
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
32
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
33 /* Get length information (NOTE: Do not free this!) */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
34 tuneLength = xs_songlen_get(pcFilename);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
35
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
36 /* Allocate tuneinfo structure */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
37 pResult = xs_tuneinfo_new(pcFilename,
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
38 tuneInfo.songs, tuneInfo.startSong,
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
39 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
40 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, tuneInfo.dataFileLen);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
41
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
42 if (!pResult) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
43 delete testTune;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
44 return NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
45 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
46
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
47 /* Get information for subtunes */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
48 for (i = 0; i < pResult->nsubTunes; i++) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
49 /* Make the title */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
50 if (haveInfo) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
51 pResult->subTunes[i].tuneTitle =
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
52 xs_make_titlestring(pcFilename, i + 1, pResult->nsubTunes, tuneInfo.sidModel,
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
53 tuneInfo.formatString, tuneInfo.infoString[0],
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
54 tuneInfo.infoString[1], tuneInfo.infoString[2]);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
55 } else
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
56 pResult->subTunes[i].tuneTitle = g_strdup(pcFilename);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
57
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
58 /* Get song length */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
59 if (tuneLength && (i < tuneLength->nLengths))
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
60 pResult->subTunes[i].tuneLength = tuneLength->sLengths[i];
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
61 else
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
62 pResult->subTunes[i].tuneLength = -1;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
63 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
64
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
65 delete testTune;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
66
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
67 return pResult;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
68 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
69
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
70 /* Undefine these */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
71 #undef TFUNCTION
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
72 #undef TTUNEINFO
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
73 #undef TTUNE