Mercurial > hg > xmms-sid
annotate src/xs_sidplay.h @ 526:fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 20 Feb 2007 16:53:05 +0000 |
parents | 99f05a74de5b |
children | fe8b41abd923 |
rev | line source |
---|---|
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
1 /* |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
3 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
4 libSIDPlay skeleton functions used both by v1 and 2 of the backends |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
5 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
7 (C) Copyright 2005-2007 Tecnic Software productions (TNSP) |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
8 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
12 (at your option) any later version. |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
13 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
17 GNU General Public License for more details. |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
18 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
22 */ |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
23 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
24 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
25 /* This function gets most of the information, though we do miss some |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
26 * (those variables that are only set by libSIDPlay when tune is initialized). |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
27 * Rest of the information is acquired in TFUNCTION2() |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
28 * |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
29 * NOTICE! FIXME?! It might be faster to use a SID-parser of our own here, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
30 * thought it might make us bit incompatible ... |
76 | 31 */ |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
32 t_xs_tuneinfo *TFUNCTION(gchar *sidFilename) |
76 | 33 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
34 t_xs_tuneinfo *pResult; |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
35 TTUNEINFO myInfo; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
36 TTUNE *myTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
37 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
38 /* Check if the tune exists and is readable */ |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
39 if ((myTune = new TTUNE(sidFilename)) == NULL) |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
40 return NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
41 |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
42 if (!myTune->getStatus()) { |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
43 delete myTune; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
44 return NULL; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
45 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
46 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
47 /* Get general tune information */ |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
48 #ifdef XS_SIDPLAY1_H |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
49 myTune->getInfo(myInfo); |
95 | 50 #endif |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
51 #ifdef XS_SIDPLAY2_H |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
52 myInfo = myTune->getInfo(); |
95 | 53 #endif |
54 | |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
55 /* Allocate tuneinfo structure and set information */ |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
56 pResult = xs_tuneinfo_new(sidFilename, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
57 myInfo.songs, myInfo.startSong, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
58 myInfo.infoString[0], myInfo.infoString[1], myInfo.infoString[2], |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
59 myInfo.loadAddr, myInfo.initAddr, myInfo.playAddr, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
60 myInfo.dataFileLen, myInfo.formatString, myInfo.sidModel); |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
61 |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
62 /* NOTICE! libSIDPlay[12] headers specifically state that sidModel, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
63 * songSpeed and clockSpeed are "undefined" before song initialization, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
64 * but in practice sidModel is known after getInfo() invocation... |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
65 * This of course does not take the sub-tune specific changes into account, |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
66 * but at least we have a reasonable guesstimate. |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
67 */ |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
68 |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
69 delete myTune; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
70 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
71 return pResult; |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
72 } |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
73 |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
74 |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
75 /* Updates the information of currently playing tune |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
76 */ |
460 | 77 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
|
78 { |
468 | 79 TTUNEINFO myInfo; |
80 TTUNE *myTune; | |
81 TENGINE *myEngine; | |
82 t_xs_tuneinfo *i; | |
83 | |
84 /* Check if we have required structures initialized */ | |
85 if (!myStatus || !myStatus->tuneInfo || !myStatus->sidEngine) | |
86 return FALSE; | |
460 | 87 |
468 | 88 myEngine = (TENGINE *) myStatus->sidEngine; |
89 myTune = myEngine->currTune; | |
90 if (!myTune) | |
460 | 91 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
|
92 |
468 | 93 /* Get currently playing tune information */ |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
94 #ifdef XS_SIDPLAY1_H |
468 | 95 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
|
96 #endif |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
479
diff
changeset
|
97 #ifdef XS_SIDPLAY2_H |
468 | 98 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
|
99 #endif |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
100 |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
101 /* NOTICE! Here we assume that libSIDPlay[12] headers define |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
102 * SIDTUNE_SIDMODEL_* similarly to our enums in xs_config.h ... |
468 | 103 */ |
104 i = myStatus->tuneInfo; | |
105 i->sidModel = myInfo.sidModel; | |
106 | |
472 | 107 if ((myStatus->currSong > 0) && (myStatus->currSong <= i->nsubTunes)) { |
108 gint tmpSpeed = -1; | |
468 | 109 |
472 | 110 switch (myInfo.clockSpeed) { |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
111 case SIDTUNE_CLOCK_PAL: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
112 tmpSpeed = XS_CLOCK_PAL; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
113 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
114 case SIDTUNE_CLOCK_NTSC: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
115 tmpSpeed = XS_CLOCK_NTSC; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
116 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
117 case SIDTUNE_CLOCK_ANY: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
118 tmpSpeed = XS_CLOCK_ANY; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
119 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
120 case SIDTUNE_CLOCK_UNKNOWN: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
121 switch (myInfo.songSpeed) { |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
122 case SIDTUNE_SPEED_VBI: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
123 tmpSpeed = XS_CLOCK_VBI; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
124 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
125 case SIDTUNE_SPEED_CIA_1A: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
126 tmpSpeed = XS_CLOCK_CIA; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
127 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
128 default: |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
129 tmpSpeed = myInfo.songSpeed; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
130 break; |
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
131 } |
468 | 132 default: |
479
99f05a74de5b
Improvements in titlestring handling and information passing in
Matti Hamalainen <ccr@tnsp.org>
parents:
472
diff
changeset
|
133 tmpSpeed = myInfo.clockSpeed; |
468 | 134 break; |
135 } | |
472 | 136 |
137 i->subTunes[myStatus->currSong - 1].tuneSpeed = tmpSpeed; | |
468 | 138 } |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
139 |
460 | 140 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
|
141 } |
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
142 |
95 | 143 /* Undefine these */ |
202 | 144 #undef TFUNCTION |
460 | 145 #undef TFUNCTION2 |
95 | 146 #undef TTUNEINFO |
147 #undef TTUNE |