annotate Plugins/Input/console/Audacious_Driver.cpp @ 145:8794a4781a15 trunk

[svn] looping stuff
author nenolod
date Thu, 10 Nov 2005 17:51:04 -0800
parents 3fb426494de8
children 4309d2df6586
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
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
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
13 #include <glib.h>
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
14 #include <glib/gi18n.h>
109
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
15 #include <gtk/gtk.h>
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
16 #include "libaudacious/configfile.h"
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
17 #include "libaudacious/util.h"
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
18 #include "libaudacious/titlestring.h"
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
19 #include "audacious/input.h"
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
20 #include "audacious/output.h"
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
21 #include "audacious/playback.h"
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
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
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
25 struct AudaciousConsoleConfig audcfg = { 180, FALSE, 32000 };
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
26
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
27 #include <cstring>
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
28
101
59ba6595fdf1 [svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents: 100
diff changeset
29 #ifdef WORDS_BIGENDIAN
59ba6595fdf1 [svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents: 100
diff changeset
30 # 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
31 #else
59ba6595fdf1 [svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents: 100
diff changeset
32 # 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
33 #endif
59ba6595fdf1 [svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents: 100
diff changeset
34
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
35 static Spc_Emu *spc = NULL;
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
36 static GThread *decode_thread;
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
37
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
38 static void *play_loop(gpointer arg);
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
39 static void console_init(void);
109
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
40 extern "C" void console_aboutbox(void);
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
41 static void console_stop(void);
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
42 static void console_pause(gshort p);
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
43 static int get_time(void);
103
948027ac55be [svn] Stop playback when requested to by user.
nenolod
parents: 102
diff changeset
44 static gboolean console_ip_is_going;
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
45 extern InputPlugin console_ip;
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
46
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
47 static int is_our_file(gchar *filename)
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
48 {
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
49 gchar *ext;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
50
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
51 ext = strrchr(filename, '.');
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
52
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
53 if (ext)
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
54 {
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
55 if (!strcasecmp(ext, ".spc"))
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
56 return 1;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
57 }
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
58
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
59 return 0;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
60 }
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
61
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
62 static gchar *get_title(gchar *filename)
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
63 {
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
64 gchar *title;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
65 Emu_Std_Reader reader;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
66 Spc_Emu::header_t header;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
67
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
68 reader.open(filename);
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
69 reader.read(&header, sizeof(header));
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
70
104
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
71 if (header.song)
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
72 {
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
73 TitleInput *tinput;
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
74
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
75 tinput = bmp_title_input_new();
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
76
105
18fe59468510 [svn] Use header.game, over header.author, as most SPC files do not contain the composer information.
nenolod
parents: 104
diff changeset
77 tinput->performer = g_strdup(header.game);
104
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
78 tinput->album_name = g_strdup(header.game);
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
79 tinput->track_name = g_strdup(header.song);
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
80
104
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
81 tinput->file_name = g_path_get_basename(filename);
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
82 tinput->file_path = g_path_get_dirname(filename);
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
83
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
84 title = xmms_get_titlestring(xmms_get_gentitle_format(),
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
85 tinput);
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
86
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
87 g_free(tinput);
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
88 }
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
89 else
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
90 title = g_strdup(filename);
99
4b2b964a7694 [svn] What i have right now is this.
nenolod
parents: 98
diff changeset
91
94
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
92 return title;
2801eda0683f [svn] Some routines here. Hehe.
nenolod
parents: 90
diff changeset
93 }
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
94
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
95 static void get_song_info(char *filename, char **title, int *length)
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
96 {
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
97 (*title) = get_title(filename);
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
98
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
99 if (audcfg.loop_length)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
100 (*length) = audcfg.loop_length;
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
101 else
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
102 (*length) = -1;
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
103 }
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
104
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
105 static void play_file(char *filename)
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
106 {
106
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
107 gchar *name;
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
108 Emu_Std_Reader reader;
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
109 Spc_Emu::header_t header;
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
110
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
111 reader.open(filename);
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
112 reader.read(&header, sizeof(header));
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
113
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
114 spc = new Spc_Emu;
101
59ba6595fdf1 [svn] More accurate sound reproduction, but there is warbling. Still locks up player on completion.
nenolod
parents: 100
diff changeset
115 spc->init(32000);
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
116 spc->load(header, reader);
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
117 spc->start_track(0);
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
118
103
948027ac55be [svn] Stop playback when requested to by user.
nenolod
parents: 102
diff changeset
119 console_ip_is_going = TRUE;
948027ac55be [svn] Stop playback when requested to by user.
nenolod
parents: 102
diff changeset
120
106
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
121 name = get_title(filename);
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
122
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
123 if (audcfg.loop_length)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
124 console_ip.set_info(name, audcfg.loop_length * 1000,
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
125 spc->voice_count(), 32000, 2);
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
126 else
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
127 console_ip.set_info(name, -1, spc->voice_count(), 32000, 2);
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
128
106
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
129
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
130 g_free(name);
d2b88d78ccd7 [svn] Tell the player that the decoder has fired up :)
nenolod
parents: 105
diff changeset
131
102
de414e40f772 [svn] Normal sound decoding, now to just figure out how to stop the decode_thread when we need to.
nenolod
parents: 101
diff changeset
132 if (!console_ip.output->open_audio(MY_FMT, 32000, 2))
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
133 return;
133
3fb426494de8 [svn] Open the output channel before firing up the thread.
nenolod
parents: 109
diff changeset
134
3fb426494de8 [svn] Open the output channel before firing up the thread.
nenolod
parents: 109
diff changeset
135 decode_thread = g_thread_create(play_loop, spc, TRUE, NULL);
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
136 }
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
137
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
138 static void seek(gint time)
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
139 {
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
140 // XXX: Not yet implemented
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
141 }
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
142
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
143 InputPlugin console_ip = {
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
144 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
145 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
146 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
147 console_init,
109
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
148 console_aboutbox,
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
149 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
150 is_our_file,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
151 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
152 play_file,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
153 console_stop,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
154 console_pause,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
155 seek,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
156 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
157 get_time,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
158 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
159 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
160 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
161 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
162 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
163 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
164 NULL,
104
04d4827ea8a4 [svn] Generate a proper title.
nenolod
parents: 103
diff changeset
165 get_song_info,
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
166 NULL,
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
167 NULL
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
168 };
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
169
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
170 static void console_stop(void)
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
171 {
103
948027ac55be [svn] Stop playback when requested to by user.
nenolod
parents: 102
diff changeset
172 console_ip_is_going = FALSE;
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
173 g_thread_join(decode_thread);
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
174 console_ip.output->close_audio();
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
175 }
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
176
98
e42694a28331 [svn] More progress -- now loads as an audacious module. :)
nenolod
parents: 96
diff changeset
177 extern "C" InputPlugin *get_iplugin_info(void)
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
178 {
109
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
179 console_ip.description = g_strdup_printf(_("SPC, GYM, NSF, VGM and GBS module decoder"));
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
180 return &console_ip;
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
181 }
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
182
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
183 static void console_pause(gshort p)
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
184 {
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
185 console_ip.output->pause(p);
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
186 }
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
187
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
188 static void *play_loop(gpointer arg)
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
189 {
99
4b2b964a7694 [svn] What i have right now is this.
nenolod
parents: 98
diff changeset
190 Spc_Emu *my_spc = (Spc_Emu *) arg;
108
cde5ca21ddc3 [svn] Improved latency on the decode loop.
nenolod
parents: 107
diff changeset
191 Music_Emu::sample_t buf[1024];
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
192
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
193 for (;;)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
194 {
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
195 if (!console_ip_is_going)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
196 break;
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
197
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
198 my_spc->play(1024, buf);
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
199
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
200 if ((console_ip.output->output_time() / 1000) >
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
201 audcfg.loop_length && audcfg.loop_length != 0)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
202 break;
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
203 console_ip.add_vis_pcm(console_ip.output->written_time(),
108
cde5ca21ddc3 [svn] Improved latency on the decode loop.
nenolod
parents: 107
diff changeset
204 MY_FMT, 1, 2048, buf);
cde5ca21ddc3 [svn] Improved latency on the decode loop.
nenolod
parents: 107
diff changeset
205 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
206 xmms_usleep(10000);
108
cde5ca21ddc3 [svn] Improved latency on the decode loop.
nenolod
parents: 107
diff changeset
207 console_ip.output->write_audio(buf, 2048);
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
208 }
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
209
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
210 delete spc;
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
211 console_ip.output->close_audio();
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
212 console_ip_is_going = FALSE;
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
213 g_thread_exit(NULL);
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
214
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
215 return NULL;
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
216 }
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
217
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
218 static int get_time(void)
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
219 {
145
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
220 if (console_ip_is_going == TRUE)
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
221 return console_ip.output->output_time();
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
222 else
8794a4781a15 [svn] looping stuff
nenolod
parents: 133
diff changeset
223 return -1;
96
8dbd2d31c1f7 [svn] More work
nenolod
parents: 95
diff changeset
224 }
95
8247bbf454a8 [svn] Add code for decoder thread.
nenolod
parents: 94
diff changeset
225
100
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
226 static void console_init(void)
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
227 {
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
228
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
229 }
05d05f290c04 [svn] More stuffness. It *decodes*, but:
nenolod
parents: 99
diff changeset
230
109
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
231 extern "C" void console_aboutbox(void)
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
232 {
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
233 xmms_show_message(_("About the Console Music Decoder"),
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
234 _("Console music decoder engine based on Game_Music_Emu 0.2.4.\n"
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
235 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>"),
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
236 _("Ok"),
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
237 FALSE, NULL, NULL);
c4876d6c9cc0 [svn] Add about box.
nenolod
parents: 108
diff changeset
238 }