Mercurial > hg > xmms-sid
annotate src/xs_sidplay.h @ 472:3f02945a0c48
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 05:58:05 +0000 |
parents | 6963982fcbb6 |
children | 99f05a74de5b |
rev | line source |
---|---|
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
373
diff
changeset
|
1 /* Here comes the really ugly code... Get all SID-tune information |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
373
diff
changeset
|
2 * for all sub-tunes, including name, length, etc. |
76 | 3 */ |
460 | 4 t_xs_tuneinfo *TFUNCTION(gchar *pcFilename) |
76 | 5 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
6 t_xs_tuneinfo *pResult; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
7 TTUNEINFO tuneInfo; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
8 TTUNE *testTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
9 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
10 /* Check if the tune exists and is readable */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
11 if ((testTune = new TTUNE(pcFilename)) == NULL) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
12 return NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
13 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
14 if (!testTune->getStatus()) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
15 delete testTune; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
16 return NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
17 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
18 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
19 /* Get general tune information */ |
95 | 20 #ifdef _XS_SIDPLAY1_H |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
21 testTune->getInfo(tuneInfo); |
95 | 22 #endif |
23 #ifdef _XS_SIDPLAY2_H | |
412
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
24 tuneInfo = testTune->getInfo(); |
95 | 25 #endif |
26 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
27 /* Allocate tuneinfo structure */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
28 pResult = xs_tuneinfo_new(pcFilename, |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
373
diff
changeset
|
29 tuneInfo.songs, tuneInfo.startSong, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
373
diff
changeset
|
30 tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2], |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
373
diff
changeset
|
31 tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr, |
468 | 32 tuneInfo.dataFileLen, tuneInfo.formatString, -1); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
33 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
34 delete testTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
35 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
36 return pResult; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
37 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
38 |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
39 |
460 | 40 gboolean TFUNCTION2(t_xs_status *myStatus) |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
41 { |
468 | 42 TTUNEINFO myInfo; |
43 TTUNE *myTune; | |
44 TENGINE *myEngine; | |
45 t_xs_tuneinfo *i; | |
46 | |
47 /* Check if we have required structures initialized */ | |
48 if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine) | |
49 return FALSE; | |
460 | 50 |
468 | 51 myEngine = (TENGINE *) myStatus->sidEngine; |
52 myTune = myEngine->currTune; | |
53 if (!myTune) | |
460 | 54 return FALSE; |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
55 |
468 | 56 /* Get currently playing tune information */ |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
57 #ifdef _XS_SIDPLAY1_H |
468 | 58 myTune->getInfo(myInfo); |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
59 #endif |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
60 #ifdef _XS_SIDPLAY2_H |
468 | 61 myInfo = myTune->getInfo(); |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
62 #endif |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
63 |
468 | 64 /* Here we assume that libSIDPlay[12] headers define SIDTUNE_SIDMODEL_* |
65 * similarly to our enums in xs_config.h ... | |
66 */ | |
67 i = myStatus->tuneInfo; | |
68 i->sidModel = myInfo.sidModel; | |
69 | |
472 | 70 XSDEBUG("%s[%d]: %d, %d\n", i->sidFilename, myStatus->currSong, myInfo.songSpeed, myInfo.clockSpeed); |
71 | |
72 if ((myStatus->currSong > 0) && (myStatus->currSong <= i->nsubTunes)) { | |
73 gint tmpSpeed = -1; | |
468 | 74 |
472 | 75 switch (myInfo.clockSpeed) { |
76 case SIDTUNE_CLOCK_PAL: tmpSpeed = 50; break; | |
77 case SIDTUNE_CLOCK_NTSC: tmpSpeed = 60; break; | |
468 | 78 default: |
472 | 79 if (myInfo.songSpeed != 0) |
80 tmpSpeed = myInfo.songSpeed; | |
468 | 81 break; |
82 } | |
472 | 83 |
84 i->subTunes[myStatus->currSong - 1].tuneSpeed = tmpSpeed; | |
468 | 85 } |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
86 |
460 | 87 return TRUE; |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
88 } |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
89 |
95 | 90 /* Undefine these */ |
202 | 91 #undef TFUNCTION |
460 | 92 #undef TFUNCTION2 |
95 | 93 #undef TTUNEINFO |
94 #undef TTUNE |