Mercurial > audlegacy
annotate Plugins/Input/console/Audacious_Driver.cpp @ 334:0daaddb10914 trunk
[svn] Implement GYM playback.
author | chainsaw |
---|---|
date | Sun, 25 Dec 2005 13:31:46 -0800 |
parents | 1e642d74d68c |
children | b2335a7ec34a |
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 | |
309 if (audcfg.loop_length) | |
310 console_ip.set_info(name, audcfg.loop_length * 1000, | |
311 gym->voice_count() * 1000, samplerate, 2); | |
312 else | |
313 console_ip.set_info(name, -1, gym->voice_count() * 1000, | |
314 samplerate, 2); | |
315 | |
316 g_free(name); | |
317 | |
318 if (!console_ip.output->open_audio(MY_FMT, samplerate, 2)) | |
319 return; | |
320 | |
321 playing_type = PLAY_TYPE_GYM; | |
322 | |
323 decode_thread = g_thread_create(play_loop_gym, gym, TRUE, NULL); | |
324 } | |
325 | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
326 static void play_file(char *filename) |
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
327 { |
213 | 328 switch (is_our_file(filename)) |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
329 { |
213 | 330 case PLAY_TYPE_SPC: |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
331 play_file_spc(filename); |
213 | 332 break; |
333 case PLAY_TYPE_NSF: | |
334 play_file_nsf(filename); | |
335 break; | |
214 | 336 case PLAY_TYPE_GBS: |
337 play_file_gbs(filename); | |
338 break; | |
334 | 339 case PLAY_TYPE_GYM: |
340 play_file_gym(filename); | |
341 break; | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
342 } |
95 | 343 } |
344 | |
96 | 345 static void seek(gint time) |
346 { | |
347 // XXX: Not yet implemented | |
348 } | |
349 | |
350 InputPlugin console_ip = { | |
351 NULL, | |
352 NULL, | |
353 NULL, | |
354 console_init, | |
109 | 355 console_aboutbox, |
96 | 356 NULL, |
357 is_our_file, | |
358 NULL, | |
359 play_file, | |
360 console_stop, | |
361 console_pause, | |
362 seek, | |
363 NULL, | |
364 get_time, | |
365 NULL, | |
366 NULL, | |
367 NULL, | |
368 NULL, | |
369 NULL, | |
370 NULL, | |
371 NULL, | |
104 | 372 get_song_info, |
96 | 373 NULL, |
374 NULL | |
375 }; | |
376 | |
377 static void console_stop(void) | |
378 { | |
103 | 379 console_ip_is_going = FALSE; |
96 | 380 g_thread_join(decode_thread); |
381 console_ip.output->close_audio(); | |
382 } | |
383 | |
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
384 extern "C" InputPlugin *get_iplugin_info(void) |
96 | 385 { |
109 | 386 console_ip.description = g_strdup_printf(_("SPC, GYM, NSF, VGM and GBS module decoder")); |
96 | 387 return &console_ip; |
388 } | |
389 | |
390 static void console_pause(gshort p) | |
391 { | |
392 console_ip.output->pause(p); | |
393 } | |
394 | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
395 static void *play_loop_spc(gpointer arg) |
95 | 396 { |
213 | 397 g_static_mutex_lock(&playback_mutex); |
99 | 398 Spc_Emu *my_spc = (Spc_Emu *) arg; |
213 | 399 Music_Emu::sample_t buf[1024]; |
95 | 400 |
145 | 401 for (;;) |
402 { | |
403 if (!console_ip_is_going) | |
404 break; | |
405 | |
406 my_spc->play(1024, buf); | |
407 | |
408 if ((console_ip.output->output_time() / 1000) > | |
409 audcfg.loop_length && audcfg.loop_length != 0) | |
410 break; | |
100 | 411 console_ip.add_vis_pcm(console_ip.output->written_time(), |
108 | 412 MY_FMT, 1, 2048, buf); |
413 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
|
414 xmms_usleep(10000); |
108 | 415 console_ip.output->write_audio(buf, 2048); |
100 | 416 } |
95 | 417 |
96 | 418 delete spc; |
145 | 419 console_ip.output->close_audio(); |
420 console_ip_is_going = FALSE; | |
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
421 playing_type = PLAY_TYPE_NONE; |
213 | 422 g_static_mutex_unlock(&playback_mutex); |
423 g_thread_exit(NULL); | |
424 | |
425 return NULL; | |
426 } | |
427 | |
428 static void *play_loop_nsf(gpointer arg) | |
429 { | |
430 g_static_mutex_lock(&playback_mutex); | |
431 Nsf_Emu *my_nsf = (Nsf_Emu *) arg; | |
432 Music_Emu::sample_t buf[1024]; | |
433 | |
434 for (;;) | |
435 { | |
436 if (!console_ip_is_going) | |
437 break; | |
438 | |
439 my_nsf->play(1024, buf); | |
440 | |
441 if ((console_ip.output->output_time() / 1000) > | |
442 audcfg.loop_length && audcfg.loop_length != 0) | |
443 break; | |
444 console_ip.add_vis_pcm(console_ip.output->written_time(), | |
445 MY_FMT, 1, 2048, buf); | |
446 while(console_ip.output->buffer_free() < 2048) | |
447 xmms_usleep(10000); | |
448 console_ip.output->write_audio(buf, 2048); | |
449 } | |
450 | |
451 delete nsf; | |
452 console_ip.output->close_audio(); | |
453 console_ip_is_going = FALSE; | |
454 playing_type = PLAY_TYPE_NONE; | |
455 g_static_mutex_unlock(&playback_mutex); | |
96 | 456 g_thread_exit(NULL); |
95 | 457 |
96 | 458 return NULL; |
95 | 459 } |
460 | |
214 | 461 static void *play_loop_gbs(gpointer arg) |
462 { | |
463 g_static_mutex_lock(&playback_mutex); | |
464 Gbs_Emu *my_gbs = (Gbs_Emu *) arg; | |
465 Music_Emu::sample_t buf[1024]; | |
466 | |
467 for (;;) | |
468 { | |
469 if (!console_ip_is_going) | |
470 break; | |
471 | |
472 my_gbs->play(1024, buf); | |
473 | |
474 if ((console_ip.output->output_time() / 1000) > | |
475 audcfg.loop_length && audcfg.loop_length != 0) | |
476 break; | |
477 console_ip.add_vis_pcm(console_ip.output->written_time(), | |
478 MY_FMT, 1, 2048, buf); | |
479 while(console_ip.output->buffer_free() < 2048) | |
480 xmms_usleep(10000); | |
481 console_ip.output->write_audio(buf, 2048); | |
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; | |
510 console_ip.add_vis_pcm(console_ip.output->written_time(), | |
511 MY_FMT, 1, 2048, buf); | |
512 while(console_ip.output->buffer_free() < 2048) | |
513 xmms_usleep(10000); | |
514 console_ip.output->write_audio(buf, 2048); | |
515 } | |
516 | |
517 delete gym; | |
518 console_ip.output->close_audio(); | |
519 console_ip_is_going = FALSE; | |
520 playing_type = PLAY_TYPE_NONE; | |
521 g_static_mutex_unlock(&playback_mutex); | |
522 g_thread_exit(NULL); | |
523 | |
524 return NULL; | |
525 } | |
526 | |
96 | 527 static int get_time(void) |
528 { | |
145 | 529 if (console_ip_is_going == TRUE) |
530 return console_ip.output->output_time(); | |
531 else | |
532 return -1; | |
96 | 533 } |
95 | 534 |
100 | 535 static void console_init(void) |
536 { | |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
537 ConfigDb *db; |
100 | 538 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
539 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
|
540 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
541 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
|
542 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
|
543 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
|
544 |
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
545 bmp_cfg_db_close(db); |
100 | 546 } |
547 | |
109 | 548 extern "C" void console_aboutbox(void) |
549 { | |
550 xmms_show_message(_("About the Console Music Decoder"), | |
551 _("Console music decoder engine based on Game_Music_Emu 0.2.4.\n" | |
552 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>"), | |
553 _("Ok"), | |
554 FALSE, NULL, NULL); | |
555 } |