Mercurial > hg > xmms-sid
annotate 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 |
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 | |
70 if ((myStatus->currSong >= 1) && (myStatus->currSong < i->nsubTunes)) { | |
71 t_xs_subtuneinfo *t = &(i->subTunes[myStatus->currSong - 1]); | |
72 | |
73 switch (myInfo.songSpeed) { | |
74 case SIDTUNE_SPEED_VBI: | |
75 switch (myInfo.clockSpeed) { | |
76 case SIDTUNE_CLOCK_PAL: | |
77 t->tuneSpeed = 50; | |
78 break; | |
79 | |
80 case SIDTUNE_CLOCK_NTSC: | |
81 t->tuneSpeed = 60; | |
82 break; | |
83 | |
84 default: | |
85 t->tuneSpeed = -1; | |
86 break; | |
87 } | |
88 break; | |
89 | |
90 case SIDTUNE_SPEED_CIA_1A: | |
91 t->tuneSpeed = 60; | |
92 break; | |
93 | |
94 default: | |
95 t->tuneSpeed = -1; | |
96 break; | |
97 } | |
98 } | |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
99 |
460 | 100 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
|
101 } |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
102 |
95 | 103 /* Undefine these */ |
202 | 104 #undef TFUNCTION |
460 | 105 #undef TFUNCTION2 |
95 | 106 #undef TTUNEINFO |
107 #undef TTUNE |