Mercurial > hg > xmms-sid
annotate src/xs_sidplay2.cc @ 801:c83c08b2ede4
Fix some uninitialized value issues.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 07 Nov 2012 12:08:04 +0200 |
parents | 3e305ce076e8 |
children | ab3216b1b582 |
rev | line source |
---|---|
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
4 libSIDPlay v2 and libSIDPlay v2-FP support |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
7 (C) Copyright 1999-2012 Tecnic Software productions (TNSP) |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 This program is free software; you can redistribute it and/or modify |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 it under the terms of the GNU General Public License as published by |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 the Free Software Foundation; either version 2 of the License, or |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 (at your option) any later version. |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 This program is distributed in the hope that it will be useful, |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 GNU General Public License for more details. |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 |
412
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 */ |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 #include "xmms-sid.h" |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 #ifdef HAVE_SIDPLAY2 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 |
460 | 27 #include <stdio.h> |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 #include "xs_sidplay2.h" |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 #include "xs_config.h" |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
30 |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
32 #ifdef HAVE_SIDPLAY2_FP |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
33 # include <sidplayfp/sidplay2.h> |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
34 # include <sidplayfp/SidTuneMod.h> |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
35 # include <sidplayfp/event.h> |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
36 #else |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
37 # include <sidplay/sidplay2.h> |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
38 # if G_BYTE_ORDER == G_BIG_ENDIAN |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
39 # define SID2_NATIVE_UNSIGNED SID2_BIG_UNSIGNED |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
40 # define SID2_NATIVE_SIGNED SID2_BIG_SIGNED |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
41 # elif G_BYTE_ORDER == G_LITTLE_ENDIAN |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
42 # define SID2_NATIVE_UNSIGNED SID2_LITTLE_UNSIGNED |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
43 # define SID2_NATIVE_SIGNED SID2_LITTLE_SIGNED |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
44 # else |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
45 # error Unsupported endianess! |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
46 # endif |
692
0126579b6652
Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
47 #endif |
694
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
48 |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
49 |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
50 class XSSIDPlay2 { |
695 | 51 public: |
770 | 52 sidplay2 emu; |
765 | 53 sid2_config_t config; |
54 SidTune *tune; | |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
55 gboolean tuneLoaded; |
765 | 56 |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
57 XSSIDPlay2(void); |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
58 virtual ~XSSIDPlay2(void); |
695 | 59 }; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 |
694
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
62 #ifdef HAVE_RESID_BUILDER |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
63 # ifdef HAVE_SIDPLAY2_FP |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
64 # include <sidplayfp/builders/residfp.h> |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
65 # include <sidplayfp/builders/resid.h> |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
66 # else |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
67 # include <sidplay/builders/resid.h> |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
68 # endif |
694
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
69 #endif |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
70 |
694
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
71 #ifdef HAVE_HARDSID_BUILDER |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
72 # ifdef HAVE_SIDPLAY2_FP |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
73 # include <sidplayfp/builders/hardsid.h> |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
74 # else |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
75 # include <sidplay/builders/hardsid.h> |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
76 # endif |
694
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
77 #endif |
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
78 |
fd81a16434ed
Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents:
693
diff
changeset
|
79 |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
80 XSSIDPlay2::XSSIDPlay2(void) |
695 | 81 { |
765 | 82 tune = NULL; |
801
c83c08b2ede4
Fix some uninitialized value issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
795
diff
changeset
|
83 tuneLoaded = FALSE; |
695 | 84 } |
85 | |
86 | |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
87 XSSIDPlay2::~XSSIDPlay2(void) |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
88 { |
801
c83c08b2ede4
Fix some uninitialized value issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
795
diff
changeset
|
89 if (tuneLoaded) |
c83c08b2ede4
Fix some uninitialized value issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
795
diff
changeset
|
90 emu.load(0); |
c83c08b2ede4
Fix some uninitialized value issues.
Matti Hamalainen <ccr@tnsp.org>
parents:
795
diff
changeset
|
91 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
92 if (tune) |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
93 delete tune; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
94 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
95 tuneLoaded = FALSE; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
96 } |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
97 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
98 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
99 /* We need to 'export' all this pseudo-C++ crap */ |
396 | 100 extern "C" { |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
102 |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
103 /* Return song information |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
104 */ |
692
0126579b6652
Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
105 #define TFUNCTION xs_sidplay2_getinfo |
0126579b6652
Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
106 #define TFUNCTION2 xs_sidplay2_updateinfo |
0126579b6652
Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
107 #define TTUNEINFO SidTuneInfo |
0126579b6652
Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
660
diff
changeset
|
108 #define TTUNE SidTune |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
109 #define TENGINE XSSIDPlay2 |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
110 #include "xs_sidplay.h" |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
111 |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
112 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
113 /* Check if we can play the given file |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
114 */ |
751 | 115 gboolean xs_sidplay2_probe(XSFile *f) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
116 { |
702 | 117 gchar tmpBuf[5]; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
118 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
119 if (!f) return FALSE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
120 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
121 if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4) |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
122 return FALSE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
123 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
124 if (!strncmp(tmpBuf, "PSID", 4) || !strncmp(tmpBuf, "RSID", 4)) |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
125 return TRUE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
126 else |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
127 return FALSE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
128 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
131 /* Initialize SIDPlay2 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
132 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
133 gboolean xs_sidplay2_init(XSEngineState * state) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
134 { |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
135 XSSIDPlay2 *engine; |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
136 #ifndef HAVE_SIDPLAY2_FP |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
137 sid_filter_t tmpFilter; |
722
5923dfff1fac
Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents:
710
diff
changeset
|
138 xs_sid_filter_t *f; |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
139 gint i; |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
140 #endif |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
141 assert(state); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
142 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
143 /* Allocate internal structures */ |
756
8299288df6d2
Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents:
754
diff
changeset
|
144 engine = new XSSIDPlay2(); |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
145 state->internal = engine; |
770 | 146 if (!engine) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
147 return FALSE; |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
148 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
149 /* Get current configuration */ |
770 | 150 engine->config = engine->emu.config(); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
151 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
152 /* Configure channels and stuff */ |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
153 switch (state->audioChannels) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
154 { |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
155 case XS_CHN_AUTOPAN: |
765 | 156 engine->config.playback = sid2_stereo; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
157 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
158 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
159 case XS_CHN_STEREO: |
765 | 160 engine->config.playback = sid2_stereo; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
161 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
162 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
163 case XS_CHN_MONO: |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
164 default: |
765 | 165 engine->config.playback = sid2_mono; |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
166 state->audioChannels = XS_CHN_MONO; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
167 break; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
168 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
169 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
170 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
171 /* Memory mode settings */ |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
172 switch (xs_cfg.memoryMode) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
173 { |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
174 case XS_MPU_BANK_SWITCHING: |
765 | 175 engine->config.environment = sid2_envBS; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
176 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
177 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
178 case XS_MPU_TRANSPARENT_ROM: |
765 | 179 engine->config.environment = sid2_envTP; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
180 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
181 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
182 case XS_MPU_PLAYSID_ENVIRONMENT: |
765 | 183 engine->config.environment = sid2_envPS; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
184 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
185 |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
186 case XS_MPU_REAL: |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
187 default: |
765 | 188 engine->config.environment = sid2_envR; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
189 xs_cfg.memoryMode = XS_MPU_REAL; |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
190 break; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
191 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
192 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
193 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
194 /* Audio parameters sanity checking and setup */ |
758 | 195 #ifdef HAVE_SIDPLAY2_FP |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
196 state->audioBitsPerSample = XS_RES_16BIT; |
765 | 197 engine->config.samplingMethod = SID2_RESAMPLE_INTERPOLATE; |
758 | 198 #else |
765 | 199 engine->config.precision = state->audioBitsPerSample; |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
200 #endif |
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
201 |
765 | 202 engine->config.frequency = state->audioFrequency; |
748
d9d769b5dbe2
Remove oversampling support.
Matti Hamalainen <ccr@tnsp.org>
parents:
744
diff
changeset
|
203 |
74 | 204 |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
205 switch (state->audioBitsPerSample) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
206 { |
758 | 207 #ifndef HAVE_SIDPLAY2_FP |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
208 case XS_RES_8BIT: |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
209 state->audioFormat = FMT_U8; |
765 | 210 engine->config.sampleFormat = SID2_LITTLE_UNSIGNED; |
758 | 211 break; |
74 | 212 #endif |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
213 |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
214 case XS_RES_16BIT: |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
215 default: |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
216 state->audioFormat = FMT_S16_NE; |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
217 #ifndef HAVE_SIDPLAY2_FP |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
218 switch (state->audioFormat) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
219 { |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
220 case FMT_U16_LE: |
765 | 221 engine->config.sampleFormat = SID2_LITTLE_UNSIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
222 break; |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
223 |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
224 case FMT_U16_BE: |
765 | 225 engine->config.sampleFormat = SID2_BIG_UNSIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
226 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
227 |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
228 case FMT_U16_NE: |
765 | 229 engine->config.sampleFormat = SID2_NATIVE_UNSIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
230 break; |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
231 |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
232 case FMT_S16_LE: |
765 | 233 engine->config.sampleFormat = SID2_LITTLE_SIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
234 break; |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
235 |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
236 case FMT_S16_BE: |
765 | 237 engine->config.sampleFormat = SID2_BIG_SIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
238 break; |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
239 |
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
240 default: |
765 | 241 engine->config.sampleFormat = SID2_NATIVE_SIGNED; |
757
9c135d421676
Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
756
diff
changeset
|
242 break; |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
243 } |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
244 #endif |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
245 break; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
246 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
247 |
765 | 248 #if !defined(HAVE_SIDPLAY2_FP) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
249 /* Convert filter */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
250 f = &(xs_cfg.sid2Filter); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
251 XSDEBUG("using filter '%s', %d points\n", f->name, f->npoints); |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
252 if (f->npoints > XS_SIDPLAY2_NFPOINTS) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
253 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
254 xs_error("[SIDPlay2] Invalid number of filter curve points (%d > %d)\n", |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
255 f->npoints, XS_SIDPLAY2_NFPOINTS); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
256 f->npoints = XS_SIDPLAY2_NFPOINTS; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
257 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
258 |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
259 tmpFilter.points = f->npoints; |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
260 for (i = 0; i < f->npoints; i++) |
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
261 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
262 tmpFilter.cutoff[i][0] = f->points[i].x; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
263 tmpFilter.cutoff[i][1] = f->points[i].y; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
264 } |
765 | 265 #endif |
352 | 266 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
267 /* Initialize builder object */ |
770 | 268 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids); |
761 | 269 |
765 | 270 switch (xs_cfg.sid2Builder) |
271 { | |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
272 #ifdef HAVE_RESID_BUILDER |
765 | 273 case XS_BLD_RESID: |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
274 { |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
275 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
276 if (rs) |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
277 { |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
278 engine->config.sidEmulation = rs; |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
279 if (!*rs) return FALSE; |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
280 rs->create((engine->emu.info()).maxsids); |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
281 if (!*rs) return FALSE; |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
282 #ifdef HAVE_SIDPLAY2_FP |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
283 rs->bias(0.0f); |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
284 #endif |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
285 } |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
286 } |
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
287 break; |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
288 #endif |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
289 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
290 #ifdef HAVE_RESID_FP_BUILDER |
773
45108b3d88db
Add resid-fp and resid backend to sidplay2fp support.
Matti Hamalainen <ccr@tnsp.org>
parents:
770
diff
changeset
|
291 case XS_BLD_RESID_FP: |
765 | 292 { |
293 ReSIDfpBuilder *rs = new ReSIDfpBuilder("ReSID builder FP!"); | |
294 if (rs) | |
295 { | |
770 | 296 engine->config.sidEmulation = rs; |
765 | 297 if (!*rs) return FALSE; |
770 | 298 rs->create((engine->emu.info()).maxsids); |
765 | 299 if (!*rs) return FALSE; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
300 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
301 rs->filter6581Curve(0.0); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
302 rs->filter8580Curve(0.0); |
765 | 303 } |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
304 } |
765 | 305 break; |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
306 #endif |
744
c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents:
723
diff
changeset
|
307 |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
308 #ifdef HAVE_HARDSID_BUILDER |
765 | 309 case XS_BLD_HARDSID: |
310 { | |
311 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)"); | |
770 | 312 engine->config.sidEmulation = (sidbuilder *) hs; |
765 | 313 if (hs) |
314 { | |
770 | 315 hs->create((engine->emu.info()).maxsids); |
765 | 316 if (!*hs) |
317 { | |
318 xs_error("hardSID->create() failed.\n"); | |
319 return FALSE; | |
320 } | |
321 } | |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
322 } |
765 | 323 break; |
324 #endif | |
325 | |
326 default: | |
327 xs_error("[SIDPlay2] Invalid or unsupported builder selected.\n"); | |
328 break; | |
329 } | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
330 |
770 | 331 if (!engine->config.sidEmulation) |
765 | 332 { |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
333 xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n"); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
334 return FALSE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
335 } |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
336 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
337 #ifdef HAVE_SIDPLAY2_FP |
765 | 338 // Setup filter |
770 | 339 engine->config.sidEmulation->filter(xs_cfg.emulateFilters); |
340 if (!*(engine->config.sidEmulation)) | |
765 | 341 { |
342 xs_error("builder->filter(%d) failed.\n", xs_cfg.emulateFilters); | |
343 return FALSE; | |
344 } | |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
345 #endif |
765 | 346 |
770 | 347 XSDEBUG("%s\n", engine->config.sidEmulation->credits()); |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
348 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
349 /* Clockspeed settings */ |
765 | 350 switch (xs_cfg.clockSpeed) |
351 { | |
352 case XS_CLOCK_NTSC: | |
353 engine->config.clockDefault = SID2_CLOCK_NTSC; | |
354 break; | |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
355 |
765 | 356 default: |
357 case XS_CLOCK_PAL: | |
358 engine->config.clockDefault = SID2_CLOCK_PAL; | |
359 xs_cfg.clockSpeed = XS_CLOCK_PAL; | |
360 break; | |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
361 } |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
362 |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
363 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
364 /* Configure rest of the emulation */ |
765 | 365 if (xs_cfg.forceSpeed) |
366 { | |
367 engine->config.clockForced = true; | |
368 engine->config.clockSpeed = engine->config.clockDefault; | |
369 } | |
370 else | |
371 { | |
372 engine->config.clockForced = false; | |
373 engine->config.clockSpeed = SID2_CLOCK_CORRECT; | |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
374 } |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
375 |
710
a6283cf95c99
Updated to work with latest distortion patched libSIDPlay2+reSID from Antti
Matti Hamalainen <ccr@tnsp.org>
parents:
702
diff
changeset
|
376 |
761 | 377 #ifndef HAVE_SIDPLAY2_FP |
378 if (xs_cfg.sid2OptLevel < 0 || xs_cfg.sid2OptLevel > SID2_MAX_OPTIMISATION) | |
379 { | |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
380 xs_error("Invalid sid2OptLevel=%d, falling back to %d.\n", |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
381 xs_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION); |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
382 |
761 | 383 xs_cfg.sid2OptLevel = SID2_DEFAULT_OPTIMISATION; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
384 } |
766
19e2745f75d8
Cosmetics and leftover cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
765
diff
changeset
|
385 engine->config.optimisation = xs_cfg.sid2OptLevel; |
710
a6283cf95c99
Updated to work with latest distortion patched libSIDPlay2+reSID from Antti
Matti Hamalainen <ccr@tnsp.org>
parents:
702
diff
changeset
|
386 #endif |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
387 |
765 | 388 engine->config.sidDefault = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581; |
389 engine->config.sidModel = xs_cfg.forceModel ? engine->config.sidDefault : SID2_MODEL_CORRECT; | |
390 engine->config.sidSamples = TRUE; | |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
391 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
392 return TRUE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
393 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
394 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
395 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
396 /* Close SIDPlay2 engine |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
397 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
398 void xs_sidplay2_close(XSEngineState * state) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
399 { |
769 | 400 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
401 |
775
0e9f2894b0a9
Proper order of freeing/deletion.
Matti Hamalainen <ccr@tnsp.org>
parents:
774
diff
changeset
|
402 xs_sidplay2_delete(state); |
0e9f2894b0a9
Proper order of freeing/deletion.
Matti Hamalainen <ccr@tnsp.org>
parents:
774
diff
changeset
|
403 |
770 | 404 if (engine) |
405 { | |
406 delete engine; | |
775
0e9f2894b0a9
Proper order of freeing/deletion.
Matti Hamalainen <ccr@tnsp.org>
parents:
774
diff
changeset
|
407 engine = NULL; |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
408 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
409 |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
410 state->internal = NULL; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
411 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
412 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
413 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
414 /* Initialize current song and sub-tune |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
415 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
416 gboolean xs_sidplay2_initsong(XSEngineState * state) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
417 { |
768 | 418 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
419 |
768 | 420 if (!engine) |
421 return FALSE; | |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
422 |
769 | 423 if (!engine->tune->selectSong(state->currSong)) |
424 { | |
765 | 425 xs_error("[SIDPlay2] tune->selectSong() failed\n"); |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
426 return FALSE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
427 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
428 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
429 if (engine->emu.config(engine->config) < 0) |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
430 { |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
431 xs_error("[SIDPlay2] Emulator engine configuration failed!\n"); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
432 return FALSE; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
433 } |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
434 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
435 engine->tuneLoaded = TRUE; |
770 | 436 if (engine->emu.load(engine->tune) < 0) |
437 { | |
438 xs_error("[SIDPlay2] emu.load() failed\n"); | |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
439 return FALSE; |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
440 } |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
441 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
442 return TRUE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
443 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
444 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
445 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
446 /* Emulate and render audio data to given buffer |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
447 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
448 guint xs_sidplay2_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
449 { |
768 | 450 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
451 |
768 | 452 if (!engine) |
453 return 0; | |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
454 |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
455 #if 1 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
456 #ifdef HAVE_SIDPLAY2_FP |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
457 int nsamples = audioBufSize / sizeof(short); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
458 return engine->emu.play((short *) audioBuffer, nsamples) * sizeof(short); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
459 #else |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
460 return engine->emu.play(audioBuffer, audioBufSize); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
461 #endif |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
462 #else |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
463 int nsamples = audioBufSize / sizeof(short); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
464 fprintf(stderr, "%p, %d -> %d\n", audioBuffer, audioBufSize, nsamples); |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
465 return 0; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
466 #endif |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
467 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
468 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
469 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
470 /* Load a given SID-tune file |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
471 */ |
765 | 472 gboolean xs_sidplay2_load(XSEngineState * state, gchar * filename) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
473 { |
768 | 474 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
475 | |
476 if (!engine) | |
477 return FALSE; | |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
478 |
765 | 479 if (!(engine->tune = new SidTune(filename))) |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
480 return FALSE; |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
481 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
482 engine->tuneLoaded = FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
483 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
484 return TRUE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
485 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
486 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
487 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
488 /* Delete INTERNAL information |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
489 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
490 void xs_sidplay2_delete(XSEngineState * state) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
491 { |
768 | 492 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
493 |
768 | 494 if (engine) |
495 { | |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
496 if (engine->tuneLoaded) |
768 | 497 { |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
498 engine->emu.load(0); |
768 | 499 } |
795
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
500 |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
501 delete engine->tune; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
502 engine->tune = NULL; |
3e305ce076e8
Make old libSIDPlay2 support work again, the one available in most distros, such as Debian.
Matti Hamalainen <ccr@tnsp.org>
parents:
791
diff
changeset
|
503 engine->tuneLoaded = FALSE; |
765 | 504 } |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
505 } |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
506 |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
507 |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
508 /* Hardware backend flushing |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
509 */ |
754
5557837fe5b6
Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
753
diff
changeset
|
510 void xs_sidplay2_flush(XSEngineState * state) |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
511 { |
779
8fb51f9ef44e
Fix some HardSID builder related things.
Matti Hamalainen <ccr@tnsp.org>
parents:
776
diff
changeset
|
512 XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
513 |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
514 #ifdef HAVE_HARDSID_BUILDER |
768 | 515 if (xs_cfg.sid2Builder == XS_BLD_HARDSID) |
516 { | |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
517 #ifdef HSID_SID2_COM |
779
8fb51f9ef44e
Fix some HardSID builder related things.
Matti Hamalainen <ccr@tnsp.org>
parents:
776
diff
changeset
|
518 IfPtr<HardSIDBuilder> hs(engine->config.sidEmulation); |
768 | 519 if (hs) |
520 hs->flush(); | |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
521 #else |
779
8fb51f9ef44e
Fix some HardSID builder related things.
Matti Hamalainen <ccr@tnsp.org>
parents:
776
diff
changeset
|
522 ((HardSIDBuilder *) engine->config.sidEmulation)->flush(); |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
523 #endif |
768 | 524 } |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
474
diff
changeset
|
525 #endif |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
526 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
527 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
528 |
660
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
529 } /* extern "C" */ |
b0743dc9165d
Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
657
diff
changeset
|
530 #endif /* HAVE_SIDPLAY2 */ |