Mercurial > hg > xmms-sid
annotate src/xmms-sid.h @ 609:d605023290f2
An ugly hack to fix building with --disable-nls.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 01 Sep 2007 14:42:03 +0000 |
parents | 7fcf76236687 |
children | 88bc61a2914f |
rev | line source |
---|---|
1 | 1 /* |
3 | 2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) |
1 | 3 |
4 Main header file | |
5 | |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
422 | 7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
1 | 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 | |
412
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
402
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
1 | 22 */ |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
524
diff
changeset
|
23 #ifndef XMMS_SID_H |
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
524
diff
changeset
|
24 #define XMMS_SID_H |
1 | 25 |
465
ba98fdac6307
Moved some things to xs_support.h; t_xs_subtuneinfo.tuneSpeed is now the
Matti Hamalainen <ccr@tnsp.org>
parents:
459
diff
changeset
|
26 #include "xs_support.h" |
230 | 27 #include <pthread.h> |
1 | 28 |
230 | 29 #ifdef __cplusplus |
30 extern "C" { | |
31 #endif | |
32 | |
434 | 33 /* |
34 * Standard gettext macros. | |
35 */ | |
36 #ifdef ENABLE_NLS | |
37 # include <libintl.h> | |
38 # undef _ | |
39 # define _(String) dgettext (PACKAGE, String) | |
40 # ifdef gettext_noop | |
41 # define N_(String) gettext_noop (String) | |
42 # else | |
43 # define N_(String) (String) | |
44 # endif | |
45 #else | |
609
d605023290f2
An ugly hack to fix building with --disable-nls.
Matti Hamalainen <ccr@tnsp.org>
parents:
555
diff
changeset
|
46 # undef _LIBINTL_H |
434 | 47 # define textdomain(String) (String) |
48 # define gettext(String) (String) | |
49 # define dgettext(Domain,Message) (Message) | |
50 # define dcgettext(Domain,Message,Type) (Message) | |
51 # define bindtextdomain(Domain,Directory) (Domain) | |
52 # define _(String) (String) | |
53 # define N_(String) (String) | |
54 #endif | |
55 | |
56 | |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
57 /* |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
58 * Some constants and defines |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
73
diff
changeset
|
59 */ |
365
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
355
diff
changeset
|
60 /* #define to enable spurious debugging messages for development |
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
355
diff
changeset
|
61 * purposes. Output goes to stderr. See also DEBUG_NP below. |
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
355
diff
changeset
|
62 */ |
524 | 63 #define DEBUG |
300 | 64 |
65 /* Define to ISO C99 macro for debugging instead of varargs function. | |
365
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
355
diff
changeset
|
66 * This provides more useful information, but is incompatible with |
5a92a2aee74c
Better comments and .. you guessed it: more indentation fixes. :)
Matti Hamalainen <ccr@tnsp.org>
parents:
355
diff
changeset
|
67 * older standards. If #undef'd, a varargs function is used instead. |
300 | 68 */ |
308
ae5795ba5c77
Remove "only when song-length unknown" option from minimum playtime, it
Matti Hamalainen <ccr@tnsp.org>
parents:
300
diff
changeset
|
69 #define DEBUG_NP |
230 | 70 |
272 | 71 /* Define to enable non-portable thread and mutex debugging code. |
300 | 72 * You need to #define DEBUG also to make this useful. |
73 * (Works probably with GNU/Linux pthreads implementation only) | |
272 | 74 */ |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
75 #undef XS_MUTEX_DEBUG |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
65
diff
changeset
|
76 |
272 | 77 /* HardSID-support is not working and is untested, thus we disable it here. |
78 */ | |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
79 #undef HAVE_HARDSID_BUILDER |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
80 |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
81 /* Size for some small buffers (always static variables) */ |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
82 #define XS_BUF_SIZE (1024) |
1 | 83 |
355
26079ab52fc3
Comment about XS_DYNAMIC_BUF changed
Matti Hamalainen <ccr@tnsp.org>
parents:
334
diff
changeset
|
84 /* If defined, some dynamically allocated temp. buffers are used. |
26079ab52fc3
Comment about XS_DYNAMIC_BUF changed
Matti Hamalainen <ccr@tnsp.org>
parents:
334
diff
changeset
|
85 * Static (#undef) might give slight performance gain, |
26079ab52fc3
Comment about XS_DYNAMIC_BUF changed
Matti Hamalainen <ccr@tnsp.org>
parents:
334
diff
changeset
|
86 * but fails on systems with limited stack space. */ |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
87 #define XS_BUF_DYNAMIC |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
88 |
546
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
89 /* Configuration section identifier |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
90 */ |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
91 #define XS_CONFIG_IDENT "XMMS-SID" |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
92 |
486
4c599be2d349
Default audio rendering frequency #define.
Matti Hamalainen <ccr@tnsp.org>
parents:
478
diff
changeset
|
93 /* Default audio rendering frequency in Hz |
4c599be2d349
Default audio rendering frequency #define.
Matti Hamalainen <ccr@tnsp.org>
parents:
478
diff
changeset
|
94 */ |
4c599be2d349
Default audio rendering frequency #define.
Matti Hamalainen <ccr@tnsp.org>
parents:
478
diff
changeset
|
95 #define XS_AUDIO_FREQ (44100) |
4c599be2d349
Default audio rendering frequency #define.
Matti Hamalainen <ccr@tnsp.org>
parents:
478
diff
changeset
|
96 |
242 | 97 /* Size of audio buffer. If you are experiencing lots of audio |
98 * "underruns" or clicks/gaps in output, try increasing this value. | |
99 * Do notice, however, that it also affects the update frequency of | |
100 * XMMS's visualization plugins... | |
101 */ | |
102 #define XS_AUDIOBUF_SIZE (2*1024) | |
230 | 103 |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
104 /* Size of data buffer used for SID-tune MD5 hash calculation. |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
105 * If this is too small, the computed hash will be incorrect. |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
106 * Largest SID files I've seen are ~70kB. */ |
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
107 #define XS_SIDBUF_SIZE (80*1024) |
230 | 108 |
546
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
109 /* libSIDPlay1/2 constants (copied from internal headers/source) |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
110 * For some stupid reason these are not available in public |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
111 * headers, so we have to duplicate them here... |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
112 */ |
376
b20300813b42
Moved some #defines from xs_config.c to xmms-sid.h; Changed default SID
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
113 #define XS_SIDPLAY1_FS (400.0f) |
b20300813b42
Moved some #defines from xs_config.c to xmms-sid.h; Changed default SID
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
114 #define XS_SIDPLAY1_FM (60.0f) |
b20300813b42
Moved some #defines from xs_config.c to xmms-sid.h; Changed default SID
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
115 #define XS_SIDPLAY1_FT (0.05f) |
b20300813b42
Moved some #defines from xs_config.c to xmms-sid.h; Changed default SID
Matti Hamalainen <ccr@tnsp.org>
parents:
369
diff
changeset
|
116 |
546
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
117 #define XS_SIDPLAY2_NFPOINTS (0x800) |
552
9494fee305fa
Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
546
diff
changeset
|
118 #define XS_SIDPLAY2_FMAX (24000) |
62
0d1df20745dd
Started to rewrite STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
119 |
546
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
120 /* Limits for oversampling |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
121 */ |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
122 #define XS_MIN_OVERSAMPLE (2) |
70fe31fe2bf5
Reordering cleanup and added constant for SIDPlay2 max # of filter coeffs.
Matti Hamalainen <ccr@tnsp.org>
parents:
534
diff
changeset
|
123 #define XS_MAX_OVERSAMPLE (8) |
1 | 124 |
230 | 125 |
126 /* Macros for mutexes and threads. These exist to be able to | |
127 * easily change from pthreads to glib threads, etc, if necessary. | |
128 */ | |
534 | 129 #define XS_THREAD_T pthread_t |
130 #define XS_THREAD_EXIT(M) pthread_exit(M) | |
131 #define XS_THREAD_JOIN(M) pthread_join(M, NULL) | |
132 #define XS_MPP(M) M ## _mutex | |
133 #if XS_MUTEX_DEBUG | |
134 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int M ## _qq; | |
135 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M); extern int M ## _qq | |
136 # define XS_MUTEX_LOCK(M) { M ## _qq = pthread_mutex_lock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_LOCK(" #M ") == %i\n", M ## _qq); } | |
137 # define XS_MUTEX_UNLOCK(M) { M ## _qq = pthread_mutex_unlock(&XS_MPP(M)); if (M ## _qq) XSDEBUG("XS_MUTEX_UNLOCK(" #M ") == %i\n", M ## _qq); } | |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
138 #else |
534 | 139 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER |
140 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M) | |
141 # define XS_MUTEX_LOCK(M) pthread_mutex_lock(&XS_MPP(M)) | |
142 # define XS_MUTEX_UNLOCK(M) pthread_mutex_unlock(&XS_MPP(M)) | |
241
291715a519e2
Compile-time setting to enable/disable use of dynamically allocated buffers.
Matti Hamalainen <ccr@tnsp.org>
parents:
235
diff
changeset
|
143 #endif |
230 | 144 |
145 /* Shorthands for linked lists | |
146 */ | |
147 #define LPREV (pNode->pPrev) | |
148 #define LTHIS (pNode) | |
149 #define LNEXT (pNode->pNext) | |
62
0d1df20745dd
Started to rewrite STIL-support
Matti Hamalainen <ccr@tnsp.org>
parents:
50
diff
changeset
|
150 |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
65
diff
changeset
|
151 |
230 | 152 /* Plugin-wide typedefs |
153 */ | |
72
e3b205a6bc7e
Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents:
65
diff
changeset
|
154 typedef struct { |
465
ba98fdac6307
Moved some things to xs_support.h; t_xs_subtuneinfo.tuneSpeed is now the
Matti Hamalainen <ccr@tnsp.org>
parents:
459
diff
changeset
|
155 gint tuneSpeed, |
ba98fdac6307
Moved some things to xs_support.h; t_xs_subtuneinfo.tuneSpeed is now the
Matti Hamalainen <ccr@tnsp.org>
parents:
459
diff
changeset
|
156 tuneLength; |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
376
diff
changeset
|
157 gboolean tunePlayed; |
230 | 158 } t_xs_subtuneinfo; |
78
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
73
diff
changeset
|
159 |
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
73
diff
changeset
|
160 |
ab522ab65c85
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
73
diff
changeset
|
161 typedef struct { |
230 | 162 gchar *sidFilename, |
163 *sidName, | |
164 *sidComposer, | |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
165 *sidCopyright, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
166 *sidFormat; |
230 | 167 gint loadAddr, |
168 initAddr, | |
169 playAddr, | |
402
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
170 dataFileLen, |
f997b79a7251
More work on merging of improved STIL/SLDB handling code with completely
Matti Hamalainen <ccr@tnsp.org>
parents:
394
diff
changeset
|
171 sidModel; |
230 | 172 gint nsubTunes, startTune; |
334 | 173 t_xs_subtuneinfo *subTunes; |
230 | 174 } t_xs_tuneinfo; |
175 | |
176 | |
177 /* Global variables | |
178 */ | |
179 extern InputPlugin xs_plugin_ip; | |
180 | |
181 | |
182 /* Plugin function prototypes | |
1 | 183 */ |
184 void xs_init(void); | |
147
a7abcda7a86c
SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents:
138
diff
changeset
|
185 void xs_reinit(void); |
3 | 186 void xs_close(void); |
65
bf7b647b3239
The fabled 0.8-rewrite now works to some extent
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
187 gint xs_is_our_file(gchar *); |
bf7b647b3239
The fabled 0.8-rewrite now works to some extent
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
188 void xs_play_file(gchar *); |
1 | 189 void xs_stop(void); |
190 void xs_pause(short); | |
65
bf7b647b3239
The fabled 0.8-rewrite now works to some extent
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
191 void xs_seek(gint); |
bf7b647b3239
The fabled 0.8-rewrite now works to some extent
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
192 gint xs_get_time(void); |
bf7b647b3239
The fabled 0.8-rewrite now works to some extent
Matti Hamalainen <ccr@tnsp.org>
parents:
62
diff
changeset
|
193 void xs_get_song_info(gchar *, gchar **, gint *); |
40
1788f4ce6a44
Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
194 void xs_about(void); |
1 | 195 |
445
f277dad3180f
Working on the localization and fixing up the breakage in song information
Matti Hamalainen <ccr@tnsp.org>
parents:
434
diff
changeset
|
196 |
459 | 197 t_xs_tuneinfo *xs_tuneinfo_new(const gchar * pcFilename, |
198 gint nsubTunes, gint startTune, const gchar * sidName, | |
199 const gchar * sidComposer, const gchar * sidCopyright, | |
200 gint loadAddr, gint initAddr, gint playAddr, | |
478 | 201 gint dataFileLen, const gchar *sidFormat, gint sidModel); |
230 | 202 void xs_tuneinfo_free(t_xs_tuneinfo *); |
87
94497283affa
Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
203 |
394 | 204 void xs_error(const char *, ...); |
1 | 205 |
427
2ea3005a4b7f
Conditional #definition of _()
Matti Hamalainen <ccr@tnsp.org>
parents:
424
diff
changeset
|
206 |
2ea3005a4b7f
Conditional #definition of _()
Matti Hamalainen <ccr@tnsp.org>
parents:
424
diff
changeset
|
207 /* Debugging |
2ea3005a4b7f
Conditional #definition of _()
Matti Hamalainen <ccr@tnsp.org>
parents:
424
diff
changeset
|
208 */ |
300 | 209 #ifndef DEBUG_NP |
210 void XSDEBUG(const char *, ...); | |
211 #else | |
532 | 212 # ifdef DEBUG |
213 # define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } | |
214 # else | |
215 # define XSDEBUG(...) /* stub */ | |
216 # endif | |
300 | 217 #endif |
1 | 218 |
219 #ifdef __cplusplus | |
220 } | |
221 #endif | |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
524
diff
changeset
|
222 #endif /* XMMS_SID_H */ |