annotate src/xs_sidplayfp.cpp @ 983:04dde987c0aa

Some translation updates.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 31 Mar 2013 11:43:01 +0300
parents 9bd29db2d1bf
children 34259889b2b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
4 libSIDPlay2-FP support
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
979
9bd29db2d1bf Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 977
diff changeset
7 (C) Copyright 1999-2013 Tecnic Software productions (TNSP)
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License along
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "xmms-sid.h"
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
25 #ifdef HAVE_SIDPLAYFP
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
27 #include "xs_sidplayfp.h"
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
28 #include "xs_slsup.h"
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #include "xs_config.h"
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
32 #ifdef HAVE_SIDPLAYFP_V1
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 # include <sidplayfp/SidTune.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 # include <sidplayfp/sidplayfp.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 # include <sidplayfp/event.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 # include <sidplayfp/SidConfig.h>
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
37 # include <sidplayfp/SidInfo.h>
974
ae99f7489e79 Update to match latest API changes in libSIDPlayFP 1.0.0 alphas.
Matti Hamalainen <ccr@tnsp.org>
parents: 963
diff changeset
38 # include <sidplayfp/SidTuneInfo.h>
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #else
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 # include <sidplayfp/sidplay2.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 # include <sidplayfp/SidTuneMod.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 # include <sidplayfp/event.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 class XSSIDPlayFP {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 public:
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
48 #ifdef HAVE_SIDPLAYFP_V1
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 sidplayfp emu;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 SidConfig config;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 #else
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 sidplay2 emu;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 sid2_config_t config;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 #endif
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
55 SidTune tune;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 XSSIDPlayFP(void);
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 virtual ~XSSIDPlayFP(void);
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 };
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
61 static guint8 *xs_rom_imagedata[XS_C64_ROM_IMAGES];
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
63 #ifdef HAVE_RESID_FP_BUILDER
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 # include <sidplayfp/builders/residfp.h>
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
65 #endif
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
66
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
67 #ifdef HAVE_RESID_FP_BUILDER
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 # include <sidplayfp/builders/resid.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 #ifdef HAVE_HARDSID_BUILDER
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 # include <sidplayfp/builders/hardsid.h>
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 XSSIDPlayFP::XSSIDPlayFP(void) : tune(0)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 {
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
78 emu.load(NULL);
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 XSSIDPlayFP::~XSSIDPlayFP(void)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 emu.load(NULL);
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 /* We need to 'export' all this pseudo-C++ crap */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 extern "C" {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 /* Return song information
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 */
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
94 #ifdef HAVE_SIDPLAYFP_V1
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 #define sid2_mono SidConfig::MONO
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 #define sid2_stereo SidConfig::STEREO
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
97
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
98 #define SID2_INTERPOLATE SidConfig::INTERPOLATE
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
99 #define SID2_RESAMPLE_INTERPOLATE SidConfig::RESAMPLE_INTERPOLATE
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
100
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 #define SID2_MOS8580 SidConfig::MOS8580
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 #define SID2_MOS6581 SidConfig::MOS6581
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
103
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
104 #define SID2_CLOCK_PAL SidConfig::PAL
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
105 #define SID2_CLOCK_NTSC SidConfig::NTSC
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
106
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 #define SIDTUNE_CLOCK_UNKNOWN SidTuneInfo::CLOCK_UNKNOWN
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 #define SIDTUNE_CLOCK_PAL SidTuneInfo::CLOCK_PAL
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 #define SIDTUNE_CLOCK_NTSC SidTuneInfo::CLOCK_NTSC
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 #define SIDTUNE_CLOCK_ANY SidTuneInfo::CLOCK_ANY
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 #define SIDTUNE_SPEED_VBI SidTuneInfo::SPEED_VBI
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 #define SIDTUNE_SPEED_CIA_1A SidTuneInfo::SPEED_CIA_1A
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 /* Check if we can play the given file
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 gboolean xs_sidplayfp_probe(XSFile *f)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 {
954
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
120 gchar probe[16];
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
121
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
122 if (f == NULL || !xs_fread_str(f, (guint8 *) probe, sizeof(probe)))
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 return FALSE;
954
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
124
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
125 // Basically support all variants ..
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
126 if (!strncmp(probe, "PSID", 4) && probe[4] == 0 &&
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
127 probe[5] >= 1 && probe[5] <= 3)
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
128 return TRUE;
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
129 else
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
130 if (!strncmp(probe, "RSID", 4) &&
a5b118c853f5 Use xs_fread_str() and improve the probing of each backend to be more
Matti Hamalainen <ccr@tnsp.org>
parents: 928
diff changeset
131 probe[4] == 0 && probe[5] >= 2 && probe[5] <= 3)
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 return TRUE;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 else
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 return FALSE;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
138 /* Initialize SIDPlayFP
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 gboolean xs_sidplayfp_init(XSEngineState * state)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 {
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
142 (void) state;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 assert(state);
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
145 XSDEBUG("SIDPlayFP backend initializing.\n");
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
146
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
147 memset(xs_rom_imagedata, 0, sizeof(xs_rom_imagedata));
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
148 if (!xs_load_rom_images(xs_rom_imagedata))
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
149 return FALSE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
150
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
151 return TRUE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
152 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
153
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
154
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
155 /* Close SIDPlayFP engine
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
156 */
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
157 void xs_sidplayfp_close(XSEngineState * state)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
158 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
159 XSDEBUG("SIDPlayFP backend shutdown.\n");
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
160
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
161 xs_sidplayfp_delete(state);
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
162 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
163
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
164
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
165 /* Initialize current song and sub-tune
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
166 */
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
167 gboolean xs_sidplayfp_initsong(XSEngineState * state)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
168 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
169 XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
170
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
171 if (!engine)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
172 return FALSE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
173
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
174 if (!engine->tune.selectSong(state->currSong))
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
175 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
176 xs_error("[SIDPlayFP] tune.selectSong() failed\n");
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
177 return FALSE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
178 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
179
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
180 if (engine->emu.load(&(engine->tune)) < 0)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
181 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
182 xs_error("[SIDPlayFP] emu.load() failed\n");
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
183 return FALSE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
184 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
185
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
186 if (engine->emu.config(engine->config) < 0)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
187 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
188 xs_error("[SIDPlayFP] Emulator engine configuration failed!\n");
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
189 return FALSE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
190 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
191
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
192 return TRUE;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
193 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
194
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
195
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
196 /* Emulate and render audio data to given buffer
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
197 */
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
198 guint xs_sidplayfp_fillbuffer(XSEngineState * state, gchar * audioBuffer, guint audioBufSize)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
199 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
200 XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
201
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
202 if (!engine)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
203 return 0;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
204
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
205 return engine->emu.play((short *) audioBuffer, audioBufSize / sizeof(short)) * sizeof(short);
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
206 }
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
207
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
208
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
209 /* Load a given SID-tune file
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
210 */
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
211 gboolean xs_sidplayfp_load(XSEngineState * state, gchar * filename)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
212 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
213 XSSIDPlayFP *engine;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
214 guint8 *buf = NULL;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
215 size_t bufSize;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
216
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 /* Allocate internal structures */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218 engine = new XSSIDPlayFP();
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 state->internal = engine;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 if (!engine)
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
221 {
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
222 xs_error("Allocating XSSIDPlayFP compound backend object failed.\n");
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
223 goto error;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
224 }
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 /* Get current configuration */
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
227 XSDEBUG("SIDPlayFP emulation configuration\n");
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 engine->config = engine->emu.config();
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 /* Configure channels and stuff */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 engine->config.playback = (state->audioChannels == XS_CHN_MONO) ? sid2_mono : sid2_stereo;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 /* Audio parameters sanity checking and setup */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 state->audioBitsPerSample = XS_RES_16BIT;
851
4c4978e11ec0 Oops. Remember to set output audio format for FP backend.
Matti Hamalainen <ccr@tnsp.org>
parents: 849
diff changeset
235 state->audioFormat = FMT_S16_NE;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 engine->config.frequency = state->audioFrequency;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237
904
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
238 switch (xs_cfg.residSampling)
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
239 {
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
240 case XS_RESID_RESAMPLE_FIR:
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
241 engine->config.samplingMethod = SID2_RESAMPLE_INTERPOLATE;
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
242 break;
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
243
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
244 case XS_RESID_INTERPOLATE:
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
245 default:
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
246 xs_cfg.residSampling = XS_RESID_INTERPOLATE;
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
247 engine->config.samplingMethod = SID2_INTERPOLATE;
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
248 break;
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
249 }
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
250
5d26b869a48e Add resampling configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
251
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
252 /* Clockspeed settings */
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
253 switch (xs_cfg.clockSpeed)
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
254 {
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
255 case XS_CLOCK_NTSC:
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
256 #ifdef HAVE_SIDPLAYFP_V1
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
257 engine->config.defaultC64Model = SID2_CLOCK_NTSC;
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
258 #else
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
259 engine->config.clockDefault = SID2_CLOCK_NTSC;
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
260 #endif
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
261 break;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
262
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
263 default:
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
264 case XS_CLOCK_PAL:
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
265 #ifdef HAVE_SIDPLAYFP_V1
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
266 #else
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
267 engine->config.defaultC64Model = SID2_CLOCK_PAL;
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
268 #endif
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
269 xs_cfg.clockSpeed = XS_CLOCK_PAL;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
270 break;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
271 }
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
272
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
273
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
274 /* Configure rest of the emulation */
977
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
275
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
276 #ifdef HAVE_SIDPLAYFP_V1
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
277 engine->config.forceC64Model = xs_cfg.forceSpeed;
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
278 engine->config.defaultSidModel = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581;
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
279 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids());
d9ad299059a4 Update to be compatible with libsidplayfp 1.0.1 API.
Matti Hamalainen <ccr@tnsp.org>
parents: 974
diff changeset
280 #else
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
281 engine->config.sidDefault = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
282 engine->config.clockForced = xs_cfg.forceSpeed;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
283 engine->config.sidSamples = TRUE;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
284 engine->config.sidModel = xs_cfg.forceModel ? engine->config.sidDefault : SID2_MODEL_CORRECT;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
285 engine->config.clockSpeed = xs_cfg.forceSpeed ? engine->config.clockDefault : SID2_CLOCK_CORRECT;
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
286
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 /* Initialize builder object */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids);
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
289 #endif
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 switch (xs_cfg.sid2Builder)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 #ifdef HAVE_RESID_BUILDER
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 case XS_BLD_RESID:
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
297 #ifdef HAVE_SIDPLAYFP_V1
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 if (rs && rs->getStatus())
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 {
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
300 engine->config.sidEmulation = rs;
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
301 if (!rs->getStatus()) goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
302 rs->create((engine->emu.info()).maxsids());
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
303 if (!rs->getStatus()) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 #else
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
306 if (rs && *rs)
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 engine->config.sidEmulation = rs;
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
309 if (!*rs) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 rs->create((engine->emu.info()).maxsids);
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
311 if (!*rs) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 }
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
313 #endif
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
314 rs->bias(0.0f);
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 break;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 #endif // HAVE_RESID_BUILDER
853
1f97cd026465 Don't disable plain reSID backend for FP.
Matti Hamalainen <ccr@tnsp.org>
parents: 851
diff changeset
318
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 #ifdef HAVE_RESID_FP_BUILDER
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 case XS_BLD_RESID_FP:
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 ReSIDfpBuilder *rs = new ReSIDfpBuilder("ReSID builder FP!");
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
324 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
325 if (rs && rs->getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
326 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
327 engine->config.sidEmulation = rs;
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
328 if (!rs->getStatus()) goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
329 rs->create((engine->emu.info()).maxsids());
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
330 if (!rs->getStatus()) goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
331 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
332 #else
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
333 if (rs && *rs)
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 engine->config.sidEmulation = rs;
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
336 if (!*rs) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337 rs->create((engine->emu.info()).maxsids);
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
338 if (!*rs) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 }
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
340 #endif
928
8f1027a6b4a0 Oops, do not incorrectly set the reSID-FP backend filters to 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 924
diff changeset
341 // rs->filter6581Curve(0.0);
8f1027a6b4a0 Oops, do not incorrectly set the reSID-FP backend filters to 0.
Matti Hamalainen <ccr@tnsp.org>
parents: 924
diff changeset
342 // rs->filter8580Curve(0.0);
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 break;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347 #ifdef HAVE_HARDSID_BUILDER
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 case XS_BLD_HARDSID:
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)");
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 engine->config.sidEmulation = (sidbuilder *) hs;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
352 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
353 if (hs && hs->getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
354 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
355 hs->create((engine->emu.info()).maxsids());
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
356 if (!hs->getStatus()) goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
357 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
358 #else
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
359 if (hs && *hs)
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 hs->create((engine->emu.info()).maxsids);
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
362 if (!*hs) goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 }
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
364 #endif
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 break;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 default:
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
370 xs_error("[SIDPlayFP] Invalid or unsupported builder selected.\n");
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
371 goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
374
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 if (!engine->config.sidEmulation)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 {
847
5b93bd8c7814 Cleanups, adjust backend configuration sequences, more error checking,
Matti Hamalainen <ccr@tnsp.org>
parents: 838
diff changeset
377 xs_error("[SIDPlayFP] Could not initialize SIDBuilder object.\n");
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
378 goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 // Setup filter
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 engine->config.sidEmulation->filter(xs_cfg.emulateFilters);
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
383 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
384 if (!engine->config.sidEmulation->getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
385 #else
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 if (!*(engine->config.sidEmulation))
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
387 #endif
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 xs_error("builder->filter(%d) failed.\n", xs_cfg.emulateFilters);
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
390 goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 XSDEBUG("%s\n", engine->config.sidEmulation->credits());
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 869
diff changeset
395 #ifdef HAVE_SIDPLAYFP_V1
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
396 engine->emu.setRoms(xs_rom_imagedata[0], xs_rom_imagedata[1], xs_rom_imagedata[2]);
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 869
diff changeset
397 #endif
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
400
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
401 if (!xs_fload_buffer(filename, &buf, &bufSize, XS_SIDBUF_SIZE, TRUE))
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
402 goto error;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
403
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
404 engine->tune.read(buf, bufSize);
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
406 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
407 if (!engine->tune.getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
408 #else
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 if (!engine->tune)
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
410 #endif
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 {
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
412 xs_error("Could not load file '%s'\n", filename);
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
413 goto error;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 }
849
2663b1ac9ce6 Improve debugging.
Matti Hamalainen <ccr@tnsp.org>
parents: 847
diff changeset
415
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
416 g_free(buf);
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
417 return TRUE;
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
418
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
419 error:
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
420 if (engine)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
421 delete engine;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
422 state->internal = NULL;
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
423 g_free(buf);
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
424 return FALSE;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 /* Delete INTERNAL information
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 void xs_sidplayfp_delete(XSEngineState * state)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431 {
957
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
432 XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
433
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
434 if (engine)
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
435 delete engine;
0e60e5d56fdd Change how the backend emulator library is initialized for libSIDPlay2 and
Matti Hamalainen <ccr@tnsp.org>
parents: 954
diff changeset
436 state->internal = NULL;
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 /* Hardware backend flushing
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 */
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 void xs_sidplayfp_flush(XSEngineState * state)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 #ifdef HAVE_HARDSID_BUILDER
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 if (xs_cfg.sid2Builder == XS_BLD_HARDSID)
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 {
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 ((HardSIDBuilder *) engine->config.sidEmulation)->flush();
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 #endif
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452 }
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
455 /* This function gets most of the information, though we do miss some
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
456 * (those variables that are only set by libSIDPlay when tune is initialized).
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
457 * Rest of the information is acquired in xs_sidplayfp_updateinfo()
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
458 */
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
459 XSTuneInfo *xs_sidplayfp_getinfo(const gchar *filename)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
460 {
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
461 XSTuneInfo *res = NULL;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
462 SidTune *tune = NULL;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
463 guint8 *buf = NULL;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
464 size_t bufSize;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
465
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
466 /* Check if the tune exists and is readable */
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
467 if (!xs_fload_buffer(filename, &buf, &bufSize, XS_SIDBUF_SIZE, TRUE))
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
468 {
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
469 XSDEBUG("could not load file '%s'.\n", filename);
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
470 goto error;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
471 }
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
472
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
473 if ((tune = new SidTune(buf, bufSize)) == NULL)
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
474 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
475 XSDEBUG("could not initialize tune from '%s'.\n", filename);
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
476 goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
477 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
478
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
479 if (!tune->getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
480 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
481 XSDEBUG("tune->getStatus() returned false for '%s'.\n", filename);
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
482 goto error;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
483 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
484
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
485 /* Get general tune information */
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
486 {
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
487 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
488 const SidTuneInfo *info = tune->getInfo();
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
489
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
490 res = xs_tuneinfo_new(filename,
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
491 info->songs(), info->startSong(),
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
492 info->infoString(0), info->infoString(1), info->infoString(2),
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
493 info->loadAddr(), info->initAddr(), info->playAddr(),
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
494 info->dataFileLen(), info->formatString(),
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 959
diff changeset
495 info->sidModel1(), info->sidModel2()
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
496 );
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
497 #else
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
498 const SidTuneInfo info = tune->getInfo();
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
499
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
500 res = xs_tuneinfo_new(filename,
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
501 info.songs, info.startSong,
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
502 info.infoString[0], info.infoString[1], info.infoString[2],
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
503 info.loadAddr, info.initAddr, info.playAddr,
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
504 info.dataFileLen, info.formatString,
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 959
diff changeset
505 info.sidModel1, info.sidModel2
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
506 );
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
507 #endif
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
508 }
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
509
869
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
510 error:
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
511 if (tune)
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
512 delete tune;
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
513
3a9bf45178ff Use xs_fload_buffer() again, to support potential VFS backends.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
514 g_free(buf);
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
515 return res;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
516 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
517
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
518
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
519 /* Updates the information of currently playing tune
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
520 */
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
521 gboolean xs_sidplayfp_updateinfo(XSEngineState *state)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
522 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
523 XSSIDPlayFP *engine;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
524
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
525 /* Check if we have required structures initialized */
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
526 if (!state || !state->tuneInfo || !state->internal)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
527 return FALSE;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
528
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
529 engine = (XSSIDPlayFP *) state->internal;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
530
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
531 #ifdef HAVE_SIDPLAYFP_V1
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
532 if (!engine->tune.getStatus())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
533 return FALSE;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
534
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
535 const SidTuneInfo *info = engine->tune.getInfo();
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
536
961
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 959
diff changeset
537 state->tuneInfo->sidModel1 = info->sidModel1();
be2a8436461a Add display of second SID chip to titles, and also new custom format tokens
Matti Hamalainen <ccr@tnsp.org>
parents: 959
diff changeset
538 state->tuneInfo->sidModel2 = info->sidModel2();
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
539
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
540 if (state->currSong > 0 && state->currSong <= state->tuneInfo->nsubTunes)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
541 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
542 gint tmpSpeed = info->clockSpeed();
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
543 switch (info->clockSpeed())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
544 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
545 case SIDTUNE_CLOCK_PAL: tmpSpeed = XS_CLOCK_PAL; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
546 case SIDTUNE_CLOCK_NTSC: tmpSpeed = XS_CLOCK_NTSC; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
547 case SIDTUNE_CLOCK_ANY: tmpSpeed = XS_CLOCK_ANY; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
548 case SIDTUNE_CLOCK_UNKNOWN:
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
549 switch (info->songSpeed())
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
550 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
551 case SIDTUNE_SPEED_VBI: tmpSpeed = XS_CLOCK_VBI; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
552 case SIDTUNE_SPEED_CIA_1A: tmpSpeed = XS_CLOCK_CIA; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
553 default: tmpSpeed = info->songSpeed(); break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
554 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
555 break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
556 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
557 state->tuneInfo->subTunes[state->currSong - 1].tuneSpeed = tmpSpeed;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
558 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
559 #else
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
560 if (!(engine->tune))
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
561 return FALSE;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
562
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
563 const SidTuneInfo info = engine->tune.getInfo();
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
564
963
f165db0e8ab8 Minor fix in older libSIDPlayFP backend support.
Matti Hamalainen <ccr@tnsp.org>
parents: 961
diff changeset
565 state->tuneInfo->sidModel1 = info.sidModel1;
f165db0e8ab8 Minor fix in older libSIDPlayFP backend support.
Matti Hamalainen <ccr@tnsp.org>
parents: 961
diff changeset
566 state->tuneInfo->sidModel2 = info.sidModel2;
862
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
567
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
568 if (state->currSong > 0 && state->currSong <= state->tuneInfo->nsubTunes)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
569 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
570 gint tmpSpeed = info.clockSpeed;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
571 switch (info.clockSpeed)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
572 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
573 case SIDTUNE_CLOCK_PAL: tmpSpeed = XS_CLOCK_PAL; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
574 case SIDTUNE_CLOCK_NTSC: tmpSpeed = XS_CLOCK_NTSC; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
575 case SIDTUNE_CLOCK_ANY: tmpSpeed = XS_CLOCK_ANY; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
576 case SIDTUNE_CLOCK_UNKNOWN:
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
577 switch (info.songSpeed)
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
578 {
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
579 case SIDTUNE_SPEED_VBI: tmpSpeed = XS_CLOCK_VBI; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
580 case SIDTUNE_SPEED_CIA_1A: tmpSpeed = XS_CLOCK_CIA; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
581 default: tmpSpeed = info.songSpeed; break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
582 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
583 break;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
584 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
585 state->tuneInfo->subTunes[state->currSong - 1].tuneSpeed = tmpSpeed;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
586 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
587 #endif
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
588
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
589 return TRUE;
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
590 }
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
591
011ba70e271e Major cleanups, make SIDPlayFP backend compile with libSIDPlayFP v1.0.0
Matti Hamalainen <ccr@tnsp.org>
parents: 853
diff changeset
592
835
d508c7c4bc69 Add libSIDPlay2-FP backend interface module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 } /* extern "C" */
838
ae1f6418d093 libSIDPlay2-FP backend interface is now in a separate module. Configuration
Matti Hamalainen <ccr@tnsp.org>
parents: 835
diff changeset
594 #endif /* HAVE_SIDPLAYFP */