Mercurial > hg > xmms-sid
annotate src/xs_sidplay1.cc @ 411:a26263683929
Indentation
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Jun 2006 19:02:03 +0000 |
parents | f997b79a7251 |
children | 7f694e5a1493 |
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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 libSIDPlay v1 support |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
7 (C) Copyright 1999-2005 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 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 along with this program; if not, write to the Free Software |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
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" |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
28 #include <stdio.h> |
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 |
396 | 36 typedef struct { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
37 emuEngine *currEng; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
38 emuConfig currConfig; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
39 sidTune *currTune; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
40 } t_xs_sidplay1; |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
41 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
42 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
43 /* We need to 'export' all this pseudo-C++ crap */ |
396 | 44 extern "C" { |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
45 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
46 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
47 /* 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
|
48 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
49 gboolean xs_sidplay1_isourfile(gchar * pcFilename) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
50 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
51 sidTune *testTune = new sidTune(pcFilename); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
52 |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
53 if (!testTune) return FALSE; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
54 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
55 if (!testTune->getStatus()) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
56 delete testTune; |
411 | 57 return FALSE; |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
58 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
59 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
60 delete testTune; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
61 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
62 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
63 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
64 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
65 /* Initialize SIDPlay1 |
75
653c9b0d1320
SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents:
74
diff
changeset
|
66 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
67 gboolean xs_sidplay1_init(t_xs_status * myStatus) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
68 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
69 gint tmpFreq; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
70 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
71 assert(myStatus); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
72 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
73 /* Allocate internal structures */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
74 myEngine = (t_xs_sidplay1 *) g_malloc0(sizeof(t_xs_sidplay1)); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
75 if (!myEngine) return FALSE; |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
76 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
77 /* Initialize engine */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
78 myEngine->currEng = new emuEngine(); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
79 if (!myEngine->currEng) { |
394 | 80 xs_error("Could not initialize libSIDPlay1 emulation engine\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
81 g_free(myEngine); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
82 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
83 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
84 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
85 /* Verify endianess */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
86 if (!myEngine->currEng->verifyEndianess()) { |
394 | 87 xs_error("Endianess verification failed\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
88 delete myEngine->currEng; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
89 g_free(myEngine); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
90 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
91 } |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
71
diff
changeset
|
92 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
93 myStatus->sidEngine = myEngine; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
95 /* Get current configuration */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
96 myEngine->currEng->getConfig(myEngine->currConfig); |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
98 /* Configure channel parameters */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
99 switch (myStatus->audioChannels) { |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
101 case XS_CHN_AUTOPAN: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
102 myEngine->currConfig.channels = SIDEMU_STEREO; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
103 myEngine->currConfig.autoPanning = SIDEMU_CENTEREDAUTOPANNING; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
104 myEngine->currConfig.volumeControl = SIDEMU_FULLPANNING; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
105 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
107 case XS_CHN_STEREO: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
108 myEngine->currConfig.channels = SIDEMU_STEREO; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
109 myEngine->currConfig.autoPanning = SIDEMU_NONE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
110 myEngine->currConfig.volumeControl = SIDEMU_NONE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
111 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
112 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
113 case XS_CHN_MONO: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
114 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
115 myEngine->currConfig.channels = SIDEMU_MONO; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
116 myEngine->currConfig.autoPanning = SIDEMU_NONE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
117 myEngine->currConfig.volumeControl = SIDEMU_NONE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
118 myStatus->audioChannels = XS_CHN_MONO; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
119 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
120 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
123 /* Memory mode settings */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
124 switch (xs_cfg.memoryMode) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
125 case XS_MPU_TRANSPARENT_ROM: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
126 myEngine->currConfig.memoryMode = MPU_TRANSPARENT_ROM; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
127 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
129 case XS_MPU_PLAYSID_ENVIRONMENT: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
130 myEngine->currConfig.memoryMode = MPU_PLAYSID_ENVIRONMENT; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
131 break; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
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_BANK_SWITCHING: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
134 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
135 myEngine->currConfig.memoryMode = MPU_BANK_SWITCHING; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
136 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
137 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
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 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
141 /* Audio parameters sanity checking and setup */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
142 myEngine->currConfig.bitsPerSample = myStatus->audioBitsPerSample; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
143 tmpFreq = myStatus->audioFrequency; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
144 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
145 if (myStatus->oversampleEnable) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
146 if ((tmpFreq * myStatus->oversampleFactor) > SIDPLAY1_MAX_FREQ) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
147 myStatus->oversampleEnable = FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
148 } else { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
149 tmpFreq = (tmpFreq * myStatus->oversampleFactor); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
150 } |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
151 } else { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
152 if (tmpFreq > SIDPLAY1_MAX_FREQ) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
153 tmpFreq = SIDPLAY1_MAX_FREQ; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
154 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
155 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
156 myEngine->currConfig.frequency = tmpFreq; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
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 switch (myStatus->audioFormat) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
161 case FMT_S8: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
162 myStatus->audioFormat = FMT_S8; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
163 myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
164 break; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
165 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
166 case FMT_U8: |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
167 default: |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
168 myStatus->audioFormat = FMT_U8; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
169 myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
170 break; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
171 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
172 break; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
173 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
174 case XS_RES_16BIT: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
175 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
176 switch (myStatus->audioFormat) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
177 case FMT_U16_NE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
178 case FMT_U16_LE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
179 case FMT_U16_BE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
180 myStatus->audioFormat = FMT_U16_NE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
181 myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
182 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
183 |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
184 case FMT_S16_NE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
185 case FMT_S16_LE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
186 case FMT_S16_BE: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
187 default: |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
188 myStatus->audioFormat = FMT_S16_NE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
189 myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
190 break; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
191 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
192 break; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
193 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
194 |
368
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
195 /* Clockspeed settings */ |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
196 switch (xs_cfg.clockSpeed) { |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
197 case XS_CLOCK_NTSC: |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
198 myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_NTSC; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
199 break; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
200 |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
201 case XS_CLOCK_PAL: |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
202 default: |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
203 myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_PAL; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
204 xs_cfg.clockSpeed = XS_CLOCK_PAL; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
205 break; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
206 } |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
207 |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
208 myEngine->currConfig.forceSongSpeed = xs_cfg.forceSpeed; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
209 |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
210 |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
211 /* Configure rest of the emulation */ |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
212 /* if (xs_cfg.forceModel) */ |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
213 myEngine->currConfig.mos8580 = xs_cfg.mos8580; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
214 myEngine->currConfig.emulateFilter = xs_cfg.emulateFilters; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
215 myEngine->currConfig.filterFs = xs_cfg.filterFs; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
216 myEngine->currConfig.filterFm = xs_cfg.filterFm; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
217 myEngine->currConfig.filterFt = xs_cfg.filterFt; |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
218 |
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
219 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
220 /* Now set the emulator configuration */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
221 if (!myEngine->currEng->setConfig(myEngine->currConfig)) { |
394 | 222 xs_error("Emulator engine configuration failed!\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
223 return FALSE; |
127
ddb513bd2610
Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents:
103
diff
changeset
|
224 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
225 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
226 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
227 } |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
228 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
229 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
230 /* Close SIDPlay1 engine |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
231 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
232 void xs_sidplay1_close(t_xs_status * myStatus) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
233 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
234 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
235 assert(myStatus); |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
236 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
237 myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
238 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
239 /* Free internals */ |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
240 if (myEngine->currEng) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
241 delete myEngine->currEng; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
242 myEngine->currEng = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
243 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
244 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
245 g_free(myEngine); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
246 myStatus->sidEngine = NULL; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
247 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
248 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
249 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
250 /* Initialize current song and sub-tune |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
251 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
252 gboolean xs_sidplay1_initsong(t_xs_status * myStatus) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
253 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
254 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
255 assert(myStatus); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
256 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
257 myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
258 if (!myEngine) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
259 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
260 if (!myEngine->currTune) { |
394 | 261 xs_error("Tune was NULL\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
262 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
263 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
264 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
265 if (!myEngine->currTune->getStatus()) { |
394 | 266 xs_error("Tune status check failed\n"); |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
267 return FALSE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
268 } |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
269 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
270 return sidEmuInitializeSong(*myEngine->currEng, *myEngine->currTune, myStatus->currSong); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
271 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
272 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
273 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
274 /* 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
|
275 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
276 guint xs_sidplay1_fillbuffer(t_xs_status * myStatus, gchar * audioBuffer, guint audioBufSize) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
277 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
278 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
279 assert(myStatus); |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
280 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
281 myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
282 if (!myEngine) return 0; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
283 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
284 sidEmuFillBuffer(*myEngine->currEng, *myEngine->currTune, audioBuffer, audioBufSize); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
285 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
286 return audioBufSize; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
287 } |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
288 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
289 |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
290 /* Load a given SID-tune file |
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
291 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
292 gboolean xs_sidplay1_loadsid(t_xs_status * myStatus, gchar * pcFilename) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
293 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
294 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
295 sidTune *newTune; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
296 assert(myStatus); |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
297 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
298 myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; |
368
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
299 if (!myEngine) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
300 |
368
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
301 /* Try to load the file/tune */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
302 if (!pcFilename) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
303 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
304 newTune = new sidTune(pcFilename); |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
305 if (!newTune) return FALSE; |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
306 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
307 myEngine->currTune = newTune; |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
308 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
309 return TRUE; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
310 } |
71
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
311 |
2b32c75729ce
Started modularizing, separated sidplay1 things into a "wrapper" module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
312 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
313 /* Delete INTERNAL information |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
314 */ |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
315 void xs_sidplay1_deletesid(t_xs_status * myStatus) |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
316 { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
317 t_xs_sidplay1 *myEngine; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
318 assert(myStatus); |
74 | 319 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
320 myEngine = (t_xs_sidplay1 *) myStatus->sidEngine; |
368
3e55874170eb
Cleanups, additional engine NULL check.
Matti Hamalainen <ccr@tnsp.org>
parents:
364
diff
changeset
|
321 if (!myEngine) return; |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
322 |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
323 if (myEngine->currTune) { |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
324 delete myEngine->currTune; |
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
325 myEngine->currTune = NULL; |
74 | 326 } |
364
421e4fc13bce
More and more of indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
327 } |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
328 |
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
329 |
270
583f5651abff
Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
330 /* Return song information |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
331 */ |
202 | 332 #define TFUNCTION xs_sidplay1_getsidinfo |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
333 #define TTUNEINFO sidTuneInfo |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
334 #define TTUNE sidTune |
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
335 #include "xs_sidplay.h" |
73
2bc607888f53
Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
336 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
337 } /* extern "C" */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
324
diff
changeset
|
338 #endif /* HAVE_SIDPLAY1 */ |