comparison src/sid/xmms-sid.h @ 12:3da1b8942b8b trunk

[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author nenolod
date Mon, 18 Sep 2006 03:14:20 -0700
parents src/Input/sid/xmms-sid.h@13389e613d67
children c488d191b528
comparison
equal deleted inserted replaced
11:cff1d04026ae 12:3da1b8942b8b
1 /*
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
3
4 Main header file
5
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
7 (C) Copyright 1999-2005 Tecnic Software productions (TNSP)
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 #ifndef _XMMS_SID_H
24 #define _XMMS_SID_H
25
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29
30 #ifdef HAVE_ASSERT_H
31 #include <assert.h>
32 #else
33 #define assert(x) /* stub */
34 #endif
35
36 #include <glib.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #include "audacious/plugin.h"
43
44 /*
45 * Some constants and defines
46 */
47 /* #define to enable spurious debugging messages for development
48 * purposes. Output goes to stderr. See also DEBUG_NP below.
49 */
50 #undef DEBUG
51
52 /* Define to ISO C99 macro for debugging instead of varargs function.
53 * This provides more useful information, but is incompatible with
54 * older standards. If #undef'd, a varargs function is used instead.
55 */
56 #undef DEBUG_NP
57
58 /* HardSID-support is not working and is untested, thus we disable it here.
59 */
60 #undef HAVE_HARDSID_BUILDER
61
62 /* Size for some small buffers (always static variables) */
63 #define XS_BUF_SIZE (1024)
64
65 /* If defined, some dynamically allocated temp. buffers are used.
66 * Static (#undef) might give slight performance gain,
67 * but fails on systems with limited stack space. */
68 #define XS_BUF_DYNAMIC
69
70 /* Size of audio buffer. If you are experiencing lots of audio
71 * "underruns" or clicks/gaps in output, try increasing this value.
72 * Do notice, however, that it also affects the update frequency of
73 * XMMS's visualization plugins...
74 */
75 #define XS_AUDIOBUF_SIZE (2*1024)
76
77 /* Size of data buffer used for SID-tune MD5 hash calculation.
78 * If this is too small, the computed hash will be incorrect.
79 * Largest SID files I've seen are ~70kB. */
80 #define XS_SIDBUF_SIZE (80*1024)
81
82
83 /* libSIDPlay1 default filter values (copied from libsidplay1's headers) */
84 #define XS_SIDPLAY1_FS (400.0f)
85 #define XS_SIDPLAY1_FM (60.0f)
86 #define XS_SIDPLAY1_FT (0.05f)
87
88
89 #define XS_BIN_BAILOUT (32) /* Binary search bailout treshold */
90
91 #define XS_STIL_MAXENTRY (128) /* Max number of sub-songs in STIL/SLDB node */
92
93
94 #define XS_CONFIG_IDENT "sid" /* Configuration file identifier */
95
96 #define XS_MIN_OVERSAMPLE (2) /* Minimum oversampling factor */
97 #define XS_MAX_OVERSAMPLE (8) /* Maximum oversampling factor */
98
99
100 /* Shorthands for linked lists
101 */
102 #define LPREV (pNode->pPrev)
103 #define LTHIS (pNode)
104 #define LNEXT (pNode->pNext)
105
106
107 /* Plugin-wide typedefs
108 */
109 typedef struct {
110 gint tuneSpeed;
111 gint tuneLength;
112 gchar *tuneTitle;
113 } t_xs_subtuneinfo;
114
115
116 typedef struct {
117 gchar *sidFilename,
118 *sidName,
119 *sidComposer,
120 *sidCopyright;
121 gint loadAddr,
122 initAddr,
123 playAddr,
124 dataFileLen;
125 gint nsubTunes, startTune;
126 t_xs_subtuneinfo *subTunes;
127 } t_xs_tuneinfo;
128
129
130 struct t_xs_status;
131
132 typedef struct {
133 gint plrIdent;
134 gboolean (*plrIsOurFile)(gchar *);
135 gboolean (*plrInit)(struct t_xs_status *);
136 void (*plrClose)(struct t_xs_status *);
137 gboolean (*plrInitSong)(struct t_xs_status *);
138 guint (*plrFillBuffer)(struct t_xs_status *, gchar *, guint);
139 gboolean (*plrLoadSID)(struct t_xs_status *, gchar *);
140 void (*plrDeleteSID)(struct t_xs_status *);
141 t_xs_tuneinfo* (*plrGetSIDInfo)(gchar *);
142 } t_xs_player;
143
144
145 typedef struct t_xs_status {
146 gint audioFrequency, /* Audio settings */
147 audioChannels,
148 audioBitsPerSample,
149 oversampleFactor; /* Factor of oversampling */
150 AFormat audioFormat;
151 gboolean oversampleEnable; /* TRUE after sidEngine initialization,
152 if xs_cfg.oversampleEnable == TRUE and
153 emulation backend supports oversampling.
154 */
155 void *sidEngine; /* SID-emulation internal engine data */
156 t_xs_player *sidPlayer; /* Selected player engine */
157 gboolean isError, isPlaying;
158 gint currSong, /* Current sub-tune */
159 lastTime;
160 t_xs_tuneinfo *tuneInfo;
161 } t_xs_status;
162
163
164 /* Global variables
165 */
166 extern InputPlugin xs_plugin_ip;
167 extern t_xs_status xs_status;
168
169 /* Plugin function prototypes
170 */
171 void xs_init(void);
172 void xs_reinit(void);
173 void xs_close(void);
174 gint xs_is_our_file(gchar *);
175 void xs_play_file(gchar *);
176 void xs_stop(void);
177 void xs_pause(short);
178 void xs_seek(gint);
179 gint xs_get_time(void);
180 void xs_get_song_info(gchar *, gchar **, gint *);
181 void xs_about(void);
182
183 t_xs_tuneinfo *xs_tuneinfo_new(gchar *, gint, gint, gchar *, gchar *, gchar *, gint, gint, gint, gint);
184 void xs_tuneinfo_free(t_xs_tuneinfo *);
185
186 void XSERR(const char *, ...);
187
188 #ifndef DEBUG_NP
189 void XSDEBUG(const char *, ...);
190 #else
191 #ifdef DEBUG
192 #define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); }
193 #else
194 #define XSDEBUG(...) /* stub */
195 #endif
196 #endif
197
198 #ifdef __cplusplus
199 }
200 #endif
201 #endif /* _XMMS_SID_H */