Mercurial > audlegacy
annotate Plugins/Input/console/Audacious_Driver.cpp @ 479:0b9507985f0d trunk
[svn] Use the VFS subsystem and delete the unused demo source.
| author | chainsaw |
|---|---|
| date | Sat, 21 Jan 2006 06:32:50 -0800 |
| parents | 8fc500c08b61 |
| children | bb3698dfd455 |
| 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" | |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
19 #include "libaudacious/vfs.h" |
| 145 | 20 #include "audacious/input.h" |
| 95 | 21 #include "audacious/output.h" |
| 288 | 22 #include "libaudcore/playback.h" |
| 94 | 23 |
|
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
24 }; |
|
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
25 |
| 145 | 26 struct AudaciousConsoleConfig audcfg = { 180, FALSE, 32000 }; |
| 27 | |
| 94 | 28 #include <cstring> |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
29 #include <cstdlib> |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
30 #include <cctype> |
| 94 | 31 |
| 32 static Spc_Emu *spc = NULL; | |
| 213 | 33 static Nsf_Emu *nsf = NULL; |
| 214 | 34 static Gbs_Emu *gbs = NULL; |
| 334 | 35 static Gym_Emu *gym = NULL; |
| 364 | 36 static Vgm_Emu *vgm = NULL; |
| 95 | 37 static GThread *decode_thread; |
| 213 | 38 GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT; |
| 95 | 39 |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
40 static void *play_loop_spc(gpointer arg); |
| 213 | 41 static void *play_loop_nsf(gpointer arg); |
| 214 | 42 static void *play_loop_gbs(gpointer arg); |
| 334 | 43 static void *play_loop_gym(gpointer arg); |
| 364 | 44 static void *play_loop_vgm(gpointer arg); |
| 100 | 45 static void console_init(void); |
| 109 | 46 extern "C" void console_aboutbox(void); |
| 96 | 47 static void console_stop(void); |
| 48 static void console_pause(gshort p); | |
| 49 static int get_time(void); | |
| 103 | 50 static gboolean console_ip_is_going; |
| 100 | 51 extern InputPlugin console_ip; |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
52 static int playing_type; |
| 100 | 53 |
| 94 | 54 static int is_our_file(gchar *filename) |
| 55 { | |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
56 VFSFile *file; |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
57 gchar magic[4]; |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
58 if (file = vfs_fopen(filename, "rb")) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
59 vfs_fread(magic, 1, 4, file); |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
60 if (!strncmp(magic, "SNES", 4)) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
61 vfs_fclose(file); |
| 213 | 62 return PLAY_TYPE_SPC; |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
63 } |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
64 if (!strncmp(magic, "NESM", 4)) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
65 vfs_fclose(file); |
| 213 | 66 return PLAY_TYPE_NSF; |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
67 } |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
68 if (!strncmp(magic, "GYMX", 4)) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
69 vfs_fclose(file); |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
70 return PLAY_TYPE_GYM; |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
71 } |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
72 if (!strncmp(magic, "GBS", 3)) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
73 vfs_fclose(file); |
| 214 | 74 return PLAY_TYPE_GBS; |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
75 } |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
76 if (!strncmp(magic, "Vgm", 3)) { |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
77 vfs_fclose(file); |
| 364 | 78 return PLAY_TYPE_VGM; |
|
366
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
79 } |
|
4a9139a7b53e
[svn] Use file magic instead of extensions (Phase 2).
chainsaw
parents:
365
diff
changeset
|
80 vfs_fclose(file); |
| 94 | 81 } |
| 82 return 0; | |
| 83 } | |
| 84 | |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
85 static gint strtoi(gchar *buf,size_t len) { |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
86 guint num = 0; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
87 while (len && isdigit(*buf)) { |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
88 num *= 10; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
89 num += *buf - '0'; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
90 buf++; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
91 len--; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
92 } |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
93 return num; |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
94 } |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
95 |
| 148 | 96 static gchar *get_title_spc(gchar *filename) |
| 94 | 97 { |
| 98 gchar *title; | |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
99 Spc_Reader reader; |
| 94 | 100 Spc_Emu::header_t header; |
| 101 | |
| 102 reader.open(filename); | |
| 103 reader.read(&header, sizeof(header)); | |
| 104 | |
|
363
eaaee9e0519c
[svn] Properly fall back to file name if the tag information is invalid (SPC).
chainsaw
parents:
362
diff
changeset
|
105 if (header.version > 10) |
| 104 | 106 { |
| 107 TitleInput *tinput; | |
| 108 | |
| 109 tinput = bmp_title_input_new(); | |
| 110 | |
|
421
147325df7461
[svn] SPC titleinput fix. Contributed by Kiyoshi Aman <kiyoshi.aman -at- gmail.com>.
nenolod
parents:
417
diff
changeset
|
111 tinput->performer = g_strdup(header.author); |
| 104 | 112 tinput->album_name = g_strdup(header.game); |
| 113 tinput->track_name = g_strdup(header.song); | |
| 94 | 114 |
| 104 | 115 tinput->file_name = g_path_get_basename(filename); |
| 116 tinput->file_path = g_path_get_dirname(filename); | |
| 117 | |
| 118 title = xmms_get_titlestring(xmms_get_gentitle_format(), | |
| 119 tinput); | |
| 120 | |
| 121 g_free(tinput); | |
| 122 } | |
| 123 else | |
| 213 | 124 title = g_path_get_basename(filename); |
| 125 | |
| 126 return title; | |
| 127 } | |
| 99 | 128 |
| 213 | 129 static gchar *get_title_nsf(gchar *filename) |
| 130 { | |
| 131 gchar *title; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
132 Nsf_Reader reader; |
| 473 | 133 Nsf_Emu::header_t header; |
| 134 | |
| 135 reader.open(filename); | |
| 136 reader.read(&header, sizeof(header)); | |
| 137 | |
| 138 if (header.game) | |
| 139 { | |
| 140 TitleInput *tinput; | |
| 141 | |
| 142 tinput = bmp_title_input_new(); | |
| 143 | |
| 144 tinput->performer = g_strdup(header.author); | |
| 145 tinput->album_name = g_strdup(header.copyright); | |
| 146 tinput->track_name = g_strdup(header.game); | |
| 147 | |
| 148 tinput->file_name = g_path_get_basename(filename); | |
| 149 tinput->file_path = g_path_get_dirname(filename); | |
| 150 | |
| 151 title = xmms_get_titlestring(xmms_get_gentitle_format(), | |
| 152 tinput); | |
| 153 | |
| 154 g_free(tinput); | |
| 155 } | |
| 156 else | |
| 157 title = g_path_get_basename(filename); | |
| 158 | |
| 94 | 159 return title; |
| 160 } | |
| 95 | 161 |
| 214 | 162 static gchar *get_title_gbs(gchar *filename) |
| 163 { | |
| 164 gchar *title; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
165 Gbs_Reader reader; |
|
472
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
166 Gbs_Emu::header_t header; |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
167 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
168 reader.open(filename); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
169 reader.read(&header, sizeof(header)); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
170 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
171 if (header.game) |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
172 { |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
173 TitleInput *tinput; |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
174 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
175 tinput = bmp_title_input_new(); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
176 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
177 tinput->performer = g_strdup(header.author); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
178 tinput->album_name = g_strdup(header.copyright); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
179 tinput->track_name = g_strdup(header.game); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
180 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
181 tinput->file_name = g_path_get_basename(filename); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
182 tinput->file_path = g_path_get_dirname(filename); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
183 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
184 title = xmms_get_titlestring(xmms_get_gentitle_format(), |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
185 tinput); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
186 |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
187 g_free(tinput); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
188 } |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
189 else |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
190 title = g_path_get_basename(filename); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
191 |
| 214 | 192 return title; |
| 193 } | |
| 194 | |
| 334 | 195 static gchar *get_title_gym(gchar *filename) |
| 196 { | |
| 197 gchar *title; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
198 Gym_Reader reader; |
| 365 | 199 Gym_Emu::header_t header; |
| 200 | |
| 201 reader.open(filename); | |
| 202 reader.read(&header, sizeof(header)); | |
| 203 | |
| 204 if (header.song) | |
| 205 { | |
| 206 TitleInput *tinput; | |
| 207 | |
| 208 tinput = bmp_title_input_new(); | |
| 209 | |
| 210 tinput->performer = g_strdup(header.game); | |
|
469
fc98032223d1
[svn] Simplify magic reader and get GYM tag reading right.
chainsaw
parents:
421
diff
changeset
|
211 tinput->album_name = g_strdup(header.copyright); |
| 365 | 212 tinput->track_name = g_strdup(header.song); |
| 213 | |
| 214 tinput->file_name = g_path_get_basename(filename); | |
| 215 tinput->file_path = g_path_get_dirname(filename); | |
| 216 | |
| 217 title = xmms_get_titlestring(xmms_get_gentitle_format(), | |
| 218 tinput); | |
| 219 | |
| 220 g_free(tinput); | |
| 221 } | |
| 222 else | |
| 223 title = g_path_get_basename(filename); | |
| 224 | |
| 334 | 225 return title; |
| 226 } | |
| 227 | |
| 364 | 228 static gchar *get_title_vgm(gchar *filename) |
| 229 { | |
| 230 gchar *title; | |
| 231 title = g_path_get_basename(filename); | |
| 232 return title; | |
| 233 } | |
| 234 | |
| 148 | 235 static gchar *get_title(gchar *filename) |
| 236 { | |
| 213 | 237 switch (is_our_file(filename)) |
| 148 | 238 { |
| 213 | 239 case PLAY_TYPE_SPC: |
| 148 | 240 return get_title_spc(filename); |
| 213 | 241 break; |
| 242 case PLAY_TYPE_NSF: | |
| 243 return get_title_nsf(filename); | |
| 244 break; | |
| 214 | 245 case PLAY_TYPE_GBS: |
| 246 return get_title_gbs(filename); | |
| 247 break; | |
| 334 | 248 case PLAY_TYPE_GYM: |
| 249 return get_title_gym(filename); | |
| 250 break; | |
| 364 | 251 case PLAY_TYPE_VGM: |
| 252 return get_title_vgm(filename); | |
| 253 break; | |
| 148 | 254 } |
| 255 | |
| 256 return NULL; | |
| 257 } | |
| 258 | |
| 95 | 259 static void get_song_info(char *filename, char **title, int *length) |
| 260 { | |
| 261 (*title) = get_title(filename); | |
| 145 | 262 |
| 263 if (audcfg.loop_length) | |
| 264 (*length) = audcfg.loop_length; | |
| 265 else | |
| 266 (*length) = -1; | |
| 95 | 267 } |
| 268 | |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
269 static void play_file_spc(char *filename) |
| 95 | 270 { |
|
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
271 gchar *name; |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
272 Spc_Reader reader; |
| 95 | 273 Spc_Emu::header_t header; |
| 149 | 274 gint samplerate; |
| 275 | |
| 276 if (audcfg.resample == TRUE) | |
| 277 samplerate = audcfg.resample_rate; | |
| 278 else | |
| 279 samplerate = Spc_Emu::native_sample_rate; | |
| 95 | 280 |
| 281 reader.open(filename); | |
| 282 reader.read(&header, sizeof(header)); | |
| 283 | |
| 284 spc = new Spc_Emu; | |
| 149 | 285 spc->init(samplerate); |
| 95 | 286 spc->load(header, reader); |
| 287 spc->start_track(0); | |
| 288 | |
| 103 | 289 console_ip_is_going = TRUE; |
| 290 | |
|
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
291 name = get_title(filename); |
|
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
292 |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
293 spc->length = strtoi(header.len_secs,3); |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
294 |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
295 if (spc->length > 0) |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
296 console_ip.set_info(name, spc->length * 1000, |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
297 spc->voice_count() * 1000, samplerate, 2); |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
298 else if (audcfg.loop_length) |
| 145 | 299 console_ip.set_info(name, audcfg.loop_length * 1000, |
| 149 | 300 spc->voice_count() * 1000, samplerate, 2); |
| 145 | 301 else |
| 149 | 302 console_ip.set_info(name, -1, spc->voice_count() * 1000, |
| 303 samplerate, 2); | |
|
106
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
304 |
|
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
305 g_free(name); |
|
d2b88d78ccd7
[svn] Tell the player that the decoder has fired up :)
nenolod
parents:
105
diff
changeset
|
306 |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
307 if (!console_ip.output->open_audio(FMT_S16_NE, samplerate, 2)) |
| 100 | 308 return; |
|
133
3fb426494de8
[svn] Open the output channel before firing up the thread.
nenolod
parents:
109
diff
changeset
|
309 |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
310 playing_type = PLAY_TYPE_SPC; |
|
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
311 |
|
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
312 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
|
313 } |
|
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
314 |
| 213 | 315 static void play_file_nsf(char *filename) |
| 316 { | |
| 317 gchar *name; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
318 Nsf_Reader reader; |
| 213 | 319 Nsf_Emu::header_t header; |
| 320 gint samplerate; | |
| 321 | |
| 322 if (audcfg.resample == TRUE) | |
| 323 samplerate = audcfg.resample_rate; | |
| 324 else | |
| 325 samplerate = 44100; | |
| 326 | |
| 327 reader.open(filename); | |
| 328 reader.read(&header, sizeof(header)); | |
| 329 | |
| 330 nsf = new Nsf_Emu; | |
| 331 nsf->init(samplerate); | |
| 332 nsf->load(header, reader); | |
| 333 nsf->start_track(0); | |
| 334 | |
| 335 console_ip_is_going = TRUE; | |
| 336 | |
| 337 name = get_title(filename); | |
| 338 | |
| 339 if (audcfg.loop_length) | |
| 340 console_ip.set_info(name, audcfg.loop_length * 1000, | |
| 341 nsf->voice_count() * 1000, samplerate, 2); | |
| 342 else | |
| 343 console_ip.set_info(name, -1, nsf->voice_count() * 1000, | |
| 344 samplerate, 2); | |
| 345 | |
| 346 g_free(name); | |
| 347 | |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
348 if (!console_ip.output->open_audio(FMT_S16_NE, samplerate, 2)) |
| 213 | 349 return; |
| 350 | |
| 351 playing_type = PLAY_TYPE_NSF; | |
| 352 | |
| 353 decode_thread = g_thread_create(play_loop_nsf, nsf, TRUE, NULL); | |
| 354 } | |
| 355 | |
| 214 | 356 static void play_file_gbs(char *filename) |
| 357 { | |
| 358 gchar *name; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
359 Gbs_Reader reader; |
| 214 | 360 Gbs_Emu::header_t header; |
| 361 gint samplerate; | |
| 362 | |
| 363 if (audcfg.resample == TRUE) | |
| 364 samplerate = audcfg.resample_rate; | |
| 365 else | |
| 366 samplerate = 44100; | |
| 367 | |
| 368 reader.open(filename); | |
| 369 reader.read(&header, sizeof(header)); | |
| 370 | |
| 371 gbs = new Gbs_Emu; | |
| 372 gbs->init(samplerate); | |
| 373 gbs->load(header, reader); | |
| 374 gbs->start_track(0); | |
| 375 | |
| 376 console_ip_is_going = TRUE; | |
| 377 | |
| 378 name = get_title(filename); | |
| 379 | |
| 380 if (audcfg.loop_length) | |
| 381 console_ip.set_info(name, audcfg.loop_length * 1000, | |
| 382 gbs->voice_count() * 1000, samplerate, 2); | |
| 383 else | |
| 334 | 384 console_ip.set_info(name, -1, gbs->voice_count() * 1000, |
| 214 | 385 samplerate, 2); |
| 386 | |
| 387 g_free(name); | |
| 388 | |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
389 if (!console_ip.output->open_audio(FMT_S16_NE, samplerate, 2)) |
| 214 | 390 return; |
| 391 | |
| 392 playing_type = PLAY_TYPE_GBS; | |
| 393 | |
| 394 decode_thread = g_thread_create(play_loop_gbs, gbs, TRUE, NULL); | |
| 395 } | |
| 396 | |
| 334 | 397 static void play_file_gym(char *filename) |
| 398 { | |
| 399 gchar *name; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
400 Gym_Reader reader; |
| 334 | 401 Gym_Emu::header_t header; |
| 402 gint samplerate; | |
| 403 | |
| 404 if (audcfg.resample == TRUE) | |
| 405 samplerate = audcfg.resample_rate; | |
| 406 else | |
| 407 samplerate = 44100; | |
| 408 | |
| 409 reader.open(filename); | |
| 410 reader.read(&header, sizeof(header)); | |
| 411 | |
| 412 gym = new Gym_Emu; | |
| 413 gym->init(samplerate); | |
| 414 gym->load(header, reader); | |
| 415 gym->start_track(0); | |
| 416 | |
| 417 console_ip_is_going = TRUE; | |
| 418 | |
| 419 name = get_title(filename); | |
| 420 | |
| 362 | 421 if (gym->track_length() > 0) |
| 422 console_ip.set_info(name, gym->track_length() * 1000, | |
| 423 gym->voice_count() * 1000, samplerate, 2); | |
| 424 else if (audcfg.loop_length) | |
| 334 | 425 console_ip.set_info(name, audcfg.loop_length * 1000, |
| 426 gym->voice_count() * 1000, samplerate, 2); | |
| 427 else | |
| 428 console_ip.set_info(name, -1, gym->voice_count() * 1000, | |
| 429 samplerate, 2); | |
| 430 | |
| 431 g_free(name); | |
| 432 | |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
433 if (!console_ip.output->open_audio(FMT_S16_NE, samplerate, 2)) |
| 334 | 434 return; |
| 435 | |
| 436 playing_type = PLAY_TYPE_GYM; | |
| 437 | |
| 438 decode_thread = g_thread_create(play_loop_gym, gym, TRUE, NULL); | |
| 439 } | |
| 440 | |
| 364 | 441 static void play_file_vgm(char *filename) |
| 442 { | |
| 443 gchar *name; | |
|
479
0b9507985f0d
[svn] Use the VFS subsystem and delete the unused demo source.
chainsaw
parents:
477
diff
changeset
|
444 Vgm_Reader reader; |
| 364 | 445 Vgm_Emu::header_t header; |
| 446 gint samplerate; | |
| 447 | |
| 448 if (audcfg.resample == TRUE) | |
| 449 samplerate = audcfg.resample_rate; | |
| 450 else | |
| 451 samplerate = 44100; | |
| 452 | |
| 453 reader.open(filename); | |
| 454 reader.read(&header, sizeof(header)); | |
| 455 | |
| 456 vgm = new Vgm_Emu; | |
| 457 vgm->init(samplerate); | |
| 458 vgm->load(header, reader); | |
| 459 vgm->start_track(0); | |
| 460 | |
| 461 console_ip_is_going = TRUE; | |
| 462 | |
| 463 name = get_title(filename); | |
| 464 | |
|
472
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
465 if (vgm->track_length() > 0) |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
466 console_ip.set_info(name, vgm->track_length() * 1000, |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
467 vgm->voice_count() * 1000, samplerate, 2); |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
468 else if (audcfg.loop_length) |
| 364 | 469 console_ip.set_info(name, audcfg.loop_length * 1000, |
| 470 vgm->voice_count() * 1000, samplerate, 2); | |
| 471 else | |
| 472 console_ip.set_info(name, -1, vgm->voice_count() * 1000, | |
| 473 samplerate, 2); | |
| 474 | |
| 475 g_free(name); | |
| 476 | |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
477 if (!console_ip.output->open_audio(FMT_S16_NE, samplerate, 2)) |
| 364 | 478 return; |
| 479 | |
| 480 playing_type = PLAY_TYPE_VGM; | |
| 481 | |
| 482 decode_thread = g_thread_create(play_loop_vgm, vgm, TRUE, NULL); | |
| 483 } | |
| 484 | |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
485 static void play_file(char *filename) |
|
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
486 { |
| 213 | 487 switch (is_our_file(filename)) |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
488 { |
| 213 | 489 case PLAY_TYPE_SPC: |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
490 play_file_spc(filename); |
| 213 | 491 break; |
| 492 case PLAY_TYPE_NSF: | |
| 493 play_file_nsf(filename); | |
| 494 break; | |
| 214 | 495 case PLAY_TYPE_GBS: |
| 496 play_file_gbs(filename); | |
| 497 break; | |
| 334 | 498 case PLAY_TYPE_GYM: |
| 499 play_file_gym(filename); | |
| 500 break; | |
| 364 | 501 case PLAY_TYPE_VGM: |
| 502 play_file_vgm(filename); | |
| 503 break; | |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
504 } |
| 95 | 505 } |
| 506 | |
| 96 | 507 static void seek(gint time) |
| 508 { | |
| 509 // XXX: Not yet implemented | |
| 510 } | |
| 511 | |
| 512 InputPlugin console_ip = { | |
| 513 NULL, | |
| 514 NULL, | |
| 515 NULL, | |
| 516 console_init, | |
| 109 | 517 console_aboutbox, |
| 96 | 518 NULL, |
| 519 is_our_file, | |
| 520 NULL, | |
| 521 play_file, | |
| 522 console_stop, | |
| 523 console_pause, | |
| 524 seek, | |
| 525 NULL, | |
| 526 get_time, | |
| 527 NULL, | |
| 528 NULL, | |
| 529 NULL, | |
| 530 NULL, | |
| 531 NULL, | |
| 532 NULL, | |
| 533 NULL, | |
| 104 | 534 get_song_info, |
| 96 | 535 NULL, |
| 536 NULL | |
| 537 }; | |
| 538 | |
| 539 static void console_stop(void) | |
| 540 { | |
| 103 | 541 console_ip_is_going = FALSE; |
| 96 | 542 g_thread_join(decode_thread); |
| 543 console_ip.output->close_audio(); | |
| 544 } | |
| 545 | |
|
98
e42694a28331
[svn] More progress -- now loads as an audacious module. :)
nenolod
parents:
96
diff
changeset
|
546 extern "C" InputPlugin *get_iplugin_info(void) |
| 96 | 547 { |
| 109 | 548 console_ip.description = g_strdup_printf(_("SPC, GYM, NSF, VGM and GBS module decoder")); |
| 96 | 549 return &console_ip; |
| 550 } | |
| 551 | |
| 552 static void console_pause(gshort p) | |
| 553 { | |
| 554 console_ip.output->pause(p); | |
| 555 } | |
| 556 | |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
557 static void *play_loop_spc(gpointer arg) |
| 95 | 558 { |
| 213 | 559 g_static_mutex_lock(&playback_mutex); |
| 99 | 560 Spc_Emu *my_spc = (Spc_Emu *) arg; |
| 213 | 561 Music_Emu::sample_t buf[1024]; |
| 95 | 562 |
| 145 | 563 for (;;) |
| 564 { | |
| 565 if (!console_ip_is_going) | |
| 566 break; | |
| 567 | |
| 568 my_spc->play(1024, buf); | |
| 569 | |
|
477
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
570 if ((console_ip.output->output_time() / 1000) > |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
571 spc->length && spc->length != 0) |
|
8fc500c08b61
[svn] SPC length detection c/o Kiyoshi Aman <kiyoshi.aman -at- gmail.com>
nenolod
parents:
473
diff
changeset
|
572 break; |
| 145 | 573 if ((console_ip.output->output_time() / 1000) > |
| 574 audcfg.loop_length && audcfg.loop_length != 0) | |
| 575 break; | |
| 349 | 576 produce_audio(console_ip.output->written_time(), |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
577 FMT_S16_NE, 1, 2048, buf, NULL); |
| 108 | 578 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
|
579 xmms_usleep(10000); |
| 100 | 580 } |
| 95 | 581 |
| 96 | 582 delete spc; |
| 145 | 583 console_ip.output->close_audio(); |
| 584 console_ip_is_going = FALSE; | |
|
147
6fe2bfbe6fc2
[svn] Move SPC-specific code into SPC-specific routines.
nenolod
parents:
146
diff
changeset
|
585 playing_type = PLAY_TYPE_NONE; |
| 213 | 586 g_static_mutex_unlock(&playback_mutex); |
| 587 g_thread_exit(NULL); | |
| 588 | |
| 589 return NULL; | |
| 590 } | |
| 591 | |
| 592 static void *play_loop_nsf(gpointer arg) | |
| 593 { | |
| 594 g_static_mutex_lock(&playback_mutex); | |
| 595 Nsf_Emu *my_nsf = (Nsf_Emu *) arg; | |
| 596 Music_Emu::sample_t buf[1024]; | |
| 597 | |
| 598 for (;;) | |
| 599 { | |
| 600 if (!console_ip_is_going) | |
| 601 break; | |
| 602 | |
| 603 my_nsf->play(1024, buf); | |
| 604 | |
| 605 if ((console_ip.output->output_time() / 1000) > | |
| 606 audcfg.loop_length && audcfg.loop_length != 0) | |
| 607 break; | |
| 349 | 608 produce_audio(console_ip.output->written_time(), |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
609 FMT_S16_NE, 1, 2048, buf, NULL); |
| 213 | 610 while(console_ip.output->buffer_free() < 2048) |
| 611 xmms_usleep(10000); | |
| 612 } | |
| 613 | |
| 614 delete nsf; | |
| 615 console_ip.output->close_audio(); | |
| 616 console_ip_is_going = FALSE; | |
| 617 playing_type = PLAY_TYPE_NONE; | |
| 618 g_static_mutex_unlock(&playback_mutex); | |
| 96 | 619 g_thread_exit(NULL); |
| 95 | 620 |
| 96 | 621 return NULL; |
| 95 | 622 } |
| 623 | |
| 214 | 624 static void *play_loop_gbs(gpointer arg) |
| 625 { | |
| 626 g_static_mutex_lock(&playback_mutex); | |
| 627 Gbs_Emu *my_gbs = (Gbs_Emu *) arg; | |
| 628 Music_Emu::sample_t buf[1024]; | |
| 629 | |
| 630 for (;;) | |
| 631 { | |
| 632 if (!console_ip_is_going) | |
| 633 break; | |
| 634 | |
| 635 my_gbs->play(1024, buf); | |
| 636 | |
| 637 if ((console_ip.output->output_time() / 1000) > | |
| 638 audcfg.loop_length && audcfg.loop_length != 0) | |
| 639 break; | |
| 349 | 640 produce_audio(console_ip.output->written_time(), |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
641 FMT_S16_NE, 1, 2048, buf, NULL); |
| 214 | 642 while(console_ip.output->buffer_free() < 2048) |
| 643 xmms_usleep(10000); | |
| 644 } | |
| 645 | |
| 646 delete gbs; | |
| 647 console_ip.output->close_audio(); | |
| 648 console_ip_is_going = FALSE; | |
| 649 playing_type = PLAY_TYPE_NONE; | |
| 650 g_static_mutex_unlock(&playback_mutex); | |
| 651 g_thread_exit(NULL); | |
| 652 | |
| 653 return NULL; | |
| 654 } | |
| 655 | |
| 334 | 656 static void *play_loop_gym(gpointer arg) |
| 657 { | |
| 658 g_static_mutex_lock(&playback_mutex); | |
| 659 Gym_Emu *my_gym = (Gym_Emu *) arg; | |
| 660 Music_Emu::sample_t buf[1024]; | |
| 661 | |
| 662 for (;;) | |
| 663 { | |
| 664 if (!console_ip_is_going) | |
| 665 break; | |
| 666 | |
| 667 my_gym->play(1024, buf); | |
| 668 | |
| 669 if ((console_ip.output->output_time() / 1000) > | |
|
371
e296500f595a
[svn] Stop GYM playback at the right time, if the length is known.
chainsaw
parents:
366
diff
changeset
|
670 gym->track_length() && gym->track_length() != 0) |
|
e296500f595a
[svn] Stop GYM playback at the right time, if the length is known.
chainsaw
parents:
366
diff
changeset
|
671 break; |
|
e296500f595a
[svn] Stop GYM playback at the right time, if the length is known.
chainsaw
parents:
366
diff
changeset
|
672 if ((console_ip.output->output_time() / 1000) > |
| 334 | 673 audcfg.loop_length && audcfg.loop_length != 0) |
| 674 break; | |
| 349 | 675 produce_audio(console_ip.output->written_time(), |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
676 FMT_S16_NE, 1, 2048, buf, NULL); |
| 334 | 677 while(console_ip.output->buffer_free() < 2048) |
| 678 xmms_usleep(10000); | |
| 679 } | |
| 680 | |
| 681 delete gym; | |
| 682 console_ip.output->close_audio(); | |
| 683 console_ip_is_going = FALSE; | |
| 684 playing_type = PLAY_TYPE_NONE; | |
| 685 g_static_mutex_unlock(&playback_mutex); | |
| 686 g_thread_exit(NULL); | |
| 687 | |
| 688 return NULL; | |
| 689 } | |
| 690 | |
| 364 | 691 static void *play_loop_vgm(gpointer arg) |
| 692 { | |
| 693 g_static_mutex_lock(&playback_mutex); | |
| 694 Vgm_Emu *my_vgm = (Vgm_Emu *) arg; | |
| 695 Music_Emu::sample_t buf[1024]; | |
| 696 | |
| 697 for (;;) | |
| 698 { | |
| 699 if (!console_ip_is_going) | |
| 700 break; | |
| 701 | |
| 702 my_vgm->play(1024, buf); | |
| 703 | |
| 704 if ((console_ip.output->output_time() / 1000) > | |
|
472
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
705 vgm->track_length() && vgm->track_length() != 0) |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
706 break; |
|
98ebf4727a64
[svn] Length detection for VGM; tag reading for GBS.
chainsaw
parents:
469
diff
changeset
|
707 if ((console_ip.output->output_time() / 1000) > |
| 364 | 708 audcfg.loop_length && audcfg.loop_length != 0) |
| 709 break; | |
| 710 produce_audio(console_ip.output->written_time(), | |
|
417
8ddd961ef0ff
[svn] Use FMT_S16_NE instead of unnecessary #ifdef WORDS_BIGENDIAN trickery.
chainsaw
parents:
371
diff
changeset
|
711 FMT_S16_NE, 1, 2048, buf, NULL); |
| 364 | 712 while(console_ip.output->buffer_free() < 2048) |
| 713 xmms_usleep(10000); | |
| 714 } | |
| 715 | |
| 716 delete vgm; | |
| 717 console_ip.output->close_audio(); | |
| 718 console_ip_is_going = FALSE; | |
| 719 playing_type = PLAY_TYPE_NONE; | |
| 720 g_static_mutex_unlock(&playback_mutex); | |
| 721 g_thread_exit(NULL); | |
| 722 | |
| 723 return NULL; | |
| 724 } | |
| 725 | |
| 96 | 726 static int get_time(void) |
| 727 { | |
| 145 | 728 if (console_ip_is_going == TRUE) |
| 729 return console_ip.output->output_time(); | |
| 730 else | |
| 731 return -1; | |
| 96 | 732 } |
| 95 | 733 |
| 100 | 734 static void console_init(void) |
| 735 { | |
|
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
736 ConfigDb *db; |
| 100 | 737 |
|
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
738 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
|
739 |
|
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
740 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
|
741 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
|
742 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
|
743 |
|
319
1e642d74d68c
[svn] Do not abort if libmpc is not found, just disable musepack plugin.
chainsaw
parents:
288
diff
changeset
|
744 bmp_cfg_db_close(db); |
| 100 | 745 } |
| 746 | |
| 109 | 747 extern "C" void console_aboutbox(void) |
| 748 { | |
| 749 xmms_show_message(_("About the Console Music Decoder"), | |
| 750 _("Console music decoder engine based on Game_Music_Emu 0.2.4.\n" | |
| 751 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>"), | |
| 752 _("Ok"), | |
| 753 FALSE, NULL, NULL); | |
| 754 } |
