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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 */
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
4 t_xs_tuneinfo *TFUNCTION(gchar *pcFilename)
76
741291e14080 Added missing header
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
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
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
22 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
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
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
25 #endif
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
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
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
42 TTUNEINFO myInfo;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
43 TTUNE *myTune;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
44 TENGINE *myEngine;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
45 t_xs_tuneinfo *i;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
46
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
47 /* Check if we have required structures initialized */
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
48 if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine)
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
49 return FALSE;
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
50
468
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
51 myEngine = (TENGINE *) myStatus->sidEngine;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
52 myTune = myEngine->currTune;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
53 if (!myTune)
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
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
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
64 /* Here we assume that libSIDPlay[12] headers define SIDTUNE_SIDMODEL_*
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
65 * similarly to our enums in xs_config.h ...
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
66 */
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
67 i = myStatus->tuneInfo;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
68 i->sidModel = myInfo.sidModel;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
69
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
70 if ((myStatus->currSong >= 1) && (myStatus->currSong < i->nsubTunes)) {
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
71 t_xs_subtuneinfo *t = &(i->subTunes[myStatus->currSong - 1]);
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
72
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
73 switch (myInfo.songSpeed) {
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
74 case SIDTUNE_SPEED_VBI:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
75 switch (myInfo.clockSpeed) {
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
76 case SIDTUNE_CLOCK_PAL:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
77 t->tuneSpeed = 50;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
78 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
79
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
80 case SIDTUNE_CLOCK_NTSC:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
81 t->tuneSpeed = 60;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
82 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
83
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
84 default:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
85 t->tuneSpeed = -1;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
86 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
87 }
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
88 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
89
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
90 case SIDTUNE_SPEED_CIA_1A:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
91 t->tuneSpeed = 60;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
92 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
93
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
94 default:
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
95 t->tuneSpeed = -1;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
96 break;
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
97 }
6963982fcbb6 New songinfo system.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
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
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
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
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
103 /* Undefine these */
202
fe684a2ccdc7 Reworking code.
Matti Hamalainen <ccr@tnsp.org>
parents: 130
diff changeset
104 #undef TFUNCTION
460
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
105 #undef TFUNCTION2
95
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
106 #undef TTUNEINFO
4e929bb71057 Fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 93
diff changeset
107 #undef TTUNE