annotate src/xs_sidplay1.cpp @ 837:5b3e2116408f

Cosmetic cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Nov 2012 20:58:45 +0200
parents a7ee5dc23e78
children 5b93bd8c7814
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
4 libSIDPlay1 support
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
539
d837d2f06456 Update copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 527
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
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: 411
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: 411
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: 411
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
23 #include "xmms-sid.h"
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
24
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #ifdef HAVE_SIDPLAY1
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
27 #include "xs_sidplay1.h"
832
b158abe91a75 Header include cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 791
diff changeset
28 #include "xs_slsup.h"
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
29 #include "xs_config.h"
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include <sidplay/player.h>
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 #include <sidplay/myendian.h>
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #include <sidplay/fformat.h>
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 467
diff changeset
36 /* Maximum audio frequency supported by libSIDPlay v1 */
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
37 #define SIDPLAY1_MAX_FREQ (48000)
526
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 467
diff changeset
38
fa95d942f226 Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 467
diff changeset
39
396
0a60ef2b5ab0 Cleanups
Matti Hamalainen <ccr@tnsp.org>
parents: 394
diff changeset
40 typedef struct {
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
41 emuEngine *emu;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
42 emuConfig currConfig;
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
43 sidTune *tune;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
44 guint8 *buf;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
45 size_t bufSize;
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
46 } XSSIDPlay1;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
47
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
48
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
49 /* We need to 'export' all this pseudo-C++ crap */
396
0a60ef2b5ab0 Cleanups
Matti Hamalainen <ccr@tnsp.org>
parents: 394
diff changeset
50 extern "C" {
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
51
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
52
467
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
53 /* Return song information
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
54 */
691
c21908e9e7d7 Indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
55 #define TFUNCTION xs_sidplay1_getinfo
c21908e9e7d7 Indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
56 #define TFUNCTION2 xs_sidplay1_updateinfo
c21908e9e7d7 Indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
57 #define TTUNEINFO sidTuneInfo
c21908e9e7d7 Indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
58 #define TTUNE sidTune
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
59 #define TENGINE XSSIDPlay1
467
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
60 #include "xs_sidplay.h"
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
61
9dafc55c4270 Beginnings of vfs portability.
Matti Hamalainen <ccr@tnsp.org>
parents: 460
diff changeset
62
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
63 /* 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
64 */
751
55eea3fa8868 Rename some structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 748
diff changeset
65 gboolean xs_sidplay1_probe(XSFile *f)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
66 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
67 gchar tmpBuf[4];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
68
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
69 if (!f) return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
70
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
71 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
72 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
73
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
74 if (!strncmp(tmpBuf, "PSID", 4))
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
75 return TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
76 else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
77 return FALSE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
78 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
79
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
80
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
81 /* Initialize SIDPlay1
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
82 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
83 gboolean xs_sidplay1_init(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
84 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
85 gint tmpFreq;
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
86 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
87 assert(state);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
88
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
89 /* Allocate internal structures */
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
90 engine = (XSSIDPlay1 *) g_malloc0(sizeof(XSSIDPlay1));
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
91 if (!engine) return FALSE;
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
92
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
93 /* Initialize engine */
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
94 engine->emu = new emuEngine();
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
95 if (!engine->emu)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
96 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
97 xs_error("[SIDPlay1] Could not initialize emulation engine.\n");
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
98 g_free(engine);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
99 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
100 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
101
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
102 /* Verify endianess */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
103 if (!engine->emu->verifyEndianess())
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
104 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
105 xs_error("[SIDPlay1] Endianess verification failed.\n");
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
106 delete engine->emu;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
107 g_free(engine);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
108 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
109 }
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
110
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
111 state->internal = engine;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
113 /* Get current configuration */
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
114 engine->emu->getConfig(engine->currConfig);
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
116 /* Configure channel parameters */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
117 switch (state->audioChannels)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
118 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
119 case XS_CHN_AUTOPAN:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
120 engine->currConfig.channels = SIDEMU_STEREO;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
121 engine->currConfig.autoPanning = SIDEMU_CENTEREDAUTOPANNING;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
122 engine->currConfig.volumeControl = SIDEMU_FULLPANNING;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
123 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
125 case XS_CHN_STEREO:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
126 engine->currConfig.channels = SIDEMU_STEREO;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
127 engine->currConfig.autoPanning = SIDEMU_NONE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
128 engine->currConfig.volumeControl = SIDEMU_NONE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
129 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
131 case XS_CHN_MONO:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
132 default:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
133 engine->currConfig.channels = SIDEMU_MONO;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
134 engine->currConfig.autoPanning = SIDEMU_NONE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
135 engine->currConfig.volumeControl = SIDEMU_NONE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
136 state->audioChannels = XS_CHN_MONO;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
137 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
138 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
141 /* Memory mode settings */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
142 switch (xs_cfg.memoryMode)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
143 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
144 case XS_MPU_TRANSPARENT_ROM:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
145 engine->currConfig.memoryMode = MPU_TRANSPARENT_ROM;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
146 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
148 case XS_MPU_PLAYSID_ENVIRONMENT:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
149 engine->currConfig.memoryMode = MPU_PLAYSID_ENVIRONMENT;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
150 break;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
152 case XS_MPU_BANK_SWITCHING:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
153 default:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
154 engine->currConfig.memoryMode = MPU_BANK_SWITCHING;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
155 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
156 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
157 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
160 /* Audio parameters sanity checking and setup */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
161 engine->currConfig.bitsPerSample = state->audioBitsPerSample;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
162 tmpFreq = state->audioFrequency;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
163
748
d9d769b5dbe2 Remove oversampling support.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
164 if (tmpFreq > SIDPLAY1_MAX_FREQ)
d9d769b5dbe2 Remove oversampling support.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
165 tmpFreq = SIDPLAY1_MAX_FREQ;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
166
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
167 engine->currConfig.frequency = tmpFreq;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
168
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
169 switch (state->audioBitsPerSample)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
170 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
171 case XS_RES_8BIT:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
172 switch (state->audioFormat)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
173 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
174 case FMT_S8:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
175 state->audioFormat = FMT_S8;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
176 engine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
177 break;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
178
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
179 case FMT_U8:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
180 default:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
181 state->audioFormat = FMT_U8;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
182 engine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
183 break;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
184 }
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
185 break;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
186
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
187 case XS_RES_16BIT:
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
188 default:
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
189 switch (state->audioFormat)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
190 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
191 case FMT_U16_NE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
192 case FMT_U16_LE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
193 case FMT_U16_BE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
194 state->audioFormat = FMT_U16_NE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
195 engine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
196 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
197
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
198 case FMT_S16_NE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
199 case FMT_S16_LE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
200 case FMT_S16_BE:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
201 default:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
202 state->audioFormat = FMT_S16_NE;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
203 engine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
204 break;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
205 }
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
206 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
207 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
208
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
209 /* Clockspeed settings */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
210 switch (xs_cfg.clockSpeed)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
211 {
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
212 case XS_CLOCK_NTSC:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
213 engine->currConfig.clockSpeed = SIDTUNE_CLOCK_NTSC;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
214 break;
368
3e55874170eb Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
215
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
216 case XS_CLOCK_PAL:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
217 default:
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
218 engine->currConfig.clockSpeed = SIDTUNE_CLOCK_PAL;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
219 xs_cfg.clockSpeed = XS_CLOCK_PAL;
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
220 break;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
221 }
368
3e55874170eb Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
222
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
223 engine->currConfig.forceSongSpeed = xs_cfg.forceSpeed;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
224
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
225
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
226 /* Configure rest of the emulation */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
227 /* if (xs_cfg.forceModel) */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
228 engine->currConfig.mos8580 = xs_cfg.mos8580;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
229 engine->currConfig.emulateFilter = xs_cfg.emulateFilters;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
230 engine->currConfig.filterFs = xs_cfg.sid1Filter.fs;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
231 engine->currConfig.filterFm = xs_cfg.sid1Filter.fm;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
232 engine->currConfig.filterFt = xs_cfg.sid1Filter.ft;
368
3e55874170eb Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
233
3e55874170eb Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents: 364
diff changeset
234
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
235 /* Now set the emulator configuration */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
236 if (!engine->emu->setConfig(engine->currConfig))
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
237 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
238 xs_error("[SIDPlay1] Emulator engine configuration failed!\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
239 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
240 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
241
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
242 /* Create sidtune object */
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
243 engine->tune = new sidTune(0);
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
244 if (!engine->tune)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
245 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
246 xs_error("[SIDPlay1] Could not initialize SIDTune object.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
247 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
248 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
249
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
250 return TRUE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
251 }
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
252
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
253
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
254 /* Close SIDPlay1 engine
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
255 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
256 void xs_sidplay1_close(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
257 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
258 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
259 assert(state);
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
260
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
261 engine = (XSSIDPlay1 *) state->internal;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
262
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
263 /* Free internals */
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
264 if (engine->emu)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
265 {
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
266 delete engine->emu;
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
267 engine->emu = NULL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
268 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
269
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
270 if (engine->tune)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
271 {
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
272 delete engine->tune;
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
273 engine->tune = NULL;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
274 }
527
fe8b41abd923 Now everything necessary should be using the VFS functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 526
diff changeset
275
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
276 xs_sidplay1_delete(state);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
277
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
278 g_free(engine);
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
279 state->internal = NULL;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
280 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
281
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
282
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
283 /* Initialize current song and sub-tune
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
284 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
285 gboolean xs_sidplay1_initsong(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
286 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
287 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
288 assert(state);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
289
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
290 engine = (XSSIDPlay1 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
291 if (!engine) return FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
292
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
293 if (!engine->tune)
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
294 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
295 xs_error("[SIDPlay1] SID-tune struct pointer was NULL. This should not happen, report to XMMS-SID author.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
296 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
297 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
298
837
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
299 if (!engine->tune->getStatus())
5b3e2116408f Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 834
diff changeset
300 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
301 xs_error("[SIDPlay1] SID-tune status check failed. This should not happen, report to XMMS-SID author.\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
302 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
303 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
304
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
305 return sidEmuInitializeSong(*engine->emu, *engine->tune, state->currSong);
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
306 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
307
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
308
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
309 /* 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
310 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
311 guint xs_sidplay1_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
312 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
313 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
314 assert(state);
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
315
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
316 engine = (XSSIDPlay1 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
317 if (!engine) return 0;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
318
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
319 sidEmuFillBuffer(*engine->emu, *engine->tune, audioBuffer, audioBufSize);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
320
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
321 return audioBufSize;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
322 }
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
323
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
324
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
325 /* Load a given SID-tune file
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
326 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
327 gboolean xs_sidplay1_load(XSEngineState * state, gchar * filename)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
328 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
329 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
330 assert(state);
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
331
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
332 engine = (XSSIDPlay1 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
333 if (!engine) return FALSE;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
334
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
335 /* Try to get the tune */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
336 if (!filename) return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
337
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
338 if (xs_fload_buffer(filename, &(engine->buf), &(engine->bufSize)) != 0)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
339 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
340
764
5eee092d1b13 Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 756
diff changeset
341 if (!engine->tune->load(engine->buf, engine->bufSize))
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
342 return FALSE;
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
344 return TRUE;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
345 }
71
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346
2b32c75729ce Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
348 /* Delete INTERNAL information
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
349 */
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
350 void xs_sidplay1_delete(XSEngineState * state)
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
351 {
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
352 XSSIDPlay1 *engine;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
353 assert(state);
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
354
756
8299288df6d2 Rename internal structures.
Matti Hamalainen <ccr@tnsp.org>
parents: 754
diff changeset
355 engine = (XSSIDPlay1 *) state->internal;
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
356 if (!engine) return;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
357
754
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
358 g_free(engine->buf);
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
359 engine->buf = NULL;
5557837fe5b6 Rename some more variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 753
diff changeset
360 engine->bufSize = 0;
364
421e4fc13bce More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
361 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
362
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
363
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
364 } /* extern "C" */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
365 #endif /* HAVE_SIDPLAY1 */