annotate src/xs_sidplay2.cc @ 324:dd201740a720

Changed copyright text.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Jan 2005 04:11:02 +0000
parents 45ad9f7c1628
children 2b4ca75b999f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 libSIDPlay v2 support
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 321
diff changeset
7 (C) Copyright 1999-2005 Tecnic Software productions (TNSP)
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 along with this program; if not, write to the Free Software
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "xmms-sid.h"
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #ifdef HAVE_SIDPLAY2
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #include "xs_sidplay2.h"
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #include <stdio.h>
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #include "xs_config.h"
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #include "xs_support.h"
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include "xs_length.h"
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
32 #include "xs_title.h"
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #include <sidplay/sidplay2.h>
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 #ifdef HAVE_RESID_BUILDER
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #include <sidplay/builders/resid.h>
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 #endif
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #ifdef HAVE_HARDSID_BUILDER
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
39 #include <sidplay/builders/hardsid.h>
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 #endif
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 typedef struct {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 sidplay2 *currEng;
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
45 sidbuilder *currBuilder;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 sid2_config_t currConfig;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 SidTune *currTune;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 } t_xs_sidplay2;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
51 /* We need to 'export' all this pseudo-C++ crap */
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 extern "C" {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
54
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
55 /* 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
56 */
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
57 gboolean xs_sidplay2_isourfile(gchar *pcFilename)
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 {
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
59 SidTune *testTune = new SidTune(pcFilename);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 if (!testTune) return FALSE;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 if (!testTune->getStatus())
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 delete testTune;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 return FALSE;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 delete testTune;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 return TRUE;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
73
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
74 /* Initialize SIDPlay2
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
75 */
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 gboolean xs_sidplay2_init(t_xs_status *myStatus)
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 {
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
78 gint tmpFreq;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
79 t_xs_sidplay2 *myEngine;
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
80 assert(myStatus);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 /* Allocate internal structures */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
83 myEngine = (t_xs_sidplay2 *) g_malloc0(sizeof(t_xs_sidplay2));
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
84 myStatus->sidEngine = myEngine;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
85 if (!myEngine) return FALSE;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
87
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
88 /* Initialize the engine */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
89 myEngine->currEng = new sidplay2;
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
90 if (!myEngine->currEng)
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 XSERR("Could not initialize libSIDPlay2 emulation engine\n");
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
93 return FALSE;
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
94 }
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
95
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 /* Get current configuration */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
97 myEngine->currConfig = myEngine->currEng->config();
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 /* Configure channels and stuff */
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
100 switch (myStatus->audioChannels) {
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 case XS_CHN_AUTOPAN:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
103 myEngine->currConfig.playback = sid2_stereo;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 case XS_CHN_STEREO:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
107 myEngine->currConfig.playback = sid2_stereo;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 case XS_CHN_MONO:
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 default:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
112 myEngine->currConfig.playback = sid2_mono;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
113 myStatus->audioChannels = XS_CHN_MONO;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 /* Memory mode settings */
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 switch (xs_cfg.memoryMode) {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 case XS_MPU_BANK_SWITCHING:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
121 myEngine->currConfig.environment = sid2_envBS;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 case XS_MPU_TRANSPARENT_ROM:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
125 myEngine->currConfig.environment = sid2_envTP;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 case XS_MPU_PLAYSID_ENVIRONMENT:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
129 myEngine->currConfig.environment = sid2_envPS;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
132 case XS_MPU_REAL:
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 default:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
134 myEngine->currConfig.environment = sid2_envR;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
135 xs_cfg.memoryMode = XS_MPU_REAL;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 /* Clockspeed settings */
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 switch (xs_cfg.clockSpeed) {
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 case XS_CLOCK_NTSC:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
143 myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_NTSC;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 case XS_CLOCK_PAL:
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 default:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
148 myEngine->currConfig.clockSpeed = myEngine->currConfig.clockDefault = SID2_CLOCK_PAL;
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
149 xs_cfg.clockSpeed = XS_CLOCK_PAL;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 break;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
154 /* Audio parameters sanity checking and setup */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
155 myEngine->currConfig.precision = myStatus->audioBitsPerSample;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
156 tmpFreq = myStatus->audioFrequency;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
157
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
158 if (myStatus->oversampleEnable)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
159 tmpFreq = (tmpFreq * myStatus->oversampleFactor);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
160
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
161 myEngine->currConfig.frequency = tmpFreq;
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
162
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
163 switch (myStatus->audioBitsPerSample) {
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
164 case XS_RES_8BIT:
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
165 myStatus->audioFormat = FMT_U8;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
166 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
167 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
168
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
169 case XS_RES_16BIT:
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
170 default:
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
171 switch (myStatus->audioFormat) {
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
172 case FMT_U16_LE:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
173 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
174 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
175
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
176 case FMT_U16_BE:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
177 myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
178 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
179
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
180 case FMT_U16_NE:
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
181 #ifdef WORDS_BIGENDIAN
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
182 myEngine->currConfig.sampleFormat = SID2_BIG_UNSIGNED;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 #else
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
184 myEngine->currConfig.sampleFormat = SID2_LITTLE_UNSIGNED;
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 #endif
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
186 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
187
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
188 case FMT_S16_LE:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
189 myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
190 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
191
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
192 case FMT_S16_BE:
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
193 myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
194 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
195
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
196 default:
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
197 myStatus->audioFormat = FMT_S16_NE;
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
198 #ifdef WORDS_BIGENDIAN
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
199 myEngine->currConfig.sampleFormat = SID2_BIG_SIGNED;
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
200 #else
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
201 myEngine->currConfig.sampleFormat = SID2_LITTLE_SIGNED;
74
8cb66a3f75f7 Testing
Matti Hamalainen <ccr@tnsp.org>
parents: 73
diff changeset
202 #endif
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
203 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
204
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
205 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
206 break;
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
207 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
208
321
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
209 /* Initialize builder object */
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
210 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (myEngine->currEng->info()).maxsids);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
211 #ifdef HAVE_RESID_BUILDER
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
212 if (xs_cfg.sid2Builder == XS_BLD_RESID)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
213 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
214 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
215 myEngine->currBuilder = (sidbuilder *) rs;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
216 if (rs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
217 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
218 /* Builder object created, initialize it */
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
219 rs->create((myEngine->currEng->info()).maxsids);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
220 if (!*rs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
221 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
222 XSERR("rs->create() failed. SIDPlay2 suxx again.\n");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
223 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
224 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
225 rs->filter(xs_cfg.emulateFilters);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
226 if (!*rs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
227 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
228 XSERR("rs->filter(%d) failed.\n", xs_cfg.emulateFilters);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
229 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
230 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
231
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
232 rs->sampling(tmpFreq);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
233 if (!*rs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
234 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
235 XSERR("rs->sampling(%d) failed.\n", tmpFreq);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
236 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
237 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
238
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
239 rs->filter((sid_filter_t *) NULL);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
240 if (!*rs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
241 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
242 XSERR("rs->filter(NULL) failed.\n");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
243 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
244 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
245 /*
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
246 */
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
247 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
248 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
249 #endif
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
250 #ifdef HAVE_HARDSID_BUILDER
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
251 if (xs_cfg.sid2Builder == XS_BLD_HARDSID)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
252 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
253 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
254 myEngine->currBuilder = (sidbuilder *) hs;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
255 if (hs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
256 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
257 /* Builder object created, initialize it */
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
258 hs->create((myEngine->currEng->info()).maxsids);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
259 if (!*hs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
260 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
261 XSERR("hs->create() failed. SIDPlay2 suxx again.\n");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
262 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
263 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
264
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
265 hs->filter(xs_cfg.emulateFilters);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
266 if (!*hs)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
267 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
268 XSERR("hs->filter(%d) failed.\n", xs_cfg.emulateFilters);
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
269 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
270 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
271 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
272 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
273 #endif
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
274
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
275 if (!myEngine->currBuilder)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
276 {
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
277 XSERR("Could not initialize SIDBuilder object.\n");
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
278 return FALSE;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
279 }
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
280
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
281 XSDEBUG("%s\n", myEngine->currBuilder->credits());
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
282
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
283
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
284 /* Configure rest of the emulation */
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
285 myEngine->currConfig.sidEmulation = myEngine->currBuilder;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
286 myEngine->currConfig.clockForced = xs_cfg.forceSpeed;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
287 myEngine->currConfig.optimisation = (xs_cfg.sid2OptLevel) ? 1 : 0;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
288 if (xs_cfg.mos8580)
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
289 myEngine->currConfig.sidDefault = SID2_MOS8580;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
290 else
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
291 myEngine->currConfig.sidDefault = SID2_MOS6581;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
292
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
293 myEngine->currConfig.sidModel = myEngine->currConfig.sidDefault;
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
294 myEngine->currConfig.sidSamples = TRUE; // FIXME FIX ME, make configurable!
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
295
45ad9f7c1628 Improved compatibility, some fixes in reSID emulation initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
296
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 /* Now set the emulator configuration */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
298 if (myEngine->currEng->config(myEngine->currConfig) < 0)
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
299 {
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
300 XSERR("Emulator engine configuration failed!\n");
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
301 return FALSE;
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
302 }
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
304 /* Create the sidtune */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
305 myEngine->currTune = new SidTune(0);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
306 if (!myEngine->currTune)
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 XSERR("Could not initialize SIDTune object.\n");
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
309 return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
310 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
311
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 return TRUE;
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
316 /* Close SIDPlay2 engine
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
317 */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
318 void xs_sidplay2_close(t_xs_status *myStatus)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
319 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
320 t_xs_sidplay2 *myEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
321 assert(myStatus);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
322
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
323 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
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 /* Free internals */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
326 if (myEngine->currBuilder)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
327 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
328 delete myEngine->currBuilder;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
329 myEngine->currBuilder = NULL;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
330 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
331
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
332 if (myEngine->currEng)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
333 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
334 delete myEngine->currEng;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
335 myEngine->currEng = NULL;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
336 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
337
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
338 if (myEngine->currTune)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
339 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
340 delete myEngine->currTune;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
341 myEngine->currTune = NULL;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
342 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
343
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
344 xs_sidplay2_deletesid(myStatus);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
345
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
346 g_free(myEngine);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
347 myStatus->sidEngine = NULL;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
348 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
349
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
350
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
351 /* Initialize current song and sub-tune
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
352 */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
353 gboolean xs_sidplay2_initsong(t_xs_status *myStatus)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
354 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
355 t_xs_sidplay2 *myEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
356 assert(myStatus);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
357
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
358 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
359 if (!myEngine) return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
360
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
361 if (!myEngine->currTune->selectSong(myStatus->currSong))
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
362 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
363 XSERR("currTune->selectSong() failed\n");
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
364 return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
365 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
366
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
367 if (myEngine->currEng->load(myEngine->currTune) < 0)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
368 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
369 XSERR("currEng->load() failed\n");
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
370 return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
371 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
372
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
373 return TRUE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
374 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
375
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
376
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
377 /* 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
378 */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
379 guint xs_sidplay2_fillbuffer(t_xs_status *myStatus, gchar *audioBuffer, guint audioBufSize)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
380 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
381 t_xs_sidplay2 *myEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
382 assert(myStatus);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
383
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
384 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
385 if (!myEngine) return 0;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
386
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
387 return myEngine->currEng->play(audioBuffer, audioBufSize);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
388 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
389
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
390
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
391 /* Load a given SID-tune file
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
392 */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
393 gboolean xs_sidplay2_loadsid(t_xs_status *myStatus, gchar *pcFilename)
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
394 {
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
395 t_xs_sidplay2 *myEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
396 assert(myStatus);
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
397
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
398 myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
399
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
400 /* Try to get the tune */
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
401 if (!pcFilename) return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
402 if (!myEngine->currTune->load(pcFilename)) return FALSE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
403
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
404 return TRUE;
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
405 }
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
406
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
407
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
408 /* Delete INTERNAL information
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 */
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 void xs_sidplay2_deletesid(t_xs_status *myStatus)
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 {
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
412 assert(myStatus);
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
414 /* With the current scheme of handling sidtune-loading, we don't do anything here. */
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415 }
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417
270
583f5651abff Cleanups, moved engine configuration to initialization function.
Matti Hamalainen <ccr@tnsp.org>
parents: 232
diff changeset
418 /* Return song information
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 */
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 127
diff changeset
420 #define TFUNCTION xs_sidplay2_getsidinfo
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
421 #define TTUNEINFO SidTuneInfo
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
422 #define TTUNE SidTune
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
423 #include "xs_sidplay.h"
73
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 } /* extern "C" */
2bc607888f53 Added libsidplay2 module, lots of reworking of internals, sidplay1 support
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 #endif /* HAVE_SIDPLAY2 */