Mercurial > hg > xmms-sid
comparison src/xmms-sid.h @ 660:b0743dc9165d
Change tabs to 4 spaces, everywhere.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 02 Apr 2008 22:10:05 +0300 |
parents | acaba070cf49 |
children | 94186706beed |
comparison
equal
deleted
inserted
replaced
659:04ea91a61225 | 660:b0743dc9165d |
---|---|
52 /* HardSID-support is not working and is untested, thus we disable it here. | 52 /* HardSID-support is not working and is untested, thus we disable it here. |
53 */ | 53 */ |
54 #undef HAVE_HARDSID_BUILDER | 54 #undef HAVE_HARDSID_BUILDER |
55 | 55 |
56 /* Size for some small buffers (always static variables) */ | 56 /* Size for some small buffers (always static variables) */ |
57 #define XS_BUF_SIZE (1024) | 57 #define XS_BUF_SIZE (1024) |
58 | 58 |
59 /* If defined, some dynamically allocated temp. buffers are used. | 59 /* If defined, some dynamically allocated temp. buffers are used. |
60 * Static (#undef) might give slight performance gain, | 60 * Static (#undef) might give slight performance gain, |
61 * but fails on systems with limited stack space. */ | 61 * but fails on systems with limited stack space. */ |
62 #define XS_BUF_DYNAMIC | 62 #define XS_BUF_DYNAMIC |
63 | 63 |
64 /* Configuration section identifier | 64 /* Configuration section identifier |
65 */ | 65 */ |
66 #define XS_PACKAGE_STRING PACKAGE_STRING | 66 #define XS_PACKAGE_STRING PACKAGE_STRING |
67 #define XS_CONFIG_IDENT "XMMS-SID" | 67 #define XS_CONFIG_IDENT "XMMS-SID" |
68 | 68 |
69 /* Default audio rendering frequency in Hz | 69 /* Default audio rendering frequency in Hz |
70 */ | 70 */ |
71 #define XS_AUDIO_FREQ (44100) | 71 #define XS_AUDIO_FREQ (44100) |
72 | 72 |
73 /* Size of audio buffer. If you are experiencing lots of audio | 73 /* Size of audio buffer. If you are experiencing lots of audio |
74 * "underruns" or clicks/gaps in output, try increasing this value. | 74 * "underruns" or clicks/gaps in output, try increasing this value. |
75 * Do notice, however, that it also affects the update frequency of | 75 * Do notice, however, that it also affects the update frequency of |
76 * XMMS's visualization plugins... | 76 * XMMS's visualization plugins... |
77 */ | 77 */ |
78 #define XS_AUDIOBUF_SIZE (2*1024) | 78 #define XS_AUDIOBUF_SIZE (2*1024) |
79 | 79 |
80 /* Size of data buffer used for SID-tune MD5 hash calculation. | 80 /* Size of data buffer used for SID-tune MD5 hash calculation. |
81 * If this is too small, the computed hash will be incorrect. | 81 * If this is too small, the computed hash will be incorrect. |
82 * Largest SID files I've seen are ~70kB. */ | 82 * Largest SID files I've seen are ~70kB. */ |
83 #define XS_SIDBUF_SIZE (80*1024) | 83 #define XS_SIDBUF_SIZE (80*1024) |
84 | 84 |
85 /* libSIDPlay1/2 constants (copied from internal headers/source) | 85 /* libSIDPlay1/2 constants (copied from internal headers/source) |
86 * For some stupid reason these are not available in public | 86 * For some stupid reason these are not available in public |
87 * headers, so we have to duplicate them here... | 87 * headers, so we have to duplicate them here... |
88 */ | 88 */ |
89 #define XS_SIDPLAY1_FS (400.0f) | 89 #define XS_SIDPLAY1_FS (400.0f) |
90 #define XS_SIDPLAY1_FM (60.0f) | 90 #define XS_SIDPLAY1_FM (60.0f) |
91 #define XS_SIDPLAY1_FT (0.05f) | 91 #define XS_SIDPLAY1_FT (0.05f) |
92 | 92 |
93 #define XS_SIDPLAY2_NFPOINTS (0x800) | 93 #define XS_SIDPLAY2_NFPOINTS (0x800) |
94 #define XS_SIDPLAY2_FMAX (24000) | 94 #define XS_SIDPLAY2_FMAX (24000) |
95 | 95 |
96 /* Limits for oversampling | 96 /* Limits for oversampling |
97 */ | 97 */ |
98 #define XS_MIN_OVERSAMPLE (2) | 98 #define XS_MIN_OVERSAMPLE (2) |
99 #define XS_MAX_OVERSAMPLE (8) | 99 #define XS_MAX_OVERSAMPLE (8) |
100 | 100 |
101 | 101 |
102 /* Macros for mutexes and threads. These exist to be able to | 102 /* Macros for mutexes and threads. These exist to be able to |
103 * easily change from pthreads to glib threads, etc, if necessary. | 103 * easily change from pthreads to glib threads, etc, if necessary. |
104 */ | 104 */ |
105 #define XS_THREAD_T pthread_t | 105 #define XS_THREAD_T pthread_t |
106 #define XS_THREAD_EXIT(M) pthread_exit(M) | 106 #define XS_THREAD_EXIT(M) pthread_exit(M) |
107 #define XS_THREAD_JOIN(M) pthread_join(M, NULL) | 107 #define XS_THREAD_JOIN(M) pthread_join(M, NULL) |
108 #define XS_MPP(M) M ## _mutex | 108 #define XS_MPP(M) M ## _mutex |
109 #ifdef XS_MUTEX_DEBUG | 109 #ifdef XS_MUTEX_DEBUG |
110 # ifndef __USE_GNU | 110 # ifndef __USE_GNU |
111 # define __USE_GNU | 111 # define __USE_GNU |
112 # endif | 112 # endif |
113 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; gint M ## _qq | 113 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; gint M ## _qq |
114 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M); extern gint M ## _qq | 114 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M); extern gint M ## _qq |
115 # 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); } | 115 # 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); } |
116 # 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); } | 116 # 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); } |
117 #else | 117 #else |
118 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER | 118 # define XS_MUTEX(M) pthread_mutex_t XS_MPP(M) = PTHREAD_MUTEX_INITIALIZER |
119 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M) | 119 # define XS_MUTEX_H(M) extern pthread_mutex_t XS_MPP(M) |
120 # define XS_MUTEX_LOCK(M) pthread_mutex_lock(&XS_MPP(M)) | 120 # define XS_MUTEX_LOCK(M) pthread_mutex_lock(&XS_MPP(M)) |
121 # define XS_MUTEX_UNLOCK(M) pthread_mutex_unlock(&XS_MPP(M)) | 121 # define XS_MUTEX_UNLOCK(M) pthread_mutex_unlock(&XS_MPP(M)) |
122 #endif | 122 #endif |
123 #include <pthread.h> | 123 #include <pthread.h> |
124 | 124 |
125 /* Character set conversion helper macros | 125 /* Character set conversion helper macros |
126 */ | 126 */ |
127 #define XS_CS_FILENAME(M) g_strdup(M) | 127 #define XS_CS_FILENAME(M) g_strdup(M) |
128 #define XS_CS_SID(M) g_strdup(M) | 128 #define XS_CS_SID(M) g_strdup(M) |
129 #define XS_CS_STIL(M) M | 129 #define XS_CS_STIL(M) M |
130 #define XS_CS_FREE(M) | 130 #define XS_CS_FREE(M) |
131 | 131 |
132 /* Shorthands for linked lists | 132 /* Shorthands for linked lists |
133 */ | 133 */ |
134 #define LPREV (node->prev) | 134 #define LPREV (node->prev) |
135 #define LTHIS (node) | 135 #define LTHIS (node) |
136 #define LNEXT (node->next) | 136 #define LNEXT (node->next) |
137 | 137 |
138 | 138 |
139 /* Plugin-wide typedefs | 139 /* Plugin-wide typedefs |
140 */ | 140 */ |
141 typedef struct { | 141 typedef struct { |
142 gint tuneSpeed, | 142 gint tuneSpeed, |
143 tuneLength; | 143 tuneLength; |
144 gboolean tunePlayed; | 144 gboolean tunePlayed; |
145 } xs_subtuneinfo_t; | 145 } xs_subtuneinfo_t; |
146 | 146 |
147 | 147 |
148 typedef struct { | 148 typedef struct { |
149 gchar *sidFilename, | 149 gchar *sidFilename, |
150 *sidName, | 150 *sidName, |
151 *sidComposer, | 151 *sidComposer, |
152 *sidCopyright, | 152 *sidCopyright, |
153 *sidFormat; | 153 *sidFormat; |
154 gint loadAddr, | 154 gint loadAddr, |
155 initAddr, | 155 initAddr, |
156 playAddr, | 156 playAddr, |
157 dataFileLen, | 157 dataFileLen, |
158 sidModel; | 158 sidModel; |
159 gint nsubTunes, startTune; | 159 gint nsubTunes, startTune; |
160 xs_subtuneinfo_t *subTunes; | 160 xs_subtuneinfo_t *subTunes; |
161 } xs_tuneinfo_t; | 161 } xs_tuneinfo_t; |
162 | 162 |
163 | 163 |
164 /* Global variables | 164 /* Global variables |
165 */ | 165 */ |
166 extern InputPlugin xs_plugin_ip; | 166 extern InputPlugin xs_plugin_ip; |
167 | 167 |
168 | 168 |
169 /* Plugin function prototypes | 169 /* Plugin function prototypes |
170 */ | 170 */ |
171 void xs_init(void); | 171 void xs_init(void); |
172 void xs_reinit(void); | 172 void xs_reinit(void); |
173 void xs_close(void); | 173 void xs_close(void); |
174 gint xs_is_our_file(gchar *); | 174 gint xs_is_our_file(gchar *); |
175 void xs_play_file(gchar *); | 175 void xs_play_file(gchar *); |
176 void xs_stop(void); | 176 void xs_stop(void); |
177 void xs_pause(short); | 177 void xs_pause(short); |
178 void xs_seek(gint); | 178 void xs_seek(gint); |
179 gint xs_get_time(void); | 179 gint xs_get_time(void); |
180 void xs_get_song_info(gchar *, gchar **, gint *); | 180 void xs_get_song_info(gchar *, gchar **, gint *); |
181 void xs_about(void); | 181 void xs_about(void); |
182 | 182 |
183 void xs_error(const char *, ...); | 183 void xs_error(const char *, ...); |
184 | 184 |
185 | 185 |
186 /* Debugging | 186 /* Debugging |
187 */ | 187 */ |
188 #ifndef DEBUG_NP | 188 #ifndef DEBUG_NP |
189 void XSDEBUG(const char *, ...); | 189 void XSDEBUG(const char *, ...); |
190 #else | 190 #else |
191 # ifdef DEBUG | 191 # ifdef DEBUG |
192 # define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } | 192 # define XSDEBUG(...) { fprintf(stderr, "XS[%s:%s:%d]: ", __FILE__, __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } |
193 # else | 193 # else |
194 # define XSDEBUG(...) /* stub */ | 194 # define XSDEBUG(...) /* stub */ |
196 #endif | 196 #endif |
197 | 197 |
198 | 198 |
199 /* And even some Gtk+ macro crap here, yay. | 199 /* And even some Gtk+ macro crap here, yay. |
200 */ | 200 */ |
201 #define XS_DEF_WINDOW_DELETE(ME, MV) \ | 201 #define XS_DEF_WINDOW_DELETE(ME, MV) \ |
202 gboolean xs_ ## ME ## _delete(GtkWidget *w, GdkEvent *e, gpointer d) { \ | 202 gboolean xs_ ## ME ## _delete(GtkWidget *w, GdkEvent *e, gpointer d) { \ |
203 (void) w; (void) e; (void) d; \ | 203 (void) w; (void) e; (void) d; \ |
204 if (xs_ ## MV ) { \ | 204 if (xs_ ## MV ) { \ |
205 gtk_widget_destroy(xs_ ## MV ); \ | 205 gtk_widget_destroy(xs_ ## MV ); \ |
206 xs_ ## MV = NULL; \ | 206 xs_ ## MV = NULL; \ |
207 } \ | 207 } \ |
208 return FALSE; \ | 208 return FALSE; \ |
209 } | 209 } |
210 | 210 |
211 #define XS_DEF_WINDOW_CLOSE(ME, MV) \ | 211 #define XS_DEF_WINDOW_CLOSE(ME, MV) \ |
212 void xs_ ## ME (GtkButton *b, gpointer d) { \ | 212 void xs_ ## ME (GtkButton *b, gpointer d) { \ |
213 (void) b; (void) d; \ | 213 (void) b; (void) d; \ |
214 gtk_widget_destroy(xs_ ## MV ); \ | 214 gtk_widget_destroy(xs_ ## MV ); \ |
215 xs_ ## MV = NULL; \ | 215 xs_ ## MV = NULL; \ |
216 } | 216 } |
217 | 217 |
218 #define XS_SIGNAL_CONNECT(SOBJ, SNAME, SFUNC, SDATA) \ | 218 #define XS_SIGNAL_CONNECT(SOBJ, SNAME, SFUNC, SDATA) \ |
219 gtk_signal_connect(GTK_OBJECT(SOBJ), SNAME, GTK_SIGNAL_FUNC(SFUNC), SDATA) | 219 gtk_signal_connect(GTK_OBJECT(SOBJ), SNAME, GTK_SIGNAL_FUNC(SFUNC), SDATA) |
220 | 220 |
221 #ifdef __cplusplus | 221 #ifdef __cplusplus |
222 } | 222 } |
223 #endif | 223 #endif |
224 #endif /* XMMS_SID_H */ | 224 #endif /* XMMS_SID_H */ |