Mercurial > hg > xmms-sid
comparison src/xs_sidplay2.cc @ 695:ca594ca1056f
COM API support works now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 22 May 2008 11:32:37 +0300 |
parents | fd81a16434ed |
children | e2800b15ec0f |
comparison
equal
deleted
inserted
replaced
694:fd81a16434ed | 695:ca594ca1056f |
---|---|
33 #ifdef HAVE_SIDPLAY2_COMI | 33 #ifdef HAVE_SIDPLAY2_COMI |
34 # include <sidplay/sidlazyiptr.h> | 34 # include <sidplay/sidlazyiptr.h> |
35 #endif | 35 #endif |
36 | 36 |
37 | 37 |
38 typedef struct { | 38 class xs_sidplay2_t { |
39 public: | |
39 #ifdef HAVE_SIDPLAY2_COMI | 40 #ifdef HAVE_SIDPLAY2_COMI |
40 SidIPtr<ISidplay2> currEng; | 41 SidIPtr<ISidplay2> currEng; |
41 SidLazyIPtr<ISidUnknown> currBuilder; | 42 SidLazyIPtr<ISidUnknown> currBuilder; |
42 #else | 43 #else |
43 sidplay2 *currEng; | 44 sidplay2 *currEng; |
45 #endif | 46 #endif |
46 sid2_config_t currConfig; | 47 sid2_config_t currConfig; |
47 SidTune *currTune; | 48 SidTune *currTune; |
48 guint8 *buf; | 49 guint8 *buf; |
49 size_t bufSize; | 50 size_t bufSize; |
50 } xs_sidplay2_t; | 51 |
52 xs_sidplay2_t(void); | |
53 virtual ~xs_sidplay2_t(void) { ; } | |
54 }; | |
51 | 55 |
52 | 56 |
53 #ifdef HAVE_RESID_BUILDER | 57 #ifdef HAVE_RESID_BUILDER |
54 # include <sidplay/builders/resid.h> | 58 # include <sidplay/builders/resid.h> |
55 #endif | 59 #endif |
56 #ifdef HAVE_HARDSID_BUILDER | 60 #ifdef HAVE_HARDSID_BUILDER |
57 # include <sidplay/builders/hardsid.h> | 61 # include <sidplay/builders/hardsid.h> |
58 #endif | 62 #endif |
63 | |
64 | |
65 xs_sidplay2_t::xs_sidplay2_t(void) | |
66 #ifdef HAVE_SIDPLAY2_COMI | |
67 :currEng(sidplay2::create()) | |
68 #else | |
69 :currEng(NULL) | |
70 #endif | |
71 { | |
72 buf = NULL; | |
73 bufSize = 0; | |
74 currTune = NULL; | |
75 currBuilder = NULL; | |
76 } | |
59 | 77 |
60 | 78 |
61 /* We need to 'export' all this pseudo-C++ crap */ | 79 /* We need to 'export' all this pseudo-C++ crap */ |
62 extern "C" { | 80 extern "C" { |
63 | 81 |
99 sid_filter_t tmpFilter; | 117 sid_filter_t tmpFilter; |
100 t_xs_sid2_filter *f; | 118 t_xs_sid2_filter *f; |
101 assert(myStatus); | 119 assert(myStatus); |
102 | 120 |
103 /* Allocate internal structures */ | 121 /* Allocate internal structures */ |
104 myEngine = (xs_sidplay2_t *) g_malloc0(sizeof(xs_sidplay2_t)); | 122 myEngine = new xs_sidplay2_t(); |
105 myStatus->sidEngine = myEngine; | 123 myStatus->sidEngine = myEngine; |
106 if (!myEngine) return FALSE; | 124 if (!myEngine) return FALSE; |
107 | 125 |
108 /* Initialize the engine */ | 126 /* Initialize the engine */ |
109 #ifdef HAVE_SIDPLAY2_COMI | 127 #ifndef HAVE_SIDPLAY2_COMI |
110 // myEngine->currEng(); | |
111 #else | |
112 myEngine->currEng = new sidplay2; | 128 myEngine->currEng = new sidplay2; |
113 #endif | 129 #endif |
114 if (!myEngine->currEng) { | 130 if (!myEngine->currEng) { |
115 xs_error("[SIDPlay2] Could not initialize emulation engine.\n"); | 131 xs_error("[SIDPlay2] Could not initialize emulation engine.\n"); |
116 return FALSE; | 132 return FALSE; |
421 myEngine->currTune = NULL; | 437 myEngine->currTune = NULL; |
422 } | 438 } |
423 | 439 |
424 xs_sidplay2_delete(myStatus); | 440 xs_sidplay2_delete(myStatus); |
425 | 441 |
426 g_free(myEngine); | 442 delete myEngine; |
427 myStatus->sidEngine = NULL; | 443 myStatus->sidEngine = NULL; |
428 } | 444 } |
429 | 445 |
430 | 446 |
431 /* Initialize current song and sub-tune | 447 /* Initialize current song and sub-tune |