comparison src/xs_sidplay2.cc @ 87:94497283affa

Various fixes and improvements
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 05 Oct 2003 10:38:03 +0000
parents ab522ab65c85
children 63cf9b2ddadf
comparison
equal deleted inserted replaced
86:9533b78f1a7d 87:94497283affa
56 56
57 57
58 /* 58 /*
59 * Check if we can play the given file 59 * Check if we can play the given file
60 */ 60 */
61 gboolean xs_sidplay2_isourfile(gchar *pcFileName) 61 gboolean xs_sidplay2_isourfile(gchar *pcFilename)
62 { 62 {
63 SidTune *testTune = new SidTune(pcFileName); 63 SidTune *testTune = new SidTune(pcFilename);
64 64
65 if (!testTune) return FALSE; 65 if (!testTune) return FALSE;
66 if (!testTune->getStatus()) 66 if (!testTune->getStatus())
67 { 67 {
68 delete testTune; 68 delete testTune;
94 XSERR("Could not initialize libSIDPlay2 emulation engine\n"); 94 XSERR("Could not initialize libSIDPlay2 emulation engine\n");
95 return FALSE; 95 return FALSE;
96 } 96 }
97 97
98 /* Initialize builder object */ 98 /* Initialize builder object */
99 /* 99 XSDEBUG("init builder #%i\n", xs_cfg.sid2Builder);
100 FIXME! we need to select builder by configuration!
101 */
102 #ifdef HAVE_RESID_BUILDER 100 #ifdef HAVE_RESID_BUILDER
103 if (xs_cfg.sid2Builder == XS_BLD_RESID) 101 if (xs_cfg.sid2Builder == XS_BLD_RESID)
104 { 102 {
105 ReSIDBuilder *tmpb = new ReSIDBuilder("SIDPlay2 suxx and is made by a fag - ReSID builder"); 103 ReSIDBuilder *tmpb = new ReSIDBuilder("SIDPlay2 suxx and is made by a fag - ReSID builder");
106 104
203 201
204 return (myPlayer->currEng->play(audioBuffer, audioBufSize) == audioBufSize); 202 return (myPlayer->currEng->play(audioBuffer, audioBufSize) == audioBufSize);
205 } 203 }
206 204
207 205
208 gboolean xs_sidplay2_loadsid(t_xs_status *myStatus, gchar *pcFileName) 206 gboolean xs_sidplay2_loadsid(t_xs_status *myStatus, gchar *pcFilename)
209 { 207 {
210 t_xs_sidplay2 *myPlayer = (t_xs_sidplay2 *) myStatus->player; 208 t_xs_sidplay2 *myPlayer = (t_xs_sidplay2 *) myStatus->player;
211 SidTuneInfo tuneInfo;
212 assert(myStatus); 209 assert(myStatus);
213 210
214 /* Try to get the tune */ 211 /* Try to get the tune */
215 if (!pcFileName) return FALSE; 212 if (!pcFilename) return FALSE;
216 if (!myPlayer->currTune->load(pcFileName)) return FALSE; 213 XSDEBUG("paski #1\n");
214 if (!myPlayer->currTune->load(pcFilename)) return FALSE;
215 XSDEBUG("paski #2\n");
217 216
218 /* Get current configuration */ 217 /* Get current configuration */
219 myPlayer->currConfig = myPlayer->currEng->config(); 218 myPlayer->currConfig = myPlayer->currEng->config();
220 219
221 /* Configure channels and stuff */ 220 /* Configure channels and stuff */
291 #else 290 #else
292 myPlayer->currConfig.sampleFormat = SID2_LITTLE_SIGNED; 291 myPlayer->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
293 #endif 292 #endif
294 #endif 293 #endif
295 294
295 XSDEBUG("paski #3\n");
296
296 /* Now set the emulator configuration */ 297 /* Now set the emulator configuration */
297 if (myPlayer->currEng->config(myPlayer->currConfig) < 0) 298 if (myPlayer->currEng->config(myPlayer->currConfig) < 0)
298 { 299 {
299 XSERR("Emulator engine configuration failed!\n"); 300 XSERR("Emulator engine configuration failed!\n");
300 return FALSE; 301 return FALSE;
301 } 302 }
302 303
303 /* Initialize status information */ 304 XSDEBUG("paski #4\n");
304 myPlayer->currTune->getInfo(tuneInfo);
305 myStatus->currSong = tuneInfo.startSong;
306 myStatus->nSongs = tuneInfo.songs;
307 305
308 return TRUE; 306 return TRUE;
309 } 307 }
310 308
311 309
312 /* 310 /*
313 * Delete tune 311 * Delete tune
314 */ 312 */
315 void xs_sidplay2_deletesid(t_xs_status *myStatus) 313 void xs_sidplay2_deletesid(t_xs_status *myStatus)
316 { 314 {
317 t_xs_sidplay2 *myPlayer;
318 assert(myStatus); 315 assert(myStatus);
319 316
320 /* 317 /* With the current scheme of handling sidtune-loading, we don't do anything here. */
321 myPlayer = (t_xs_sidplay2 *) myStatus->player; 318 }
322 if (!myPlayer) return; 319
323
324 if (myPlayer->currTune)
325 {
326 delete myPlayer->currTune;
327 myPlayer->currTune = NULL;
328 }
329 */
330 }
331
332
333 gint xs_sidplay2_gettunespeed(t_xs_status *myStatus)
334 {
335 return 0;
336 }
337 320
338 /* 321 /*
339 * Return song information 322 * Return song information
340 */ 323 */
341 void xs_sidplay2_getsidinfo(gchar *songFileName, gchar **songTitle, gint *songLength) 324 #define TFUNCTION1 xs_sidplay2_filetitle
342 { 325 #define TFUNCTION2 xs_sidplay2_getsidinfo
343 } 326 #define TTUNEINFO SidTuneInfo
344 327 #define TTUNE SidTune
328 #include "xs_sidplay.h"
345 329
346 } /* extern "C" */ 330 } /* extern "C" */
347 #endif /* HAVE_SIDPLAY2 */ 331 #endif /* HAVE_SIDPLAY2 */