Mercurial > audlegacy-plugins
annotate src/console/Audacious_Driver.cxx @ 2511:da7e2ec2ea27
Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Apr 2008 00:59:00 +0300 |
parents | ed6c81bd9016 |
children | bd3a24b39058 |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Audacious: Cross platform multimedia player |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
3 * Copyright (c) 2005-2006 Audacious Team |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 * Driver for Game_Music_Emu library. See details at: |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 * http://www.slack.net/~ant/libs/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 |
1766
c3fdb0e5a306
Convert some makefiles, remove some -DHAVE_CONFIG_H.
William Pitcock <nenolod@atheme.org>
parents:
1734
diff
changeset
|
9 #include "config.h" |
528 | 10 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 #include <glib.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
385
diff
changeset
|
12 #include <audacious/i18n.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 #include <gtk/gtk.h> |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
14 extern "C" { |
1954
6acf1bda788b
Removed some extraneous includes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1952
diff
changeset
|
15 #include <audacious/plugin.h> |
1950
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1870
diff
changeset
|
16 #include <audacious/util.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1870
diff
changeset
|
17 #include <audacious/output.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 #include <math.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 // configdb and prefs ui |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include "Audacious_Config.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
26 #include "Music_Emu.h" |
341 | 27 #include "Gzip_Reader.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
29 int const fade_threshold = 10 * 1000; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
30 int const fade_length = 8 * 1000; |
341 | 31 int const path_max = 4096; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
1498
a1fccf242404
made SPC playback reverb a configuration option till the problem can be
mf0102 <0102@gmx.at>
parents:
1473
diff
changeset
|
33 AudaciousConsoleConfig audcfg = |
1499
799f92d815b2
removed NSFE playlist option (which was marked TODO)
mf0102 <0102@gmx.at>
parents:
1498
diff
changeset
|
34 { 180, FALSE, 32000, 0, 0, FALSE, 0, FALSE }; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 static GThread* decode_thread; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 static int console_ip_is_going; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 static volatile long pending_seek; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 extern InputPlugin console_ip; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 static Music_Emu* emu = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
41 static blargg_err_t log_err( blargg_err_t err ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
42 { |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
43 if ( err ) |
380
1397798646fb
[svn] - change use of printf to g_warning() and g_critical() where appropriate.
nenolod
parents:
378
diff
changeset
|
44 g_critical( "console error: %s\n", err ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
45 return err; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
46 } |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
47 |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
48 static void log_warning( Music_Emu* emu ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
49 { |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
50 const char* w = emu->warning(); |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
51 if ( w ) |
380
1397798646fb
[svn] - change use of printf to g_warning() and g_critical() where appropriate.
nenolod
parents:
378
diff
changeset
|
52 g_warning( "console warning: %s\n", w ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
53 } |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
54 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 static void unload_file() |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 { |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
57 if ( emu ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
58 log_warning( emu ); |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
59 gme_delete( emu ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 emu = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
341 | 63 // Handles URL parsing, file opening and identification, and file loading. |
64 // Keeps file header around when loading rest of file to avoid seeking | |
65 // and re-reading. | |
66 class File_Handler { | |
67 public: | |
68 gchar* path; // path without track number specification | |
69 int track; // track number (0 = first track) | |
70 Music_Emu* emu; // set to 0 to take ownership | |
71 gme_type_t type; | |
72 | |
73 // Parses path and identifies file type | |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
74 File_Handler( const char* path, VFSFile* fd = 0 ); |
341 | 75 |
76 // Creates emulator and returns 0. If this wasn't a music file or | |
77 // emulator couldn't be created, returns 1. | |
78 int load( long sample_rate ); | |
79 | |
80 // Deletes owned emu and closes file | |
81 ~File_Handler(); | |
82 private: | |
83 char header [4]; | |
1978 | 84 Vfs_File_Reader aud_vfs_in; |
341 | 85 Gzip_Reader in; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
88 File_Handler::File_Handler( const char* path_in, VFSFile* fd ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 { |
341 | 90 emu = 0; |
91 type = 0; | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
92 track = 0; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
93 |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
94 path = g_strdup( path_in ); |
341 | 95 if ( !path ) |
96 return; // out of memory | |
97 | |
98 // extract track number | |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
99 gchar* args = strrchr( path, '?' ); // TODO: use strrchr()? |
752 | 100 if ( args && g_ascii_isdigit( (guchar) *(args + 1) ) ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 { |
341 | 102 *args = '\0'; |
103 // TODO: use func with better error reporting, and perhaps don't | |
104 // truncate path if there is no number after ? | |
1734
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
105 track = atoi( args + 1 ) - 1; |
341 | 106 } |
381
53056ce7940d
[svn] - avoid opening VFS FDs for track URIs where we know that the file is valid
nenolod
parents:
380
diff
changeset
|
107 |
341 | 108 // open vfs |
109 if ( fd ) | |
1978 | 110 aud_vfs_in.reset( fd ); |
111 else if ( log_err( aud_vfs_in.open( path ) ) ) | |
341 | 112 return; |
113 | |
114 // now open gzip_reader on top of vfs | |
1978 | 115 if ( log_err( in.open( &aud_vfs_in ) ) ) |
341 | 116 return; |
117 | |
118 // read and identify header | |
119 if ( !log_err( in.read( header, sizeof header ) ) ) | |
120 { | |
121 type = gme_identify_extension( gme_identify_header( header ) ); | |
122 if ( !type ) | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 { |
341 | 124 type = gme_identify_extension( path ); |
125 if ( type != gme_gym_type ) // only trust file extension for headerless .gym files | |
126 type = 0; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 |
341 | 131 File_Handler::~File_Handler() |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 { |
341 | 133 gme_delete( emu ); |
134 g_free( path ); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 |
341 | 137 int File_Handler::load( long sample_rate ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 { |
341 | 139 if ( !type ) |
140 return 1; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 |
341 | 142 emu = gme_new_emu( type, sample_rate ); |
143 if ( !emu ) | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
144 { |
341 | 145 log_err( "Out of memory" ); |
146 return 1; | |
147 } | |
148 | |
149 { | |
150 // combine header with remaining file data | |
151 Remaining_Reader reader( header, sizeof header, &in ); | |
152 if ( log_err( emu->load( reader ) ) ) | |
153 return 1; | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
154 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 |
341 | 156 // files can be closed now |
157 in.close(); | |
1978 | 158 aud_vfs_in.close(); |
341 | 159 |
160 log_warning( emu ); | |
161 | |
162 // load .m3u from same directory( replace/add extension with ".m3u") | |
163 char m3u_path [path_max + 5]; | |
164 strncpy( m3u_path, path, path_max ); | |
165 m3u_path [path_max] = 0; | |
166 // TODO: use better path-building functions | |
167 char* p = strrchr( m3u_path, '.' ); | |
168 if ( !p ) | |
169 p = m3u_path + strlen( m3u_path ); | |
170 strcpy( p, ".m3u" ); | |
171 | |
172 Vfs_File_Reader m3u; | |
173 if ( !m3u.open( m3u_path ) ) | |
174 { | |
175 if ( log_err( emu->load_m3u( m3u ) ) ) // TODO: fail if m3u can't be loaded? | |
176 log_warning( emu ); // this will log line number of first problem in m3u | |
177 } | |
178 | |
179 return 0; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 // Get info |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 |
603 | 184 static inline gchar *selective_strdup(const gchar *in) |
185 { | |
186 if (in == NULL || *in == '\0') | |
187 return NULL; | |
188 | |
189 return g_strdup(in); | |
190 } | |
191 | |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
192 static Tuple* get_track_ti( const char* path, track_info_t const& info, int track ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
194 Tuple* ti = aud_tuple_new(); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
195 if ( ti ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
196 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
197 aud_tuple_associate_string(ti, FIELD_FILE_NAME, NULL, g_path_get_basename(path)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
198 aud_tuple_associate_string(ti, FIELD_FILE_PATH, NULL, g_path_get_dirname(path)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
199 aud_tuple_associate_string(ti, FIELD_ARTIST, NULL, info.author); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
200 aud_tuple_associate_string(ti, FIELD_ALBUM, NULL, info.game); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
201 aud_tuple_associate_string(ti, -1, "game", info.game); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
202 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, info.song ? info.song : g_path_get_basename(path)); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
203 if ( info.track_count > 1 ) |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
204 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
205 aud_tuple_associate_int(ti, FIELD_TRACK_NUMBER, NULL, track + 1); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
206 aud_tuple_associate_int(ti, FIELD_SUBSONG_ID, NULL, track + 1); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
207 aud_tuple_associate_int(ti, FIELD_SUBSONG_NUM, NULL, info.track_count); |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
208 ti->nsubtunes = info.track_count; |
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
209 ti->subtunes = NULL; |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
210 } |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
211 aud_tuple_associate_string(ti, FIELD_COPYRIGHT, NULL, info.copyright); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
212 aud_tuple_associate_string(ti, -1, "console", info.system); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
213 aud_tuple_associate_string(ti, FIELD_CODEC, NULL, info.system); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
214 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced"); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
215 aud_tuple_associate_string(ti, -1, "dumper", info.dumper); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
216 aud_tuple_associate_string(ti, FIELD_COMMENT, NULL, info.comment); |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
217 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
218 int length = info.length; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
219 if ( length <= 0 ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
220 length = info.intro_length + 2 * info.loop_length; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
221 if ( length <= 0 ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
222 length = audcfg.loop_length * 1000; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
223 else if ( length >= fade_threshold ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
224 length += fade_length; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
225 aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, length); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
226 } |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
227 return ti; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
230 static char* format_and_free_ti( Tuple* ti, int* length ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 { |
2055 | 232 char* result = aud_tuple_formatter_make_title_string(ti, aud_get_gentitle_format()); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
233 if ( result ) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
234 *length = aud_tuple_get_int(ti, FIELD_LENGTH, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1954
diff
changeset
|
235 aud_tuple_free((void *) ti); |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
236 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 return result; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
240 static Tuple *get_song_tuple( gchar *path ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 { |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
242 Tuple* result = NULL; |
341 | 243 File_Handler fh( path ); |
244 if ( !fh.load( gme_info_only ) ) | |
245 { | |
246 track_info_t info; | |
247 if ( !log_err( fh.emu->track_info( &info, fh.track ) ) ) | |
248 result = get_track_ti( fh.path, info, fh.track ); | |
249 } | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
250 return result; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 // Playback |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
255 static void* play_loop_track( gpointer arg ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
257 InputPlayback *playback = (InputPlayback *) arg; |
1184
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
258 |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
259 int end_delay = 0; |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
260 while ( console_ip_is_going ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 // handle pending seek |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 long s = pending_seek; |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
264 pending_seek = -1; // TODO: use atomic swap |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 if ( s >= 0 ) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
267 playback->output->flush( s * 1000 ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
268 emu->seek( s * 1000 ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 } |
341 | 270 |
271 // fill and play buffer of audio | |
272 // TODO: see if larger buffer helps efficiency | |
273 int const buf_size = 1024; | |
274 Music_Emu::sample_t buf [buf_size]; | |
1184
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
275 if ( end_delay ) |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
276 { |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
277 // TODO: remove delay once host doesn't cut the end of track off |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
278 if ( !--end_delay ) |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
279 console_ip_is_going = false; |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
280 memset( buf, 0, sizeof buf ); |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
281 |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
282 } |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
283 else |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
284 { |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
285 emu->play( buf_size, buf ); |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
286 if ( emu->track_ended() ) |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
287 { |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
288 double const seconds = 3; |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
289 end_delay = emu->sample_rate() * (int) (seconds * 2) / buf_size; |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
290 } |
6d03915421e2
Possibly fix bug #850. Patch from P2E.
William Pitcock <nenolod@atheme.org>
parents:
1069
diff
changeset
|
291 } |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1984
diff
changeset
|
292 playback->pass_audio( playback, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 FMT_S16_NE, 1, sizeof buf, buf, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 &console_ip_is_going ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 // stop playing |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 unload_file(); |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
299 playback->output->close_audio(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 console_ip_is_going = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
304 static void play_file( InputPlayback *playback ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
306 char* path = playback->filename; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 unload_file(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
309 // identify file |
341 | 310 File_Handler fh( path ); |
311 if ( !fh.type ) | |
312 return; | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
313 |
341 | 314 // select sample rate |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
315 long sample_rate = 0; |
341 | 316 if ( fh.type == gme_spc_type ) |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
317 sample_rate = 32000; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 if ( audcfg.resample ) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 sample_rate = audcfg.resample_rate; |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
320 if ( !sample_rate ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
321 sample_rate = 44100; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
322 |
341 | 323 // create emulator and load file |
324 if ( fh.load( sample_rate ) ) | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
327 // stereo echo depth |
341 | 328 gme_set_stereo_depth( fh.emu, 1.0 / 100 * audcfg.echo ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
329 |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
330 // set equalizer |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 if ( audcfg.treble || audcfg.bass ) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 { |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
333 Music_Emu::equalizer_t eq; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 // bass - logarithmic, 2 to 8194 Hz |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 double bass = 1.0 - (audcfg.bass / 200.0 + 0.5); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
337 eq.bass = (long) (2.0 + pow( 2.0, bass * 13 )); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 // treble - -50 to 0 to +5 dB |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 double treble = audcfg.treble / 100.0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 eq.treble = treble * (treble < 0 ? 50.0 : 5.0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 |
341 | 343 fh.emu->set_equalizer(eq); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
346 // get info |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
347 int length = -1; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
348 track_info_t info; |
341 | 349 if ( !log_err( fh.emu->track_info( &info, fh.track ) ) ) |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
350 { |
341 | 351 if ( fh.type == gme_spc_type && audcfg.ignore_spc_length ) |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
352 info.length = -1; |
1418
08a6320f7a2b
console: update to new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
353 Tuple* ti = get_track_ti( fh.path, info, fh.track ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
354 if ( ti ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
355 { |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
356 char* title = format_and_free_ti( ti, &length ); |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
357 if ( title ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
358 { |
1984
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
359 playback->set_params( playback, title, length, fh.emu->voice_count() * 1000, sample_rate, 2 ); |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
360 g_free( title ); |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
361 } |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
362 } |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
363 } |
341 | 364 |
365 // start track | |
366 if ( log_err( fh.emu->start_track( fh.track ) ) ) | |
367 return; | |
368 log_warning( fh.emu ); | |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
369 if ( !playback->output->open_audio( FMT_S16_NE, sample_rate, 2 ) ) |
341 | 370 return; |
371 | |
372 // set fade time | |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
373 if ( length <= 0 ) |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
374 length = audcfg.loop_length * 1000; |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
375 if ( length >= fade_threshold + fade_length ) |
648 | 376 length -= fade_length / 2; |
341 | 377 fh.emu->set_fade( length, fade_length ); |
378 | |
379 // take ownership of emu | |
380 emu = fh.emu; | |
381 fh.emu = 0; | |
382 | |
383 pending_seek = -1; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 console_ip_is_going = 1; |
1348
d427f353e326
console: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1185
diff
changeset
|
385 decode_thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1418
diff
changeset
|
386 playback->set_pb_ready(playback); |
1348
d427f353e326
console: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1185
diff
changeset
|
387 play_loop_track( playback ); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 |
559 | 390 static void seek( InputPlayback * data, gint time ) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 { |
341 | 392 // TODO: use thread-safe atomic set |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 pending_seek = time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
396 static void console_stop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 console_ip_is_going = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 if ( decode_thread ) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 g_thread_join( decode_thread ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 decode_thread = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 } |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
404 playback->output->close_audio(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 unload_file(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
408 static void console_pause(InputPlayback * playback, gshort p) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
410 playback->output->pause(p); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
413 static int get_time(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
415 return console_ip_is_going ? playback->output->output_time() : -1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 |
1734
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
418 static Tuple *probe_for_tuple(gchar *filename, VFSFile *fd) |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
419 { |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
420 File_Handler fh(filename, fd); |
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
421 |
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
422 if (!fh.type) |
1734
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
423 return NULL; |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
424 |
1978 | 425 aud_vfs_rewind(fd); |
1734
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
426 |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
427 return get_song_tuple(filename); |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
428 } |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
429 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 // Setup |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 static void console_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 console_cfg_load(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 |
1660
206e7cb5fce7
"about" dialog of console plugin opens now correctly
mf0102 <0102@gmx.at>
parents:
1659
diff
changeset
|
437 void console_aboutbox(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 static GtkWidget * aboutbox = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 if (!aboutbox) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 { |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1660
diff
changeset
|
443 aboutbox = audacious_info_dialog(_("About the Console Music Decoder"), |
341 | 444 _("Console music decoder engine based on Game_Music_Emu 0.5.2.\n" |
355
92848bda520d
[svn] Move supported formats to plugin info, rename plugin to 'Game console audio module decoder'.
kiyoshi
parents:
341
diff
changeset
|
445 "Supported formats: AY, GBS, GYM, HES, KSS, NSF, NSFE, SAP, SPC, VGM, VGZ\n" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>, \n" |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
447 " Shay Green <gblargg@gmail.com>"), |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 _("Ok"), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 FALSE, NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 (GCallback)gtk_widget_destroyed, &aboutbox); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
752
diff
changeset
|
455 const gchar *gme_fmts[] = { "ay", "gbs", "gym", "hes", "kss", "nsf", "nsfe", |
378 | 456 "sap", "spc", "vgm", "vgz", NULL }; |
457 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 InputPlugin console_ip = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 NULL, |
1185 | 462 (gchar *)"Game console audio module decoder", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 console_init, |
1659 | 464 NULL, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 console_aboutbox, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 console_cfg_ui, |
1611
f49d1284079a
"sorry, unimplemented: non-trivial designated initializers not supported". What a crock of g++.
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
467 FALSE, |
f49d1284079a
"sorry, unimplemented: non-trivial designated initializers not supported". What a crock of g++.
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
468 NULL, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 play_file, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 console_stop, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 console_pause, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 get_time, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 NULL, |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
482 NULL, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 get_song_tuple, |
316
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
486 NULL, |
fb513e10174e
[svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
12
diff
changeset
|
487 NULL, |
2089
d52d3029bb91
Fix subtunes support to match the new core (possibly not working yet)
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
488 NULL, |
1734
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
489 (gchar **)gme_fmts, |
5e47a0c1b969
- updated libconsole plugin subtune code
Giacomo Lozito <james@develia.org>
parents:
1697
diff
changeset
|
490 NULL, |
2171 | 491 probe_for_tuple, |
492 TRUE | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 |
1069 | 495 InputPlugin *console_iplist[] = { &console_ip, NULL }; |
496 | |
1659 | 497 SIMPLE_INPUT_PLUGIN(console, console_iplist); |