comparison src/xs_sidplay2.cc @ 756:8299288df6d2

Rename internal structures.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Nov 2012 18:53:20 +0200
parents 5557837fe5b6
children 9c135d421676
comparison
equal deleted inserted replaced
755:762ef85ead1a 756:8299288df6d2
35 #else 35 #else
36 # include <sidplay/sidplay2.h> 36 # include <sidplay/sidplay2.h>
37 # include <sidplay/sidlazyiptr.h> 37 # include <sidplay/sidlazyiptr.h>
38 #endif 38 #endif
39 39
40 class xs_sidplay2_t { 40 class XSSIDPlay2 {
41 public: 41 public:
42 #ifdef HAVE_SIDPLAY2_FP 42 #ifdef HAVE_SIDPLAY2_FP
43 sidplay2 *currEng; 43 sidplay2 *currEng;
44 sidbuilder *currBuilder; 44 sidbuilder *currBuilder;
45 #else 45 #else
49 sid2_config_t currConfig; 49 sid2_config_t currConfig;
50 SidTune *currTune; 50 SidTune *currTune;
51 guint8 *buf; 51 guint8 *buf;
52 size_t bufSize; 52 size_t bufSize;
53 53
54 xs_sidplay2_t(void); 54 XSSIDPlay2(void);
55 virtual ~xs_sidplay2_t(void) { ; } 55 virtual ~XSSIDPlay2(void) { ; }
56 }; 56 };
57 57
58 58
59 #ifdef HAVE_RESID_BUILDER 59 #ifdef HAVE_RESID_BUILDER
60 # ifdef HAVE_SIDPLAY2_FP 60 # ifdef HAVE_SIDPLAY2_FP
71 # include <sidplay/builders/hardsid.h> 71 # include <sidplay/builders/hardsid.h>
72 # endif 72 # endif
73 #endif 73 #endif
74 74
75 75
76 xs_sidplay2_t::xs_sidplay2_t(void) 76 XSSIDPlay2::XSSIDPlay2(void)
77 #ifdef HAVE_SIDPLAY2_FP 77 #ifdef HAVE_SIDPLAY2_FP
78 :currEng(NULL) 78 :currEng(NULL)
79 #else 79 #else
80 :currEng(sidplay2::create()) 80 :currEng(sidplay2::create())
81 #endif 81 #endif
95 */ 95 */
96 #define TFUNCTION xs_sidplay2_getinfo 96 #define TFUNCTION xs_sidplay2_getinfo
97 #define TFUNCTION2 xs_sidplay2_updateinfo 97 #define TFUNCTION2 xs_sidplay2_updateinfo
98 #define TTUNEINFO SidTuneInfo 98 #define TTUNEINFO SidTuneInfo
99 #define TTUNE SidTune 99 #define TTUNE SidTune
100 #define TENGINE xs_sidplay2_t 100 #define TENGINE XSSIDPlay2
101 #include "xs_sidplay.h" 101 #include "xs_sidplay.h"
102 102
103 103
104 /* Check if we can play the given file 104 /* Check if we can play the given file
105 */ 105 */
122 /* Initialize SIDPlay2 122 /* Initialize SIDPlay2
123 */ 123 */
124 gboolean xs_sidplay2_init(XSEngineState * state) 124 gboolean xs_sidplay2_init(XSEngineState * state)
125 { 125 {
126 gint i; 126 gint i;
127 xs_sidplay2_t *engine; 127 XSSIDPlay2 *engine;
128 sid_filter_t tmpFilter; 128 sid_filter_t tmpFilter;
129 xs_sid_filter_t *f; 129 xs_sid_filter_t *f;
130 assert(state); 130 assert(state);
131 131
132 /* Allocate internal structures */ 132 /* Allocate internal structures */
133 engine = new xs_sidplay2_t(); 133 engine = new XSSIDPlay2();
134 state->internal = engine; 134 state->internal = engine;
135 if (!engine) return FALSE; 135 if (!engine) return FALSE;
136 136
137 /* Initialize the engine */ 137 /* Initialize the engine */
138 #ifdef HAVE_SIDPLAY2_FP 138 #ifdef HAVE_SIDPLAY2_FP
430 430
431 /* Close SIDPlay2 engine 431 /* Close SIDPlay2 engine
432 */ 432 */
433 void xs_sidplay2_close(XSEngineState * state) 433 void xs_sidplay2_close(XSEngineState * state)
434 { 434 {
435 xs_sidplay2_t *engine; 435 XSSIDPlay2 *engine;
436 assert(state); 436 assert(state);
437 437
438 engine = (xs_sidplay2_t *) state->internal; 438 engine = (XSSIDPlay2 *) state->internal;
439 439
440 /* Free internals */ 440 /* Free internals */
441 if (engine->currBuilder) { 441 if (engine->currBuilder) {
442 #ifdef HAVE_SIDPLAY2_FP 442 #ifdef HAVE_SIDPLAY2_FP
443 delete engine->currBuilder; 443 delete engine->currBuilder;
466 466
467 /* Initialize current song and sub-tune 467 /* Initialize current song and sub-tune
468 */ 468 */
469 gboolean xs_sidplay2_initsong(XSEngineState * state) 469 gboolean xs_sidplay2_initsong(XSEngineState * state)
470 { 470 {
471 xs_sidplay2_t *engine; 471 XSSIDPlay2 *engine;
472 assert(state); 472 assert(state);
473 473
474 engine = (xs_sidplay2_t *) state->internal; 474 engine = (XSSIDPlay2 *) state->internal;
475 if (!engine) return FALSE; 475 if (!engine) return FALSE;
476 476
477 if (!engine->currTune->selectSong(state->currSong)) { 477 if (!engine->currTune->selectSong(state->currSong)) {
478 xs_error("[SIDPlay2] currTune->selectSong() failed\n"); 478 xs_error("[SIDPlay2] currTune->selectSong() failed\n");
479 return FALSE; 479 return FALSE;
492 492
493 /* Emulate and render audio data to given buffer 493 /* Emulate and render audio data to given buffer
494 */ 494 */
495 guint xs_sidplay2_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize) 495 guint xs_sidplay2_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize)
496 { 496 {
497 xs_sidplay2_t *engine; 497 XSSIDPlay2 *engine;
498 assert(state); 498 assert(state);
499 499
500 engine = (xs_sidplay2_t *) state->internal; 500 engine = (XSSIDPlay2 *) state->internal;
501 if (!engine) return 0; 501 if (!engine) return 0;
502 502
503 return engine->currEng->play((short *) audioBuffer, audioBufSize / sizeof(short)); 503 return engine->currEng->play((short *) audioBuffer, audioBufSize / sizeof(short));
504 } 504 }
505 505
506 506
507 /* Load a given SID-tune file 507 /* Load a given SID-tune file
508 */ 508 */
509 gboolean xs_sidplay2_load(XSEngineState * state, gchar * pcFilename) 509 gboolean xs_sidplay2_load(XSEngineState * state, gchar * pcFilename)
510 { 510 {
511 xs_sidplay2_t *engine; 511 XSSIDPlay2 *engine;
512 assert(state); 512 assert(state);
513 state->isInitialized = FALSE; 513 state->isInitialized = FALSE;
514 514
515 engine = (xs_sidplay2_t *) state->internal; 515 engine = (XSSIDPlay2 *) state->internal;
516 if (!engine) return FALSE; 516 if (!engine) return FALSE;
517 517
518 /* Try to get the tune */ 518 /* Try to get the tune */
519 if (!pcFilename) return FALSE; 519 if (!pcFilename) return FALSE;
520 520
530 530
531 /* Delete INTERNAL information 531 /* Delete INTERNAL information
532 */ 532 */
533 void xs_sidplay2_delete(XSEngineState * state) 533 void xs_sidplay2_delete(XSEngineState * state)
534 { 534 {
535 xs_sidplay2_t *engine; 535 XSSIDPlay2 *engine;
536 assert(state); 536 assert(state);
537 537
538 engine = (xs_sidplay2_t *) state->internal; 538 engine = (XSSIDPlay2 *) state->internal;
539 if (!engine) return; 539 if (!engine) return;
540 540
541 g_free(engine->buf); 541 g_free(engine->buf);
542 engine->buf = NULL; 542 engine->buf = NULL;
543 engine->bufSize = 0; 543 engine->bufSize = 0;