annotate src/xs_sidplay2.cc @ 757:9c135d421676

Clean up endianess handling a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Nov 2012 19:03:27 +0200
parents 8299288df6d2
children 6c8c968595d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
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
9e683fb666ba Updates
Matti Hamalainen <ccr@tnsp.org>
parents: 445
diff changeset
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>
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
34 # include <sidplayfp/SidTune.h>
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
35 #else
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
36 # include <sidplay/sidplay2.h>
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
37 # include <sidplay/sidlazyiptr.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
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
51 public:
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
52 #ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
53 sidplay2 *currEng;
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
54 sidbuilder *currBuilder;
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
55 #else
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
56 SidIPtr<ISidplay2> currEng;
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
57 SidLazyIPtr<ISidUnknown> currBuilder;
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
58 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
59 sid2_config_t currConfig;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
60 SidTune *currTune;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
61 guint8 *buf;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
62 size_t bufSize;
695
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
63
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
64 XSSIDPlay2(void);
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
65 virtual ~XSSIDPlay2(void) { ; }
695
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
66 };
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68
694
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
69 #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
70 # ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
71 # include <sidplayfp/builders/resid.h>
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
72 # else
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
73 # 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
74 # endif
694
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
75 #endif
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
76
694
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
77 #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
78 # ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
79 # 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
80 # else
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
81 # 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
82 # endif
694
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
83 #endif
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
84
fd81a16434ed Move builder header inclusions.
Matti Hamalainen <ccr@tnsp.org>
parents: 693
diff changeset
85
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
86 XSSIDPlay2::XSSIDPlay2(void)
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
87 #ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
88 :currEng(NULL)
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
89 #else
695
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
90 :currEng(sidplay2::create())
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
91 #endif
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
92 {
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
93 buf = NULL;
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
94 bufSize = 0;
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
95 currTune = NULL;
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
96 currBuilder = NULL;
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
97 }
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
98
ca594ca1056f COM API support works now.
Matti Hamalainen <ccr@tnsp.org>
parents: 694
diff changeset
99
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
100 /* We need to 'export' all this pseudo-C++ crap */
396
0a60ef2b5ab0 Cleanups
Matti Hamalainen <ccr@tnsp.org>
parents: 394
diff changeset
101 extern "C" {
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
103
467
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
104 /* Return song information
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
105 */
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
106 #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
107 #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
108 #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
109 #define TTUNE SidTune
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
110 #define TENGINE XSSIDPlay2
467
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
111 #include "xs_sidplay.h"
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
112
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
113
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
114 /* 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
115 */
751
55eea3fa8868 Rename some structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 748
diff changeset
116 gboolean xs_sidplay2_probe(XSFile *f)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
117 {
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 700
diff changeset
118 gchar tmpBuf[5];
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
119
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
120 if (!f) return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
121
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
122 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
123 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
124
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
125 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
126 return TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
127 else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
128 return FALSE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
129 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
132 /* Initialize SIDPlay2
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
133 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
134 gboolean xs_sidplay2_init(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
135 {
748
d9d769b5dbe2 Remove oversampling support.
Matti Hamalainen <ccr@tnsp.org>
parents: 744
diff changeset
136 gint i;
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
137 XSSIDPlay2 *engine;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
138 sid_filter_t tmpFilter;
722
5923dfff1fac Unify xs_sid*_filter_t into one.
Matti Hamalainen <ccr@tnsp.org>
parents: 710
diff changeset
139 xs_sid_filter_t *f;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
140 assert(state);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
142 /* Allocate internal structures */
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
143 engine = new XSSIDPlay2();
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
144 state->internal = engine;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
145 if (!engine) return FALSE;
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
146
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
147 /* Initialize the engine */
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
148 #ifdef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
149 engine->currEng = new sidplay2;
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
150 #endif
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
151 if (!engine->currEng) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
152 xs_error("[SIDPlay2] Could not initialize emulation engine.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
153 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
154 }
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
155
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
156 /* Get current configuration */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
157 engine->currConfig = engine->currEng->config();
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
159 /* Configure channels and stuff */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
160 switch (state->audioChannels) {
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
161 case XS_CHN_AUTOPAN:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
162 engine->currConfig.playback = sid2_stereo;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
163 break;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
165 case XS_CHN_STEREO:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
166 engine->currConfig.playback = sid2_stereo;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
167 break;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
169 case XS_CHN_MONO:
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
170 default:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
171 engine->currConfig.playback = sid2_mono;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
172 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
173 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
174 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
177 /* Memory mode settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
178 switch (xs_cfg.memoryMode) {
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
179 case XS_MPU_BANK_SWITCHING:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
180 engine->currConfig.environment = sid2_envBS;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
181 break;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
183 case XS_MPU_TRANSPARENT_ROM:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
184 engine->currConfig.environment = sid2_envTP;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
185 break;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
187 case XS_MPU_PLAYSID_ENVIRONMENT:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
188 engine->currConfig.environment = sid2_envPS;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
189 break;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
191 case XS_MPU_REAL:
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
192 default:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
193 engine->currConfig.environment = sid2_envR;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
194 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
195 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
196 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
199 /* Audio parameters sanity checking and setup */
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
200 #ifndef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
201 engine->currConfig.precision = state->audioBitsPerSample;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
202
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
203 #else
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
204 state->audioBitsPerSample = XS_RES_16BIT;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
205 engine->currConfig.samplingMethod = SID2_RESAMPLE_INTERPOLATE;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
206 #endif
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
207
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
208 engine->currConfig.frequency = state->audioFrequency;
748
d9d769b5dbe2 Remove oversampling support.
Matti Hamalainen <ccr@tnsp.org>
parents: 744
diff changeset
209
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
210
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
211 switch (state->audioBitsPerSample) {
757
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
212 case XS_RES_8BIT:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
213 state->audioFormat = FMT_U8;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
214 #ifndef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
215 engine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
216 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
217 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
218
757
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
219 case XS_RES_16BIT:
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
220 default:
757
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
221 state->audioFormat = FMT_S16_NE;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
222 #ifndef HAVE_SIDPLAY2_FP
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
223 switch (state->audioFormat) {
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
224 case FMT_U16_LE:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
225 engine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
226 break;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
227
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
228 case FMT_U16_BE:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
229 engine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
230 break;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
231
757
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
232 case FMT_U16_NE:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
233 engine->currConfig.sampleFormat = SID2_NATIVE_UNSIGNED;
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_LE:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
237 engine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
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 case FMT_S16_BE:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
241 engine->currConfig.sampleFormat = SID2_BIG_SIGNED;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
242 break;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
243
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
244 default:
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
245 engine->currConfig.sampleFormat = SID2_NATIVE_SIGNED;
9c135d421676 Clean up endianess handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
246 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
247 }
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
248 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
249 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
250 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
251
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
252 /* Convert filter */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
253 f = &(xs_cfg.sid2Filter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
254 XSDEBUG("using filter '%s', %d points\n", f->name, f->npoints);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
255 if (f->npoints > XS_SIDPLAY2_NFPOINTS) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
256 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
257 f->npoints, XS_SIDPLAY2_NFPOINTS);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
258 f->npoints = XS_SIDPLAY2_NFPOINTS;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
259 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
260
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
261 tmpFilter.points = f->npoints;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
262 for (i = 0; i < f->npoints; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
263 tmpFilter.cutoff[i][0] = f->points[i].x;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
264 tmpFilter.cutoff[i][1] = f->points[i].y;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
265 }
352
2b4ca75b999f Cleanups
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
266
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
267 /* Initialize builder object */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
268 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->currEng->info()).maxsids);
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
269 #ifdef HAVE_RESID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
270 if (xs_cfg.sid2Builder == XS_BLD_RESID) {
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
271 #ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
272 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
273 engine->currBuilder = (sidbuilder *) rs;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
274 if (rs) {
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
275 #else
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
276 engine->currBuilder = ReSIDBuilderCreate("");
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
277 SidLazyIPtr<IReSIDBuilder> rs(engine->currBuilder);
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
278 if (rs) {
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
279 engine->currConfig.sidEmulation = rs->iaggregate();
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
280 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
281 /* Builder object created, initialize it */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
282 rs->create((engine->currEng->info()).maxsids);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
283 if (!*rs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
284 xs_error("reSID->create() failed.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
285 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
286 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
287
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
288 rs->filter(xs_cfg.emulateFilters);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
289 if (!*rs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
290 xs_error("reSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
291 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
292 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
293
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
294 #if !defined(HAVE_SIDPLAY2_FP)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
295 // FIXME FIX ME: support other configurable parameters ...
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
296 // ... WHEN/IF resid-builder+libsidplay2 gets fixed
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
297 rs->sampling(tmpFreq);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
298 if (!*rs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
299 xs_error("reSID->sampling(%d) failed.\n", tmpFreq);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
300 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
301 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
302 if (tmpFilter.points > 0)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
303 rs->filter((sid_filter_t *) &tmpFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
304 else
710
a6283cf95c99 Updated to work with latest distortion patched libSIDPlay2+reSID from Antti
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
305 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
306 rs->filter((sid_filter_t *) NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
307
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
308 if (!*rs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
309 xs_error("reSID->filter(NULL) failed.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
310 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
311 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
312 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
313 }
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
314 #endif
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
315
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
316 #ifdef HAVE_HARDSID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
317 if (xs_cfg.sid2Builder == XS_BLD_HARDSID) {
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
318 #ifdef HAVE_SIDPLAY2_FP
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
319 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder");
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
320 engine->currBuilder = (sidbuilder *) hs;
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
321 if (hs) {
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
322 #else
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
323 engine->currBuilder = HardSIDBuilderCreate("");
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
324 SidLazyIPtr<IHardSIDBuilder> hs(engine->currBuilder);
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
325 if (hs) {
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
326 engine->currConfig.sidEmulation = hs->iaggregate();
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
327 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
328 /* Builder object created, initialize it */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
329 hs->create((engine->currEng->info()).maxsids);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
330 if (!*hs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
331 xs_error("hardSID->create() failed.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
332 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
333 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
334
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
335 hs->filter(xs_cfg.emulateFilters);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
336 if (!*hs) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
337 xs_error("hardSID->filter(%d) failed.\n", xs_cfg.emulateFilters);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
338 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
339 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
340 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
341 }
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
342 #endif
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
343
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
344 if (!engine->currBuilder) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
345 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
346 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
347 }
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
348
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
349 #ifdef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
350 engine->currConfig.sidEmulation = engine->currBuilder;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
351 XSDEBUG("%s\n", engine->currBuilder->credits());
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
352 #endif
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
353
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
354 /* Clockspeed settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
355 switch (xs_cfg.clockSpeed) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
356 case XS_CLOCK_NTSC:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
357 engine->currConfig.clockDefault = SID2_CLOCK_NTSC;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
358 break;
366
29c4484f1de2 Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
359
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
360 default:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
361 xs_error("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
362 xs_cfg.clockSpeed);
402
f997b79a7251 More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents: 396
diff changeset
363
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
364 case XS_CLOCK_PAL:
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
365 engine->currConfig.clockDefault = SID2_CLOCK_PAL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
366 xs_cfg.clockSpeed = XS_CLOCK_PAL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
367 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
368 }
366
29c4484f1de2 Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
369
29c4484f1de2 Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
370
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
371 /* Configure rest of the emulation */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
372 if (xs_cfg.forceSpeed) {
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
373 engine->currConfig.clockForced = true;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
374 engine->currConfig.clockSpeed = engine->currConfig.clockDefault;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
375 } else {
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
376 engine->currConfig.clockForced = false;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
377 engine->currConfig.clockSpeed = SID2_CLOCK_CORRECT;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
378 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
379
710
a6283cf95c99 Updated to work with latest distortion patched libSIDPlay2+reSID from Antti
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
380
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
381 #if !defined(HAVE_SIDPLAY2_FP)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
382 if ((xs_cfg.sid2OptLevel >= 0) && (xs_cfg.sid2OptLevel <= SID2_MAX_OPTIMISATION))
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
383 engine->currConfig.optimisation = xs_cfg.sid2OptLevel;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
384 else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
385 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
386 xs_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
387
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
388 xs_cfg.sid2OptLevel =
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
389 engine->currConfig.optimisation = SID2_DEFAULT_OPTIMISATION;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
390 }
710
a6283cf95c99 Updated to work with latest distortion patched libSIDPlay2+reSID from Antti
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
391 #endif
366
29c4484f1de2 Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
392
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
393 if (xs_cfg.mos8580)
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
394 engine->currConfig.sidDefault = SID2_MOS8580;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
395 else
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
396 engine->currConfig.sidDefault = SID2_MOS6581;
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
397
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
398 if (xs_cfg.forceModel)
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
399 engine->currConfig.sidModel = engine->currConfig.sidDefault;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
400 else
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
401 engine->currConfig.sidModel = SID2_MODEL_CORRECT;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
402
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
403 /* XXX: Should this be configurable? libSIDPlay1 does not support it, though */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
404 engine->currConfig.sidSamples = TRUE;
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
405
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
406
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
407 /* Now set the emulator configuration */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
408 if (engine->currEng->config(engine->currConfig) < 0) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
409 xs_error("[SIDPlay2] Emulator engine configuration failed!\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
410 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
411 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
413 /* Create the sidtune */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
414 engine->currTune = new SidTune(0);
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
415 if (!engine->currTune) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
416 xs_error("[SIDPlay2] Could not initialize SIDTune object.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
417 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
418 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
419
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
420 return TRUE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
421 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
424 /* Close SIDPlay2 engine
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
425 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
426 void xs_sidplay2_close(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
427 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
428 XSSIDPlay2 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
429 assert(state);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
430
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
431 engine = (XSSIDPlay2 *) state->internal;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
432
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
433 /* Free internals */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
434 if (engine->currBuilder) {
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
435 #ifdef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
436 delete engine->currBuilder;
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
437 #endif
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
438 engine->currBuilder = NULL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
439 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
440
744
c7fa50576c70 Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
Matti Hamalainen <ccr@tnsp.org>
parents: 723
diff changeset
441 #ifdef HAVE_SIDPLAY2_FP
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
442 if (engine->currEng) {
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
443 delete engine->currEng;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
444 engine->currEng = NULL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
445 }
692
0126579b6652 Actually compiles now with libsidplay2 COM API, but does not work yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
446 #endif
270
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 if (engine->currTune) {
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
449 delete engine->currTune;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
450 engine->currTune = NULL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
451 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
452
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
453 xs_sidplay2_delete(state);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
454
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
455 delete engine;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
456 state->internal = NULL;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
457 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
458
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
459
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
460 /* Initialize current song and sub-tune
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
461 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
462 gboolean xs_sidplay2_initsong(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
463 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
464 XSSIDPlay2 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
465 assert(state);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
466
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
467 engine = (XSSIDPlay2 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
468 if (!engine) return FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
469
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
470 if (!engine->currTune->selectSong(state->currSong)) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
471 xs_error("[SIDPlay2] currTune->selectSong() failed\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
472 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
473 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
474
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
475 if (engine->currEng->load(engine->currTune) < 0) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
476 xs_error("[SIDPlay2] currEng->load() failed\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
477 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
478 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
479
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
480 state->isInitialized = TRUE;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 352
diff changeset
481
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
482 return TRUE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
483 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
484
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
485
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
486 /* 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
487 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
488 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
489 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
490 XSSIDPlay2 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
491 assert(state);
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
492
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
493 engine = (XSSIDPlay2 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
494 if (!engine) return 0;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
495
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
496 return engine->currEng->play((short *) audioBuffer, audioBufSize / sizeof(short));
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
497 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
498
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
499
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
500 /* Load a given SID-tune file
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
501 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
502 gboolean xs_sidplay2_load(XSEngineState * state, gchar * pcFilename)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
503 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
504 XSSIDPlay2 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
505 assert(state);
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
506 state->isInitialized = FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
507
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
508 engine = (XSSIDPlay2 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
509 if (!engine) return FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
510
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
511 /* Try to get the tune */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
512 if (!pcFilename) return FALSE;
367
8338cc14bbdb Check for myEngine != NULL
Matti Hamalainen <ccr@tnsp.org>
parents: 366
diff changeset
513
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
514 if (xs_fload_buffer(pcFilename, &(engine->buf), &(engine->bufSize)) != 0)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
515 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
516
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
517 if (!engine->currTune->read(engine->buf, engine->bufSize))
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
518 return FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
519
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
520 return TRUE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
521 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
522
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
523
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
524 /* Delete INTERNAL information
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
526 void xs_sidplay2_delete(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
527 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
528 XSSIDPlay2 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
529 assert(state);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
531 engine = (XSSIDPlay2 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
532 if (!engine) return;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
533
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
534 g_free(engine->buf);
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
535 engine->buf = NULL;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
536 engine->bufSize = 0;
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
537 }
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
538
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
539
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
540 /* 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
541 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
542 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
543 {
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
544 assert(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
545
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
546 #ifdef HAVE_HARDSID_BUILDER
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
547 #ifdef HSID_SID2_COM
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
548 IfPtr<HardSIDBuilder> hs(state->currBuilder);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
549 if (hs)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
550 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
551 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
552 if (xs_cfg.sid2Builder == XS_BLD_HARDSID)
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
553 ((HardSIDBuilder *) state->currBuilder)->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
554 #endif
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
555 #endif
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
556 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
559 } /* extern "C" */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
560 #endif /* HAVE_SIDPLAY2 */