annotate src/sid/xs_sidplay1.cc @ 3195:16d4308fb36e

alsa-ng: Set type hint on prefs window, and don't use deprecated GTK funcs.
author John Lindgren <john.lindgren@tds.net>
date Thu, 09 Jul 2009 11:03:32 -0400
parents bac936960b49
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 libSIDPlay v1 support
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
19 You should have received a copy of the GNU General Public License along
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 #include "xmms-sid.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #ifdef HAVE_SIDPLAY1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
27 #include <stdio.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #include "xs_sidplay1.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include "xs_config.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include <sidplay/player.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 #include <sidplay/myendian.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include <sidplay/fformat.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
36 /* Maximum audio frequency supported by libSIDPlay v1 */
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
37 #define SIDPLAY1_MAX_FREQ (48000)
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
38
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
39
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
40 typedef struct {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
41 emuEngine *currEng;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
42 emuConfig currConfig;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
43 sidTune *currTune;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
44 guint8 *buf;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
45 size_t bufSize;
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
46 } xs_sidplay1_t;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 /* We need to 'export' all this pseudo-C++ crap */
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
50 extern "C" {
462
c488d191b528 [svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents: 12
diff changeset
51
c488d191b528 [svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents: 12
diff changeset
52
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
53 /* Return song information
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
54 */
2622
bac936960b49 Indentation cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2509
diff changeset
55 #define TFUNCTION xs_sidplay1_getinfo
bac936960b49 Indentation cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2509
diff changeset
56 #define TFUNCTION2 xs_sidplay1_updateinfo
bac936960b49 Indentation cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2509
diff changeset
57 #define TTUNEINFO sidTuneInfo
bac936960b49 Indentation cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2509
diff changeset
58 #define TTUNE sidTune
bac936960b49 Indentation cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 2509
diff changeset
59 #define TENGINE xs_sidplay1_t
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
60 #include "xs_sidplay.h"
462
c488d191b528 [svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents: 12
diff changeset
61
c488d191b528 [svn] - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
giacomo
parents: 12
diff changeset
62
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63 /* Check if we can play the given file
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
65 gboolean xs_sidplay1_probe(xs_file_t *f)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
66 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
67 gchar tmpBuf[4];
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
68
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
69 if (!f) return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
70
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
71 if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4)
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
72 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
73
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
74 if (!strncmp(tmpBuf, "PSID", 4))
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
75 return TRUE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
76 else
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
77 return FALSE;
463
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
78 }
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
79
1e5cb7a00cb0 [svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
giacomo
parents: 462
diff changeset
80
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
81 /* Initialize SIDPlay1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
82 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
83 gboolean xs_sidplay1_init(xs_status_t * myStatus)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
85 gint tmpFreq;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
86 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
87 assert(myStatus);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
89 /* Allocate internal structures */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
90 myEngine = (xs_sidplay1_t *) g_malloc0(sizeof(xs_sidplay1_t));
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
91 if (!myEngine) return FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
92
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
93 /* Initialize engine */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
94 myEngine->currEng = new emuEngine();
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
95 if (!myEngine->currEng) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
96 xs_error("[SIDPlay1] Could not initialize emulation engine.\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
97 g_free(myEngine);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
98 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
99 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
101 /* Verify endianess */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
102 if (!myEngine->currEng->verifyEndianess()) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
103 xs_error("[SIDPlay1] Endianess verification failed.\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
104 delete myEngine->currEng;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
105 g_free(myEngine);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
106 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
107 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
109 myStatus->sidEngine = myEngine;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
111 /* Get current configuration */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
112 myEngine->currEng->getConfig(myEngine->currConfig);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
113
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
114 /* Configure channel parameters */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
115 switch (myStatus->audioChannels) {
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
117 case XS_CHN_AUTOPAN:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
118 myEngine->currConfig.channels = SIDEMU_STEREO;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
119 myEngine->currConfig.autoPanning = SIDEMU_CENTEREDAUTOPANNING;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
120 myEngine->currConfig.volumeControl = SIDEMU_FULLPANNING;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
121 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
122
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
123 case XS_CHN_STEREO:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
124 myEngine->currConfig.channels = SIDEMU_STEREO;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
125 myEngine->currConfig.autoPanning = SIDEMU_NONE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
126 myEngine->currConfig.volumeControl = SIDEMU_NONE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
127 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
128
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
129 case XS_CHN_MONO:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
130 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
131 myEngine->currConfig.channels = SIDEMU_MONO;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
132 myEngine->currConfig.autoPanning = SIDEMU_NONE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
133 myEngine->currConfig.volumeControl = SIDEMU_NONE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
134 myStatus->audioChannels = XS_CHN_MONO;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
135 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
136 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
137
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
138
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
139 /* Memory mode settings */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
140 switch (xs_cfg.memoryMode) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
141 case XS_MPU_TRANSPARENT_ROM:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
142 myEngine->currConfig.memoryMode = MPU_TRANSPARENT_ROM;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
143 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
145 case XS_MPU_PLAYSID_ENVIRONMENT:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
146 myEngine->currConfig.memoryMode = MPU_PLAYSID_ENVIRONMENT;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
147 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
149 case XS_MPU_BANK_SWITCHING:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
150 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
151 myEngine->currConfig.memoryMode = MPU_BANK_SWITCHING;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
152 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
153 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
154 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
157 /* Audio parameters sanity checking and setup */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
158 myEngine->currConfig.bitsPerSample = myStatus->audioBitsPerSample;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
159 tmpFreq = myStatus->audioFrequency;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
160
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
161 if (myStatus->oversampleEnable) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
162 if ((tmpFreq * myStatus->oversampleFactor) > SIDPLAY1_MAX_FREQ) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
163 myStatus->oversampleEnable = FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
164 } else {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
165 tmpFreq = (tmpFreq * myStatus->oversampleFactor);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
166 }
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
167 } else {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
168 if (tmpFreq > SIDPLAY1_MAX_FREQ)
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
169 tmpFreq = SIDPLAY1_MAX_FREQ;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
170 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
171
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
172 myEngine->currConfig.frequency = tmpFreq;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
174 switch (myStatus->audioBitsPerSample) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
175 case XS_RES_8BIT:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
176 switch (myStatus->audioFormat) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
177 case FMT_S8:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
178 myStatus->audioFormat = FMT_S8;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
179 myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
180 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
181
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
182 case FMT_U8:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
183 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
184 myStatus->audioFormat = FMT_U8;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
185 myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
186 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
187 }
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
188 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
189
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
190 case XS_RES_16BIT:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
191 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
192 switch (myStatus->audioFormat) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
193 case FMT_U16_NE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
194 case FMT_U16_LE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
195 case FMT_U16_BE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
196 myStatus->audioFormat = FMT_U16_NE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
197 myEngine->currConfig.sampleFormat = SIDEMU_UNSIGNED_PCM;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
198 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
199
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
200 case FMT_S16_NE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
201 case FMT_S16_LE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
202 case FMT_S16_BE:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
203 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
204 myStatus->audioFormat = FMT_S16_NE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
205 myEngine->currConfig.sampleFormat = SIDEMU_SIGNED_PCM;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
206 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
207 }
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
208 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
209 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
210
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
211 /* Clockspeed settings */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
212 switch (xs_cfg.clockSpeed) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
213 case XS_CLOCK_NTSC:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
214 myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_NTSC;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
215 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
216
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
217 case XS_CLOCK_PAL:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
218 default:
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
219 myEngine->currConfig.clockSpeed = SIDTUNE_CLOCK_PAL;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
220 xs_cfg.clockSpeed = XS_CLOCK_PAL;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
221 break;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
222 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
223
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
224 myEngine->currConfig.forceSongSpeed = xs_cfg.forceSpeed;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
225
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
226
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
227 /* Configure rest of the emulation */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
228 /* if (xs_cfg.forceModel) */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
229 myEngine->currConfig.mos8580 = xs_cfg.mos8580;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
230 myEngine->currConfig.emulateFilter = xs_cfg.emulateFilters;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
231 myEngine->currConfig.filterFs = xs_cfg.sid1FilterFs;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
232 myEngine->currConfig.filterFm = xs_cfg.sid1FilterFm;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
233 myEngine->currConfig.filterFt = xs_cfg.sid1FilterFt;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
234
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
235
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
236 /* Now set the emulator configuration */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
237 if (!myEngine->currEng->setConfig(myEngine->currConfig)) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
238 xs_error("[SIDPlay1] Emulator engine configuration failed!\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
239 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
240 }
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
241
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
242 /* Create sidtune object */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
243 myEngine->currTune = new sidTune(0);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
244 if (!myEngine->currTune) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
245 xs_error("[SIDPlay1] Could not initialize SIDTune object.\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
246 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
247 }
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
248
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
249 return TRUE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
250 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
251
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
252
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
253 /* Close SIDPlay1 engine
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
254 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
255 void xs_sidplay1_close(xs_status_t * myStatus)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
256 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
257 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
258 assert(myStatus);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
259
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
260 myEngine = (xs_sidplay1_t *) myStatus->sidEngine;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
261
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
262 /* Free internals */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
263 if (myEngine->currEng) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
264 delete myEngine->currEng;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
265 myEngine->currEng = NULL;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
266 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
267
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
268 if (myEngine->currTune) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
269 delete myEngine->currTune;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
270 myEngine->currTune = NULL;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
271 }
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
272
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
273 xs_sidplay1_delete(myStatus);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
274
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
275 g_free(myEngine);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
276 myStatus->sidEngine = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
277 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
278
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
279
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
280 /* Initialize current song and sub-tune
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
281 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
282 gboolean xs_sidplay1_initsong(xs_status_t * myStatus)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
283 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
284 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
285 assert(myStatus);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
286
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
287 myEngine = (xs_sidplay1_t *) myStatus->sidEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
288 if (!myEngine) return FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
289
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
290 if (!myEngine->currTune) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
291 xs_error("[SIDPlay1] SID-tune struct pointer was NULL. This should not happen, report to XMMS-SID author.\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
292 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
293 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
294
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
295 if (!myEngine->currTune->getStatus()) {
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
296 xs_error("[SIDPlay1] SID-tune status check failed. This should not happen, report to XMMS-SID author.\n");
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
297 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
298 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
300 myStatus->isInitialized = TRUE;
735
6c3c7b841382 [svn] - sync audacious-sid with latest xmms-sid, from Matti Hamalainen (ccr).
nenolod
parents: 463
diff changeset
301
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
302 return sidEmuInitializeSong(*myEngine->currEng, *myEngine->currTune, myStatus->currSong);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
303 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
304
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
305
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
306 /* Emulate and render audio data to given buffer
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
307 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
308 guint xs_sidplay1_fillbuffer(xs_status_t * myStatus, gchar * audioBuffer, guint audioBufSize)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
309 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
310 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
311 assert(myStatus);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
313 myEngine = (xs_sidplay1_t *) myStatus->sidEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
314 if (!myEngine) return 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
315
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
316 sidEmuFillBuffer(*myEngine->currEng, *myEngine->currTune, audioBuffer, audioBufSize);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
317
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
318 return audioBufSize;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
319 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
320
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
321
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
322 /* Load a given SID-tune file
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
323 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
324 gboolean xs_sidplay1_load(xs_status_t * myStatus, gchar * filename)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
325 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
326 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
327 assert(myStatus);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
328 myStatus->isInitialized = FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
329
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
330 myEngine = (xs_sidplay1_t *) myStatus->sidEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
331 if (!myEngine) return FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
332
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
333 /* Try to get the tune */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
334 if (!filename) return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
335
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
336 if (xs_fload_buffer(filename, &(myEngine->buf), &(myEngine->bufSize)) != 0)
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
337 return FALSE;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
338
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
339 if (!myEngine->currTune->load(myEngine->buf, myEngine->bufSize))
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
340 return FALSE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
341
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
342 return TRUE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
343 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
344
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
345
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
346 /* Delete INTERNAL information
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
347 */
2507
251336bee085 Cosmetic cleanups, synchronized from XMMS-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 2478
diff changeset
348 void xs_sidplay1_delete(xs_status_t * myStatus)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
349 {
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
350 xs_sidplay1_t *myEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
351 assert(myStatus);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
352
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
353 myEngine = (xs_sidplay1_t *) myStatus->sidEngine;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
354 if (!myEngine) return;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
355
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
356 g_free(myEngine->buf);
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
357 myEngine->buf = NULL;
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
358 myEngine->bufSize = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
359 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
360
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
361
2509
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
362 } /* extern "C" */
1223e8510d8a Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 2507
diff changeset
363 #endif /* HAVE_SIDPLAY1 */