Mercurial > hg > xmms-sid
annotate src/xs_sidplay2.cc @ 657:acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 02 Apr 2008 19:46:59 +0300 |
parents | fdddab8f0c1b |
children | b0743dc9165d |
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 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 libSIDPlay v2 support |
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> |
539 | 7 (C) Copyright 1999-2007 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 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 #include <sidplay/sidplay2.h> |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 #ifdef HAVE_RESID_BUILDER |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 #include <sidplay/builders/resid.h> |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 #endif |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 #ifdef HAVE_HARDSID_BUILDER |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
37 #include <sidplay/builders/hardsid.h> |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 #endif |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 |
396 | 41 typedef struct { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
42 sidplay2 *currEng; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
43 sidbuilder *currBuilder; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
44 sid2_config_t currConfig; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
45 SidTune *currTune; |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
46 guint8 *buf; |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
47 size_t bufSize; |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
48 } xs_sidplay2_t; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
51 /* We need to 'export' all this pseudo-C++ crap */ |
396 | 52 extern "C" { |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
54 |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
55 /* Return song information |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
56 */ |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
57 #define TFUNCTION xs_sidplay2_getinfo |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
58 #define TFUNCTION2 xs_sidplay2_updateinfo |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
59 #define TTUNEINFO SidTuneInfo |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
60 #define TTUNE SidTune |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
61 #define TENGINE xs_sidplay2_t |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
62 #include "xs_sidplay.h" |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
63 |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
64 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
65 /* 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
|
66 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
67 gboolean xs_sidplay2_probe(xs_file_t *f) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
68 { |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
69 gchar tmpBuf[4]; |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
70 |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
71 if (!f) return FALSE; |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
72 |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
73 if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
74 return FALSE; |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
75 |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
76 if (!strncmp(tmpBuf, "PSID", 4) || !strncmp(tmpBuf, "RSID", 4)) |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
77 return TRUE; |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
78 else |
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
79 return FALSE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
80 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
83 /* Initialize SIDPlay2 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
84 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
85 gboolean xs_sidplay2_init(xs_status_t * myStatus) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
86 { |
551
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
87 gint tmpFreq, i; |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
88 xs_sidplay2_t *myEngine; |
551
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
89 sid_filter_t tmpFilter; |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
90 t_xs_sid2_filter *f; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
91 assert(myStatus); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
93 /* Allocate internal structures */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
94 myEngine = (xs_sidplay2_t *) g_malloc0(sizeof(xs_sidplay2_t)); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
95 myStatus->sidEngine = myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
96 if (!myEngine) return FALSE; |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
97 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
98 /* Initialize the engine */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
99 myEngine->currEng = new sidplay2; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
100 if (!myEngine->currEng) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
101 xs_error("[SIDPlay2] Could not initialize emulation engine.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
102 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
103 } |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
104 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
105 /* Get current configuration */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
106 myEngine->currConfig = myEngine->currEng->config(); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
108 /* Configure channels and stuff */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
109 switch (myStatus->audioChannels) { |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
110 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
111 case XS_CHN_AUTOPAN: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
112 myEngine->currConfig.playback = sid2_stereo; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
113 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
114 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
115 case XS_CHN_STEREO: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
116 myEngine->currConfig.playback = sid2_stereo; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
117 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
119 case XS_CHN_MONO: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
120 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
121 myEngine->currConfig.playback = sid2_mono; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
122 myStatus->audioChannels = XS_CHN_MONO; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
123 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
124 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
127 /* Memory mode settings */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
128 switch (xs_cfg.memoryMode) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
129 case XS_MPU_BANK_SWITCHING: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
130 myEngine->currConfig.environment = sid2_envBS; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
131 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
133 case XS_MPU_TRANSPARENT_ROM: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
134 myEngine->currConfig.environment = sid2_envTP; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
135 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
136 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
137 case XS_MPU_PLAYSID_ENVIRONMENT: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
138 myEngine->currConfig.environment = sid2_envPS; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
139 break; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
140 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
141 case XS_MPU_REAL: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
142 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
143 myEngine->currConfig.environment = sid2_envR; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
144 xs_cfg.memoryMode = XS_MPU_REAL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
145 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
146 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
147 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
148 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
149 /* Audio parameters sanity checking and setup */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
150 myEngine->currConfig.precision = myStatus->audioBitsPerSample; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
151 tmpFreq = myStatus->audioFrequency; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
152 |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
153 if (myStatus->oversampleEnable) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
154 tmpFreq = (tmpFreq * myStatus->oversampleFactor); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
155 |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
156 myEngine->currConfig.frequency = tmpFreq; |
74 | 157 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
158 switch (myStatus->audioBitsPerSample) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
159 case XS_RES_8BIT: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
160 myStatus->audioFormat = FMT_U8; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
161 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
162 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
163 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
164 case XS_RES_16BIT: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
165 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
166 switch (myStatus->audioFormat) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
167 case FMT_U16_LE: |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
168 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
169 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
170 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
171 case FMT_U16_BE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
172 myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
173 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
174 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
175 case FMT_U16_NE: |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
176 #if G_BYTE_ORDER == G_BIG_ENDIAN |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
177 myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED; |
74 | 178 #else |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
179 #if G_BYTE_ORDER == G_LITTLE_ENDIAN |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
180 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED; |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
181 #else |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
182 #error Unsupported endianess! |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
183 #endif |
74 | 184 #endif |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
185 break; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
186 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
187 case FMT_S16_LE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
188 myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
189 break; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
190 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
191 case FMT_S16_BE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
192 myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
193 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
194 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
195 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
196 myStatus->audioFormat = FMT_S16_NE; |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
197 #if G_BYTE_ORDER == G_BIG_ENDIAN |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
198 myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
199 #else |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
200 #if G_BYTE_ORDER == G_LITTLE_ENDIAN |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
201 myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED; |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
202 #else |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
203 #error Unsupported endianess! |
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
204 #endif |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
205 #endif |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
206 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
207 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
208 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
209 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
210 } |
551
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
211 |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
212 /* Convert filter */ |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
213 f = &(xs_cfg.sid2Filter); |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
214 XSDEBUG("using filter '%s', %d points\n", f->name, f->npoints); |
577
fdddab8f0c1b
Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents:
551
diff
changeset
|
215 if (f->npoints > XS_SIDPLAY2_NFPOINTS) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
216 xs_error("[SIDPlay2] Invalid number of filter curve points (%d > %d)\n", |
577
fdddab8f0c1b
Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents:
551
diff
changeset
|
217 f->npoints, XS_SIDPLAY2_NFPOINTS); |
fdddab8f0c1b
Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents:
551
diff
changeset
|
218 f->npoints = XS_SIDPLAY2_NFPOINTS; |
fdddab8f0c1b
Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents:
551
diff
changeset
|
219 } |
551
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
220 |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
221 tmpFilter.points = f->npoints; |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
222 for (i = 0; i < f->npoints; i++) { |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
223 tmpFilter.cutoff[i][0] = f->points[i].x; |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
224 tmpFilter.cutoff[i][1] = f->points[i].y; |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
225 } |
352 | 226 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
227 /* Initialize builder object */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
228 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
229 #ifdef HAVE_RESID_BUILDER |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
230 if (xs_cfg.sid2Builder == XS_BLD_RESID) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
231 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
232 myEngine->currBuilder = (sidbuilder *) rs; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
233 if (rs) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
234 /* Builder object created, initialize it */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
235 rs->create((myEngine->currEng->info()).maxsids); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
236 if (!*rs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
237 xs_error("reSID->create() failed.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
238 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
239 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
240 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
241 rs->filter(xs_cfg.emulateFilters); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
242 if (!*rs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
243 xs_error("reSID->filter(%d) failed.\n", xs_cfg.emulateFilters); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
244 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
245 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
246 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
247 // FIXME FIX ME: support other configurable parameters ... |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
248 // ... WHEN/IF resid-builder+libsidplay2 gets fixed |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
249 rs->sampling(tmpFreq); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
250 if (!*rs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
251 xs_error("reSID->sampling(%d) failed.\n", tmpFreq); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
252 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
253 } |
551
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
254 |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
255 if (tmpFilter.points > 0) |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
256 rs->filter((sid_filter_t *) &tmpFilter); |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
257 else |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
258 rs->filter((sid_filter_t *) NULL); |
4674e3c37121
Configuration item changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
539
diff
changeset
|
259 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
260 if (!*rs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
261 xs_error("reSID->filter(NULL) failed.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
262 return FALSE; |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
263 } |
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
264 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
265 } |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
266 #endif |
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
267 #ifdef HAVE_HARDSID_BUILDER |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
268 if (xs_cfg.sid2Builder == XS_BLD_HARDSID) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
269 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder"); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
270 myEngine->currBuilder = (sidbuilder *) hs; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
271 if (hs) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
272 /* Builder object created, initialize it */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
273 hs->create((myEngine->currEng->info()).maxsids); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
274 if (!*hs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
275 xs_error("hardSID->create() failed.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
276 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
277 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
278 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
279 hs->filter(xs_cfg.emulateFilters); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
280 if (!*hs) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
281 xs_error("hardSID->filter(%d) failed.\n", xs_cfg.emulateFilters); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
282 return FALSE; |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
283 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
284 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
285 } |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
286 #endif |
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
287 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
288 if (!myEngine->currBuilder) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
289 xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
290 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
291 } |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
292 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
293 XSDEBUG("%s\n", myEngine->currBuilder->credits()); |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
294 |
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
295 |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
296 /* Clockspeed settings */ |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
297 switch (xs_cfg.clockSpeed) { |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
298 case XS_CLOCK_NTSC: |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
299 myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC; |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
300 break; |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
301 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
302 default: |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
303 xs_error("[SIDPlay2] Invalid clockSpeed=%d, falling back to PAL.\n", |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
304 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
|
305 |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
306 case XS_CLOCK_PAL: |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
307 myEngine->currConfig.clockDefault = SID2_CLOCK_PAL; |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
308 xs_cfg.clockSpeed = XS_CLOCK_PAL; |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
309 break; |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
310 } |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
311 |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
312 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
313 /* Configure rest of the emulation */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
314 myEngine->currConfig.sidEmulation = myEngine->currBuilder; |
371
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
315 |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
316 if (xs_cfg.forceSpeed) { |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
317 myEngine->currConfig.clockForced = true; |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
318 myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault; |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
319 } else { |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
320 myEngine->currConfig.clockForced = false; |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
321 myEngine->currConfig.clockSpeed = SID2_CLOCK_CORRECT; |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
322 } |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
323 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
324 if ((xs_cfg.sid2OptLevel >= 0) && (xs_cfg.sid2OptLevel <= SID2_MAX_OPTIMISATION)) |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
325 myEngine->currConfig.optimisation = xs_cfg.sid2OptLevel; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
326 else { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
327 xs_error("Invalid sid2OptLevel=%d, falling back to %d.\n", |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
328 xs_cfg.sid2OptLevel, SID2_DEFAULT_OPTIMISATION); |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
329 |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
330 xs_cfg.sid2OptLevel = |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
331 myEngine->currConfig.optimisation = SID2_DEFAULT_OPTIMISATION; |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
332 } |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
333 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
334 if (xs_cfg.mos8580) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
335 myEngine->currConfig.sidDefault = SID2_MOS8580; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
336 else |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
337 myEngine->currConfig.sidDefault = SID2_MOS6581; |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
338 |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
339 if (xs_cfg.forceModel) |
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
340 myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault; |
371
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
341 else |
75f51962c083
Emulation engine setup fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
367
diff
changeset
|
342 myEngine->currConfig.sidModel = SID2_MODEL_CORRECT; |
366
29c4484f1de2
Fixes in emulator engine configuration, make 'forceModel' option work.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
343 |
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
|
344 |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
345 /* XXX: Should this be configurable? libSIDPlay1 does not support it, though */ |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
396
diff
changeset
|
346 myEngine->currConfig.sidSamples = TRUE; |
321
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
347 |
45ad9f7c1628
Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
348 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
349 /* Now set the emulator configuration */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
350 if (myEngine->currEng->config(myEngine->currConfig) < 0) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
351 xs_error("[SIDPlay2] Emulator engine configuration failed!\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
352 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
353 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
354 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
355 /* Create the sidtune */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
356 myEngine->currTune = new SidTune(0); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
357 if (!myEngine->currTune) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
358 xs_error("[SIDPlay2] Could not initialize SIDTune object.\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
359 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
360 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
361 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
362 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
363 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
364 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
365 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
366 /* Close SIDPlay2 engine |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
367 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
368 void xs_sidplay2_close(xs_status_t * myStatus) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
369 { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
370 xs_sidplay2_t *myEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
371 assert(myStatus); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
372 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
373 myEngine = (xs_sidplay2_t *) myStatus->sidEngine; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
374 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
375 /* Free internals */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
376 if (myEngine->currBuilder) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
377 delete myEngine->currBuilder; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
378 myEngine->currBuilder = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
379 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
380 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
381 if (myEngine->currEng) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
382 delete myEngine->currEng; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
383 myEngine->currEng = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
384 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
385 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
386 if (myEngine->currTune) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
387 delete myEngine->currTune; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
388 myEngine->currTune = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
389 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
390 |
467
9dafc55c4270
Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents:
460
diff
changeset
|
391 xs_sidplay2_delete(myStatus); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
392 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
393 g_free(myEngine); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
394 myStatus->sidEngine = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
395 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
396 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
397 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
398 /* Initialize current song and sub-tune |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
399 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
400 gboolean xs_sidplay2_initsong(xs_status_t * myStatus) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
401 { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
402 xs_sidplay2_t *myEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
403 assert(myStatus); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
404 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
405 myEngine = (xs_sidplay2_t *) myStatus->sidEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
406 if (!myEngine) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
407 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
408 if (!myEngine->currTune->selectSong(myStatus->currSong)) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
409 xs_error("[SIDPlay2] currTune->selectSong() failed\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
410 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
411 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
412 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
413 if (myEngine->currEng->load(myEngine->currTune) < 0) { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
414 xs_error("[SIDPlay2] currEng->load() failed\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
415 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
416 } |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
412
diff
changeset
|
417 |
460 | 418 myStatus->isInitialized = TRUE; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
352
diff
changeset
|
419 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
420 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
421 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
422 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
423 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
424 /* 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
|
425 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
426 guint xs_sidplay2_fillbuffer(xs_status_t * myStatus, gchar * audioBuffer, guint audioBufSize) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
427 { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
428 xs_sidplay2_t *myEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
429 assert(myStatus); |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
430 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
431 myEngine = (xs_sidplay2_t *) myStatus->sidEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
432 if (!myEngine) return 0; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
433 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
434 return myEngine->currEng->play(audioBuffer, audioBufSize); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
435 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
436 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
437 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
438 /* Load a given SID-tune file |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
439 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
440 gboolean xs_sidplay2_load(xs_status_t * myStatus, gchar * pcFilename) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
441 { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
442 xs_sidplay2_t *myEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
443 assert(myStatus); |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
444 myStatus->isInitialized = FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
445 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
446 myEngine = (xs_sidplay2_t *) myStatus->sidEngine; |
367 | 447 if (!myEngine) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
448 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
449 /* Try to get the tune */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
450 if (!pcFilename) return FALSE; |
367 | 451 |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
452 if (xs_fload_buffer(pcFilename, &(myEngine->buf), &(myEngine->bufSize)) != 0) |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
453 return FALSE; |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
454 |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
455 if (!myEngine->currTune->read(myEngine->buf, myEngine->bufSize)) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
456 return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
457 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
458 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
459 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
460 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
461 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
462 /* Delete INTERNAL information |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
463 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
464 void xs_sidplay2_delete(xs_status_t * myStatus) |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
465 { |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
466 xs_sidplay2_t *myEngine; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
467 assert(myStatus); |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
468 |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
469 myEngine = (xs_sidplay2_t *) myStatus->sidEngine; |
527
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
470 if (!myEngine) return; |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
471 |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
472 g_free(myEngine->buf); |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
473 myEngine->buf = NULL; |
fe8b41abd923
Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
526
diff
changeset
|
474 myEngine->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
|
475 } |
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
|
476 |
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
|
477 |
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
|
478 /* 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
|
479 */ |
657
acaba070cf49
Lots of cosmetic code cleanups; synced the de-gettextification from Audacious-SID, I suppose it makes some sense ...
Matti Hamalainen <ccr@tnsp.org>
parents:
577
diff
changeset
|
480 void xs_sidplay2_flush(xs_status_t * myStatus) |
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
|
481 { |
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
|
482 assert(myStatus); |
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
|
483 |
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
|
484 #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
|
485 #ifdef HSID_SID2_COM |
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
|
486 IfPtr<HardSIDBuilder> hs(myStatus->currBuilder); |
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
|
487 if (hs) |
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
|
488 hs->flush(); |
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
|
489 #else |
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
|
490 if (xs_cfg.sid2Builder == XS_BLD_HARDSID) |
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
|
491 ((HardSIDBuilder *) myStatus->currBuilder)->flush(); |
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
|
492 #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
|
493 #endif |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
494 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
495 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
496 |
474 | 497 } /* extern "C" */ |
498 #endif /* HAVE_SIDPLAY2 */ |