Mercurial > audlegacy
annotate Plugins/Input/console/Audacious_Driver.cpp @ 362:2101285b753a trunk
[svn] Length detection for GYM.
author | chainsaw |
---|---|
date | Sat, 31 Dec 2005 12:04:53 -0800 |
parents | f13ab2d8e9cf |
children | eaaee9e0519c |
rev | line source |
---|---|
90
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
1 /* |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
2 * Audacious: Cross platform multimedia player |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
3 * Copyright (c) 2005 Audacious Team |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
4 * |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
5 * Driver for Game_Music_Emu library. See details at: |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
6 * http://www.slack.net/~ant/libs/ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
7 */ |
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
8 |
94 | 9 #include "Audacious_Driver.h" |
90
252843aac42f
[svn] Import the initial sources for console music support.
nenolod
parents:
diff
changeset
|
10 |
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
11 extern "C" { |
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
12 |
109 | 13 #include <glib.h> |
96 | 14 #include <glib/gi18n.h> |
109 | 15 #include <gtk/gtk.h> |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
16 #include "libaudacious/configdb.h" |
94 | 17 #include "libaudacious/util.h" |
18 #include "libaudacious/titlestring.h" | |
145 | 19 #include "audacious/input.h" |
95 | 20 #include "audacious/output.h" |
288 | 21 #include "libaudcore/playback.h" |
94 | 22 |
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
23 }; |
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
24 |
145 | 25 struct AudaciousConsoleConfig audcfg = { 180, FALSE, 32000 }; |
26 | |
94 | 27 #include <cstring> |
213 | 28 #include <stdio.h> |
94 | 29 |
101
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
30 #ifdef WORDS_BIGENDIAN |
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
31 # define MY_FMT FMT_S16_BE |
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
32 #else |
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
33 # define MY_FMT FMT_S16_LE |
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
34 #endif |
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
35 |
94 | 36 static Spc_Emu *spc = NULL; |
213 | 37 static Nsf_Emu *nsf = NULL; |
214 | 38 static Gbs_Emu *gbs = NULL; |
334 | 39 static Gym_Emu *gym = NULL; |
95 | 40 static GThread *decode_thread; |
213 | 41 GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT; |
95 | 42 |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
43 static void *play_loop_spc(gpointer arg); |
213 | 44 static void *play_loop_nsf(gpointer arg); |
214 | 45 static void *play_loop_gbs(gpointer arg); |
334 | 46 static void *play_loop_gym(gpointer arg); |
100 | 47 static void console_init(void); |
109 | 48 extern "C" void console_aboutbox(void); |
96 | 49 static void console_stop(void); |
50 static void console_pause(gshort p); | |
51 static int get_time(void); | |
103 | 52 static gboolean console_ip_is_going; |
100 | 53 extern InputPlugin console_ip; |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
54 static int playing_type; |
100 | 55 |
94 | 56 static int is_our_file(gchar *filename) |
57 { | |
58 gchar *ext; | |
59 | |
60 ext = strrchr(filename, '.'); | |
61 | |
62 if (ext) | |
63 { | |
64 if (!strcasecmp(ext, ".spc")) | |
213 | 65 return PLAY_TYPE_SPC; |
66 if (!strcasecmp(ext, ".nsf")) | |
67 return PLAY_TYPE_NSF; | |
214 | 68 if (!strcasecmp(ext, ".gbs")) |
69 return PLAY_TYPE_GBS; | |
334 | 70 if (!strcasecmp(ext, ".gym")) |
71 return PLAY_TYPE_GYM; | |
94 | 72 } |
73 | |
74 return 0; | |
75 } | |
76 | |
148 | 77 static gchar *get_title_spc(gchar *filename) |
94 | 78 { |
79 gchar *title; | |
80 Emu_Std_Reader reader; | |
81 Spc_Emu::header_t header; | |
82 | |
83 reader.open(filename); | |
84 reader.read(&header, sizeof(header)); | |
85 | |
104 | 86 if (header.song) |
87 { | |
88 TitleInput *tinput; | |
89 | |
90 tinput = bmp_title_input_new(); | |
91 | |
105
18fe59468510
[svn] Use header.game, over header.author, as most SPC files do not contain the composer information.
nenolod
parents:
104
diff
changeset
|
92 tinput->performer = g_strdup(header.game); |
104 | 93 tinput->album_name = g_strdup(header.game); |
94 tinput->track_name = g_strdup(header.song); | |
94 | 95 |
104 | 96 tinput->file_name = g_path_get_basename(filename); |
97 tinput->file_path = g_path_get_dirname(filename); | |
98 | |
99 title = xmms_get_titlestring(xmms_get_gentitle_format(), | |
100 tinput); | |
101 | |
102 g_free(tinput); | |
103 } | |
104 else | |
213 | 105 title = g_path_get_basename(filename); |
106 | |
107 return title; | |
108 } | |
99 | 109 |
213 | 110 static gchar *get_title_nsf(gchar *filename) |
111 { | |
112 gchar *title; | |
113 title = g_path_get_basename(filename); | |
94 | 114 return title; |
115 } | |
95 | 116 |
214 | 117 static gchar *get_title_gbs(gchar *filename) |
118 { | |
119 gchar *title; | |
120 title = g_path_get_basename(filename); | |
121 return title; | |
122 } | |
123 | |
334 | 124 static gchar *get_title_gym(gchar *filename) |
125 { | |
126 gchar *title; | |
127 title = g_path_get_basename(filename); | |
128 return title; | |
129 } | |
130 | |
148 | 131 static gchar *get_title(gchar *filename) |
132 { | |
213 | 133 switch (is_our_file(filename)) |
148 | 134 { |
213 | 135 case PLAY_TYPE_SPC: |
148 | 136 return get_title_spc(filename); |
213 | 137 break; |
138 case PLAY_TYPE_NSF: | |
139 return get_title_nsf(filename); | |
140 break; | |
214 | 141 case PLAY_TYPE_GBS: |
142 return get_title_gbs(filename); | |
143 break; | |
334 | 144 case PLAY_TYPE_GYM: |
145 return get_title_gym(filename); | |
146 break; | |
148 | 147 } |
148 | |
149 return NULL; | |
150 } | |
151 | |
95 | 152 static void get_song_info(char *filename, char **title, int *length) |
153 { | |
154 (*title) = get_title(filename); | |
145 | 155 |
156 if (audcfg.loop_length) | |
157 (*length) = audcfg.loop_length; | |
158 else | |
159 (*length) = -1; | |
95 | 160 } |
161 | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
162 static void play_file_spc(char *filename) |
95 | 163 { |
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
164 gchar *name; |
95 | 165 Emu_Std_Reader reader; |
166 Spc_Emu::header_t header; | |
149 | 167 gint samplerate; |
168 | |
169 if (audcfg.resample == TRUE) | |
170 samplerate = audcfg.resample_rate; | |
171 else | |
172 samplerate = Spc_Emu::native_sample_rate; | |
95 | 173 |
174 reader.open(filename); | |
175 reader.read(&header, sizeof(header)); | |
176 | |
177 spc = new Spc_Emu; | |
149 | 178 spc->init(samplerate); |
95 | 179 spc->load(header, reader); |
180 spc->start_track(0); | |
181 | |
103 | 182 console_ip_is_going = TRUE; |
183 | |
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
184 name = get_title(filename); |
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
185 |
145 | 186 if (audcfg.loop_length) |
187 console_ip.set_info(name, audcfg.loop_length * 1000, | |
149 | 188 spc->voice_count() * 1000, samplerate, 2); |
145 | 189 else |
149 | 190 console_ip.set_info(name, -1, spc->voice_count() * 1000, |
191 samplerate, 2); | |
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
192 |
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
193 g_free(name); |
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
194 |
149 | 195 if (!console_ip.output->open_audio(MY_FMT, samplerate, 2)) |
100 | 196 return; |
133
3fb426494de8
[svn] Open the output channel before firing up the thread.
nenolod
parents:
109
diff
changeset
|
197 |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
198 playing_type = PLAY_TYPE_SPC; |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
199 |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
200 decode_thread = g_thread_create(play_loop_spc, spc, TRUE, NULL); |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
201 } |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
202 |
213 | 203 static void play_file_nsf(char *filename) |
204 { | |
205 gchar *name; | |
206 Emu_Std_Reader reader; | |
207 Nsf_Emu::header_t header; | |
208 gint samplerate; | |
209 | |
210 if (audcfg.resample == TRUE) | |
211 samplerate = audcfg.resample_rate; | |
212 else | |
213 samplerate = 44100; | |
214 | |
215 reader.open(filename); | |
216 reader.read(&header, sizeof(header)); | |
217 | |
218 nsf = new Nsf_Emu; | |
219 nsf->init(samplerate); | |
220 nsf->load(header, reader); | |
221 nsf->start_track(0); | |
222 | |
223 console_ip_is_going = TRUE; | |
224 | |
225 name = get_title(filename); | |
226 | |
227 if (audcfg.loop_length) | |
228 console_ip.set_info(name, audcfg.loop_length * 1000, | |
229 nsf->voice_count() * 1000, samplerate, 2); | |
230 else | |
231 console_ip.set_info(name, -1, nsf->voice_count() * 1000, | |
232 samplerate, 2); | |
233 | |
234 g_free(name); | |
235 | |
236 if (!console_ip.output->open_audio(MY_FMT, samplerate, 2)) | |
237 return; | |
238 | |
239 playing_type = PLAY_TYPE_NSF; | |
240 | |
241 decode_thread = g_thread_create(play_loop_nsf, nsf, TRUE, NULL); | |
242 } | |
243 | |
214 | 244 static void play_file_gbs(char *filename) |
245 { | |
246 gchar *name; | |
247 Emu_Std_Reader reader; | |
248 Gbs_Emu::header_t header; | |
249 gint samplerate; | |
250 | |
251 if (audcfg.resample == TRUE) | |
252 samplerate = audcfg.resample_rate; | |
253 else | |
254 samplerate = 44100; | |
255 | |
256 reader.open(filename); | |
257 reader.read(&header, sizeof(header)); | |
258 | |
259 gbs = new Gbs_Emu; | |
260 gbs->init(samplerate); | |
261 gbs->load(header, reader); | |
262 gbs->start_track(0); | |
263 | |
264 console_ip_is_going = TRUE; | |
265 | |
266 name = get_title(filename); | |
267 | |
268 if (audcfg.loop_length) | |
269 console_ip.set_info(name, audcfg.loop_length * 1000, | |
270 gbs->voice_count() * 1000, samplerate, 2); | |
271 else | |
334 | 272 console_ip.set_info(name, -1, gbs->voice_count() * 1000, |
214 | 273 samplerate, 2); |
274 | |
275 g_free(name); | |
276 | |
277 if (!console_ip.output->open_audio(MY_FMT, samplerate, 2)) | |
278 return; | |
279 | |
280 playing_type = PLAY_TYPE_GBS; | |
281 | |
282 decode_thread = g_thread_create(play_loop_gbs, gbs, TRUE, NULL); | |
283 } | |
284 | |
334 | 285 static void play_file_gym(char *filename) |
286 { | |
287 gchar *name; | |
288 Emu_Std_Reader reader; | |
289 Gym_Emu::header_t header; | |
290 gint samplerate; | |
291 | |
292 if (audcfg.resample == TRUE) | |
293 samplerate = audcfg.resample_rate; | |
294 else | |
295 samplerate = 44100; | |
296 | |
297 reader.open(filename); | |
298 reader.read(&header, sizeof(header)); | |
299 | |
300 gym = new Gym_Emu; | |
301 gym->init(samplerate); | |
302 gym->load(header, reader); | |
303 gym->start_track(0); | |
304 | |
305 console_ip_is_going = TRUE; | |
306 | |
307 name = get_title(filename); | |
308 | |
362 | 309 if (gym->track_length() > 0) |
310 console_ip.set_info(name, gym->track_length() * 1000, | |
311 gym->voice_count() * 1000, samplerate, 2); | |
312 else if (audcfg.loop_length) | |
334 | 313 console_ip.set_info(name, audcfg.loop_length * 1000, |
314 gym->voice_count() * 1000, samplerate, 2); | |
315 else | |
316 console_ip.set_info(name, -1, gym->voice_count() * 1000, | |
317 samplerate, 2); | |
318 | |
319 g_free(name); | |
320 | |
321 if (!console_ip.output->open_audio(MY_FMT, samplerate, 2)) | |
322 return; | |
323 | |
324 playing_type = PLAY_TYPE_GYM; | |
325 | |
326 decode_thread = g_thread_create(play_loop_gym, gym, TRUE, NULL); | |
327 } | |
328 | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
329 static void play_file(char *filename) |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
330 { |
213 | 331 switch (is_our_file(filename)) |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
332 { |
213 | 333 case PLAY_TYPE_SPC: |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
334 play_file_spc(filename); |
213 | 335 break; |
336 case PLAY_TYPE_NSF: | |
337 play_file_nsf(filename); | |
338 break; | |
214 | 339 case PLAY_TYPE_GBS: |
340 play_file_gbs(filename); | |
341 break; | |
334 | 342 case PLAY_TYPE_GYM: |
343 play_file_gym(filename); | |
344 break; | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
345 } |
95 | 346 } |
347 | |
96 | 348 static void seek(gint time) |
349 { | |
350 // XXX: Not yet implemented | |
351 } | |
352 | |
353 InputPlugin console_ip = { | |
354 NULL, | |
355 NULL, | |
356 NULL, | |
357 console_init, | |
109 | 358 console_aboutbox, |
96 | 359 NULL, |
360 is_our_file, | |
361 NULL, | |
362 play_file, | |
363 console_stop, | |
364 console_pause, | |
365 seek, | |
366 NULL, | |
367 get_time, | |
368 NULL, | |
369 NULL, | |
370 NULL, | |
371 NULL, | |
372 NULL, | |
373 NULL, | |
374 NULL, | |
104 | 375 get_song_info, |
96 | 376 NULL, |
377 NULL | |
378 }; | |
379 | |
380 static void console_stop(void) | |
381 { | |
103 | 382 console_ip_is_going = FALSE; |
96 | 383 g_thread_join(decode_thread); |
384 console_ip.output->close_audio(); | |
385 } | |
386 | |
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
387 extern "C" InputPlugin *get_iplugin_info(void) |
96 | 388 { |
109 | 389 console_ip.description = g_strdup_printf(_("SPC, GYM, NSF, VGM and GBS module decoder")); |
96 | 390 return &console_ip; |
391 } | |
392 | |
393 static void console_pause(gshort p) | |
394 { | |
395 console_ip.output->pause(p); | |
396 } | |
397 | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
398 static void *play_loop_spc(gpointer arg) |
95 | 399 { |
213 | 400 g_static_mutex_lock(&playback_mutex); |
99 | 401 Spc_Emu *my_spc = (Spc_Emu *) arg; |
213 | 402 Music_Emu::sample_t buf[1024]; |
95 | 403 |
145 | 404 for (;;) |
405 { | |
406 if (!console_ip_is_going) | |
407 break; | |
408 | |
409 my_spc->play(1024, buf); | |
410 | |
411 if ((console_ip.output->output_time() / 1000) > | |
412 audcfg.loop_length && audcfg.loop_length != 0) | |
413 break; | |
349 | 414 produce_audio(console_ip.output->written_time(), |
352 | 415 MY_FMT, 1, 2048, buf, NULL); |
108 | 416 while(console_ip.output->buffer_free() < 2048) |
101
59ba6595fdf1
[svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents:
100
diff
changeset
|
417 xmms_usleep(10000); |
100 | 418 } |
95 | 419 |
96 | 420 delete spc; |
145 | 421 console_ip.output->close_audio(); |
422 console_ip_is_going = FALSE; | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
423 playing_type = PLAY_TYPE_NONE; |
213 | 424 g_static_mutex_unlock(&playback_mutex); |
425 g_thread_exit(NULL); | |
426 | |
427 return NULL; | |
428 } | |
429 | |
430 static void *play_loop_nsf(gpointer arg) | |
431 { | |
432 g_static_mutex_lock(&playback_mutex); | |
433 Nsf_Emu *my_nsf = (Nsf_Emu *) arg; | |
434 Music_Emu::sample_t buf[1024]; | |
435 | |
436 for (;;) | |
437 { | |
438 if (!console_ip_is_going) | |
439 break; | |
440 | |
441 my_nsf->play(1024, buf); | |
442 | |
443 if ((console_ip.output->output_time() / 1000) > | |
444 audcfg.loop_length && audcfg.loop_length != 0) | |
445 break; | |
349 | 446 produce_audio(console_ip.output->written_time(), |
352 | 447 MY_FMT, 1, 2048, buf, NULL); |
213 | 448 while(console_ip.output->buffer_free() < 2048) |
449 xmms_usleep(10000); | |
450 } | |
451 | |
452 delete nsf; | |
453 console_ip.output->close_audio(); | |
454 console_ip_is_going = FALSE; | |
455 playing_type = PLAY_TYPE_NONE; | |
456 g_static_mutex_unlock(&playback_mutex); | |
96 | 457 g_thread_exit(NULL); |
95 | 458 |
96 | 459 return NULL; |
95 | 460 } |
461 | |
214 | 462 static void *play_loop_gbs(gpointer arg) |
463 { | |
464 g_static_mutex_lock(&playback_mutex); | |
465 Gbs_Emu *my_gbs = (Gbs_Emu *) arg; | |
466 Music_Emu::sample_t buf[1024]; | |
467 | |
468 for (;;) | |
469 { | |
470 if (!console_ip_is_going) | |
471 break; | |
472 | |
473 my_gbs->play(1024, buf); | |
474 | |
475 if ((console_ip.output->output_time() / 1000) > | |
476 audcfg.loop_length && audcfg.loop_length != 0) | |
477 break; | |
349 | 478 produce_audio(console_ip.output->written_time(), |
352 | 479 MY_FMT, 1, 2048, buf, NULL); |
214 | 480 while(console_ip.output->buffer_free() < 2048) |
481 xmms_usleep(10000); | |
482 } | |
483 | |
484 delete gbs; | |
485 console_ip.output->close_audio(); | |
486 console_ip_is_going = FALSE; | |
487 playing_type = PLAY_TYPE_NONE; | |
488 g_static_mutex_unlock(&playback_mutex); | |
489 g_thread_exit(NULL); | |
490 | |
491 return NULL; | |
492 } | |
493 | |
334 | 494 static void *play_loop_gym(gpointer arg) |
495 { | |
496 g_static_mutex_lock(&playback_mutex); | |
497 Gym_Emu *my_gym = (Gym_Emu *) arg; | |
498 Music_Emu::sample_t buf[1024]; | |
499 | |
500 for (;;) | |
501 { | |
502 if (!console_ip_is_going) | |
503 break; | |
504 | |
505 my_gym->play(1024, buf); | |
506 | |
507 if ((console_ip.output->output_time() / 1000) > | |
508 audcfg.loop_length && audcfg.loop_length != 0) | |
509 break; | |
349 | 510 produce_audio(console_ip.output->written_time(), |
352 | 511 MY_FMT, 1, 2048, buf, NULL); |
334 | 512 while(console_ip.output->buffer_free() < 2048) |
513 xmms_usleep(10000); | |
514 } | |
515 | |
516 delete gym; | |
517 console_ip.output->close_audio(); | |
518 console_ip_is_going = FALSE; | |
519 playing_type = PLAY_TYPE_NONE; | |
520 g_static_mutex_unlock(&playback_mutex); | |
521 g_thread_exit(NULL); | |
522 | |
523 return NULL; | |
524 } | |
525 | |
96 | 526 static int get_time(void) |
527 { | |
145 | 528 if (console_ip_is_going == TRUE) |
529 return console_ip.output->output_time(); | |
530 else | |
531 return -1; | |
96 | 532 } |
95 | 533 |
100 | 534 static void console_init(void) |
535 { | |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
536 ConfigDb *db; |
100 | 537 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
538 db = bmp_cfg_db_open(); |
150
1997ecd9dcb1
[svn] Add ability to override defaults via .audacious/config until we can get a GUI.
nenolod
parents:
149
diff
changeset
|
539 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
540 bmp_cfg_db_get_int(db, "console", "loop_length", &audcfg.loop_length); |
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
541 bmp_cfg_db_get_bool(db, "console", "resample", &audcfg.resample); |
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
542 bmp_cfg_db_get_int(db, "console", "resample_rate", &audcfg.resample_rate); |
150
1997ecd9dcb1
[svn] Add ability to override defaults via .audacious/config until we can get a GUI.
nenolod
parents:
149
diff
changeset
|
543 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
544 bmp_cfg_db_close(db); |
100 | 545 } |
546 | |
109 | 547 extern "C" void console_aboutbox(void) |
548 { | |
549 xmms_show_message(_("About the Console Music Decoder"), | |
550 _("Console music decoder engine based on Game_Music_Emu 0.2.4.\n" | |
551 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>"), | |
552 _("Ok"), | |
553 FALSE, NULL, NULL); | |
554 } |