Debian Codegraph @

src/spctag.h

raw symbols SCIP
1 /*
2 spctag.h : interface of the spctag library
3 v0.2 - 2011-09-18
4
5 Copyright (C) 2011 Jérôme SONRIER <[email protected]g>
6
7 This file is part of libspctag.
8
9 libspctag is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 libspctag is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with libspctag. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23
24 #ifndef SPCTAG_H
25 #define SPCTAG_H 1
26
27 /* Library version */
28 #define LIBSPCTAG_MAJOR 0 /* Major number of library version */
29 #define LIBSPCTAG_MINOR 2 /* Minor number of library version */
30
31 /* Library version (string) */
32 #define LIBSPCTAG_VERSION_STR "0.2"
33
34 // Field length
35 #define SPCTAG_SONGTITLE_LENGTH 32
36 #define SPCTAG_GAMETITLE_LENGTH 32
37 #define SPCTAG_DUMPERNAME_LENGTH 16
38 #define SPCTAG_COMMENTS_LENGTH 32
39 #define SPCTAG_DUMPDATE_TXT_LENGTH 11
40 #define SPCTAG_DUMPYEAR_BIN_LENGTH 2
41 #define SPCTAG_LENGTH_LENGTH 3
42 #define SPCTAG_FADELENGTH_TXT_LENGTH 5
43 #define SPCTAG_FADELENGTH_BIN_LENGTH 4
44 #define SPCTAG_ARTIST_LENGTH 32
45
46 // Return codes
47 #define SPCTAG_SUCCESS 0
48 #define SPCTAG_E_NOT_SPC -1
49 #define SPCTAG_E_NO_TAGS -2
50
51 #define SPCTAG_EXPORT __attribute__ ((visibility ("default")))
52
53 /* Represents ASCII tags */
54 struct TAGS_TXT {
55 char song_title[SPCTAG_SONGTITLE_LENGTH]; // Song title
56 char game_title[SPCTAG_GAMETITLE_LENGTH]; // Game title
57 char dumper_name[SPCTAG_DUMPERNAME_LENGTH]; // Name of dumper
58 char comments[SPCTAG_COMMENTS_LENGTH]; // Comments
59 char dump_date[SPCTAG_DUMPDATE_TXT_LENGTH]; // Date SPC was dumped (MM/DD/YYYY)
60 char length[SPCTAG_LENGTH_LENGTH]; // Number of seconds to play song before fading out
61 char fade_length[SPCTAG_FADELENGTH_TXT_LENGTH]; // Length of fade in milliseconds
62 char artist[SPCTAG_ARTIST_LENGTH]; // Artist of song
63 char default_channels; // Default channel disables (0 = enable, 1 = disable)
64 char emulator; // Emulator used to dump SPC
65 char reserved[45];
66 } __attribute__((packed)) *spctag_tags_txt;
67
68 /* Represents binary tags */
69 struct TAGS_BIN {
70 char song_title[SPCTAG_SONGTITLE_LENGTH]; // Song title
71 char game_title[SPCTAG_GAMETITLE_LENGTH]; // Game title
72 char dumper_name[SPCTAG_DUMPERNAME_LENGTH]; // Name of dumper
73 char comments[SPCTAG_COMMENTS_LENGTH]; // Comments
74 char dump_day; // Day SPC was dumped
75 char dump_month; // Month SPC was dumped
76 char dump_year[SPCTAG_DUMPYEAR_BIN_LENGTH]; // Year SPC was dumped
77 char unused[7];
78 char length[SPCTAG_LENGTH_LENGTH]; // Number of seconds to play song before fading out
79 char fade_length[SPCTAG_FADELENGTH_BIN_LENGTH]; // Length of fade in milliseconds
80 char artist[SPCTAG_ARTIST_LENGTH]; // Artist of song
81 char default_channels; // Default channel disables (0 = enable, 1 = disable)
82 char emulator; // Emulator used to dump SPC
83 char reserved[46];
84 } __attribute__((packed)) *spctag_tags_bin;
85
86 // Globale variables
87 SPCTAG_EXPORT int spctag_is_init = 0; // 1 when spctag is initialized and can be used
88 SPCTAG_EXPORT int spctag_txt_tag = 0; // 1 if tags are in ASCII format, 0 if tags are in binary format
89
90 /*
91 * spctag_init
92 * Read tags from file.
93 * param:
94 * file: SPC file descriptor
95 * return:
96 * 0: succes
97 * <0: error
98 */
99 SPCTAG_EXPORT int spctag_init( FILE *file );
100
101 /*
102 * spctag_get_songtitle
103 * Return the song title.
104 * return:
105 * song title
106 */
107 SPCTAG_EXPORT char* spctag_get_songtitle();
108
109 /*
110 * spctag_get_gametitle
111 * Return the game title.
112 * return:
113 * game title
114 */
115 SPCTAG_EXPORT char* spctag_get_gametitle();
116
117 /*
118 * spctag_get_dumpername
119 * Return the dumper name.
120 * return:
121 * dumper name
122 */
123 SPCTAG_EXPORT char* spctag_get_dumpername();
124
125 /*
126 * spctag_get_comments
127 * Return comments.
128 * return:
129 * comments
130 */
131 SPCTAG_EXPORT char* spctag_get_comments();
132
133 /*
134 * spctag_get_dumpdate
135 * Return the dump date.
136 * return:
137 * dump date
138 */
139 SPCTAG_EXPORT char* spctag_get_dumpdate();
140
141 /*
142 * spctag_get_length
143 * Return the number of seconds to play song before fading out.
144 * return:
145 * song length
146 */
147 SPCTAG_EXPORT char* spctag_get_length();
148
149 /*
150 * spctag_get_fadelength
151 * Return the length of fade in milliseconds.
152 * return:
153 * fade length
154 */
155 SPCTAG_EXPORT char* spctag_get_fadelength();
156
157 /*
158 * spctag_get_artist
159 * Return the artist name.
160 * return:
161 * artist name
162 */
163 SPCTAG_EXPORT char* spctag_get_artist();
164
165 /*
166 * spctag_get_defaultchannels
167 * Return channel states.
168 * return:
169 * channel states
170 */
171 SPCTAG_EXPORT char* spctag_get_defaultchannels();
172
173 /*
174 * spctag_get_emulator
175 * Return the name of the emulator used to dump.
176 * return:
177 * emulator
178 */
179 SPCTAG_EXPORT char* spctag_get_emulator();
180
181 /*
182 * spctag_set_songtitle
183 * Set the song title into tags structure.
184 * param:
185 * new_songtitle: new song title
186 * return:
187 * 0: succes
188 * <0: error
189 */
190 SPCTAG_EXPORT int spctag_set_songtitle( char* new_songtitle );
191
192 /*
193 * spctag_set_gametitle
194 * Set the game title.
195 * param:
196 * new_gametitle: new game title
197 * return:
198 * 0: succes
199 * <0: error
200 */
201 SPCTAG_EXPORT int spctag_set_gametitle( char* new_gametitle );
202
203 /*
204 * spctag_set_dumpername
205 * Set the dumper name.
206 * param:
207 * new_dumpername: new dumper name
208 * return:
209 * 0: succes
210 * <0: error
211 */
212 SPCTAG_EXPORT int spctag_set_dumpername( char* new_dumpername );
213
214 /*
215 * spctag_set_comments
216 * Set comments.
217 * param:
218 * new_comments: new comments
219 * return:
220 * 0: succes
221 * <0: error
222 */
223 SPCTAG_EXPORT int spctag_set_comments( char* new_comments );
224
225 /*
226 * spctag_set_dumpdate
227 * Set the dump date.
228 * param:
229 * new_comments: new comments
230 * return:
231 * 0: succes
232 * <0: error
233 */
234 SPCTAG_EXPORT int spctag_set_dumpdate( char* new_dumdate );
235
236 /*
237 * spctag_set_length
238 * Set the number of seconds to play song before fading out.
239 * param:
240 * new_length: new song length
241 * return:
242 * 0: succes
243 * <0: error
244 */
245 SPCTAG_EXPORT int spctag_set_length( char* new_length );
246
247 /*
248 * spctag_set_fadelength
249 * Set the length of fade in milliseconds.
250 * param:
251 * new_fadelength: new fade length
252 * return:
253 * 0: succes
254 * <0: error
255 */
256 SPCTAG_EXPORT int spctag_set_fadelength( char* new_fadelength );
257
258 /*
259 * spctag_set_artist
260 * Set the artist name.
261 * param:
262 * new_artist: new artist name
263 * return:
264 * 0: succes
265 * <0: error
266 */
267 SPCTAG_EXPORT int spctag_set_artist( char* new_artist );
268
269 /*
270 * spctag_set_defaultchannels
271 * Set channels states.
272 * param:
273 * new_defaultchannels: new default channel states
274 * return:
275 * 0: succes
276 * <0: error
277 */
278 SPCTAG_EXPORT int spctag_set_defaultchannels( char* new_defaultchannels );
279
280 /*
281 * spctag_set_emulator
282 * Set the name of the emulator used to dump.
283 * param:
284 * new_emulator: new emulator
285 * return:
286 * 0: succes
287 * <0: error
288 */
289 SPCTAG_EXPORT int spctag_set_emulator( char* new_emulator );
290
291 /*
292 * spctag_save
293 * Write structures into file.
294 * return:
295 * 0: succes
296 * <0: error
297 */
298 SPCTAG_EXPORT int spctag_save( FILE* file );
299
300 /*
301 * spctag_free
302 * Free memory used by libspctag.
303 */
304 SPCTAG_EXPORT void spctag_free();
305
306 #endif