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