annotate Plugins/Input/console/Audacious_Driver.cpp @ 1238:dc6f7048a9fa trunk

[svn] - remove metatag entirely
author nenolod
date Wed, 14 Jun 2006 22:41:05 -0700
parents f1e57db353a3
children 0f89ebbf890a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
1 /*
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
2 * Audacious: Cross platform multimedia player
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
3 * Copyright (c) 2005 Audacious Team
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
4 *
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
5 * Driver for Game_Music_Emu library. See details at:
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
6 * http://www.slack.net/~ant/libs/
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
7 */
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
8
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
9 #include <glib.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
10 #include <glib/gi18n.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
11 #include <gtk/gtk.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
12 #include "libaudacious/configdb.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
13 #include "libaudacious/util.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
14 #include "libaudacious/titlestring.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
15 extern "C" {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
16 #include "audacious/output.h"
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
17 #include "audacious/playlist.h"
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
18 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
19 #include <string.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
20 #include <stdlib.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
21 #include <ctype.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
22 #include <math.h>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
23
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
24 // Game_Music_Emu
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
25 #include "Nsf_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
26 #include "Nsfe_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
27 #include "Gbs_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
28 #include "Vgm_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
29 #include "Gym_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
30 #include "Spc_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
31
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
32 #include "Track_Emu.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
33 #include "Vfs_File.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
34 #include "Gzip_File.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
35 #include "blargg_endian.h"
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
36
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
37 //typedef Vfs_File_Reader Audacious_Reader; // will use VFS once it handles gzip transparently
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
38 typedef Gzip_File_Reader Audacious_Reader;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
39
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
40 struct AudaciousConsoleConfig {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
41 gint loop_length; // length of tracks that lack timing information
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
42 gboolean resample; // whether or not to resample
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
43 gint resample_rate; // rate to resample at
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
44 gboolean nsfe_playlist; // if true, use optional NSFE playlist
1006
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
45 gint treble; // -100 to +100
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
46 gint bass; // -100 to +100
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
47 };
1006
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
48 static AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0 };
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
49 static GThread* decode_thread;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
50 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT;
499
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
51 static int console_ip_is_going;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
52 static volatile long pending_seek;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
53 extern InputPlugin console_ip;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
54 static Music_Emu* emu = 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
55 static Track_Emu track_emu;
528
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
56 static int track_ended;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
57
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
58 static void unload_file()
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
59 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
60 delete emu;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
61 emu = NULL;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
62 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
63
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
64 // Information
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
65
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
66 typedef unsigned char byte;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
67
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
68 #define DUPE_FIELD( field ) g_strndup( field, sizeof (field) );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
69
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
70 struct track_info_t
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
71 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
72 int track; // track to get info for
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
73 int length; // in msec, -1 = unknown
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
74 int loop; // in msec, -1 = unknown, 0 = not looped
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
75 int intro; // in msec, -1 = unknown
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
76
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
77 TitleInput* ti;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
78 };
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
79
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
80 // NSFE
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
81
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
82 void get_nsfe_info( Nsfe_Info const& nsfe, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
83 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
84 Nsfe_Info::info_t const& h = nsfe.info();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
85 out->ti->performer = DUPE_FIELD( h.author );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
86 out->ti->album_name = DUPE_FIELD( h.game );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
87 out->ti->comment = DUPE_FIELD( h.copyright );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
88 out->ti->track_name = g_strdup( nsfe.track_name( out->track ) );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
89 int time = nsfe.track_time( out->track );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
90 if ( time > 0 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
91 out->length = time;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
92 if ( nsfe.info().track_count > 1 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
93 out->ti->track_number = out->track + 1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
94 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
95
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
96 inline void get_info_emu( Nsfe_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
97 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
98 emu.enable_playlist( audcfg.nsfe_playlist ); // to do: kind of hacky
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
99 get_nsfe_info( emu, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
100 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
101
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
102 inline void get_file_info( Nsfe_Emu::header_t const& h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
103 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
104 Nsfe_Info nsfe;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
105 if ( !nsfe.load( h, in ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
106 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
107 nsfe.enable_playlist( audcfg.nsfe_playlist );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
108 get_nsfe_info( nsfe, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
109 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
110 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
111
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
112 // NSF
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
113
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
114 static void get_nsf_info_( Nsf_Emu::header_t const& h, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
115 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
116 out->ti->performer = DUPE_FIELD( h.author );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
117 out->ti->album_name = DUPE_FIELD( h.game );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
118 out->ti->comment = DUPE_FIELD( h.copyright );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
119 if ( h.track_count > 1 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
120 out->ti->track_number = out->track + 1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
121 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
122
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
123 inline void get_info_emu( Nsf_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
124 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
125 get_nsf_info_( emu.header(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
126 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
127
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
128 inline void get_file_info( Nsf_Emu::header_t const& h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
129 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
130 get_nsf_info_( h, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
131 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
132
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
133 // GBS
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
134
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
135 static void get_gbs_info_( Gbs_Emu::header_t const& h, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
136 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
137 out->ti->performer = DUPE_FIELD( h.author );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
138 out->ti->album_name = DUPE_FIELD( h.game );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
139 out->ti->comment = DUPE_FIELD( h.copyright );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
140 if ( h.track_count > 1 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
141 out->ti->track_number = out->track + 1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
142 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
143
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
144 inline void get_info_emu( Gbs_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
145 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
146 get_gbs_info_( emu.header(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
147 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
148
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
149 inline void get_file_info( Gbs_Emu::header_t const& h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
150 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
151 get_gbs_info_( h, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
152 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
153
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
154 // GYM
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
155
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
156 static void get_gym_info_( Gym_Emu::header_t const& h, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
157 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
158 if ( !memcmp( h.tag, "GYMX", 4 ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
159 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
160 out->ti->performer = DUPE_FIELD( h.copyright );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
161 out->ti->album_name = DUPE_FIELD( h.game );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
162 out->ti->track_name = DUPE_FIELD( h.song );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
163 out->ti->comment = DUPE_FIELD( h.comment );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
164 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
165 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
166
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
167 static void get_gym_timing_( Gym_Emu const& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
168 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
169 out->length = emu.track_length() * 50 / 3; // 1000 / 60
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
170 out->loop = 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
171
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
172 long loop = get_le32( emu.header().loop_start );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
173 if ( loop )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
174 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
175 out->intro = loop * 50 / 3;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
176 out->loop = out->length - out->intro;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
177 out->length = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
178 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
179 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
180
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
181 inline void get_info_emu( Gym_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
182 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
183 get_gym_info_( emu.header(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
184 get_gym_timing_( emu, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
185 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
186
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
187 inline void get_file_info( Gym_Emu::header_t const& h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
188 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
189 get_gym_info_( h, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
190
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
191 // have to load and parse entire GYM file to determine length
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
192 // to do: could make more efficient by manually parsing data (format is simple)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
193 // rather than loading into emulator with its FM chips and resampler
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
194 Gym_Emu* emu = new Gym_Emu;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
195 if ( emu && !emu->set_sample_rate( 44100 ) && !emu->load( h, in ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
196 get_gym_timing_( *emu, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
197 delete emu;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
198 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
199
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
200 // SPC
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
201
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
202 static void get_spc_xid6( byte const* begin, long size, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
203 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
204 // header
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
205 byte const* end = begin + size;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
206 if ( size < 8 || memcmp( begin, "xid6", 4 ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
207 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
208 long info_size = get_le32( begin + 4 );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
209 byte const* in = begin + 8;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
210 if ( end - in > info_size )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
211 end = in + info_size;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
212
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
213 while ( end - in >= 4 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
214 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
215 // header
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
216 int id = in [0];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
217 int data = in [3] * 0x100 + in [2];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
218 int type = in [1];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
219 int len = type ? data : 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
220 in += 4;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
221 if ( len > end - in )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
222 break; // block goes past end of data
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
223
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
224 // handle specific block types
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
225 switch ( id )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
226 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
227 case 0x01: out->ti->track_name = g_strndup( (char*) in, len ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
228 case 0x02: out->ti->album_name = g_strndup( (char*) in, len ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
229 case 0x03: out->ti->performer = g_strndup( (char*) in, len ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
230 case 0x07: out->ti->comment = g_strndup( (char*) in, len ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
231 //case 0x31: // loop length, but I haven't found any SPC files that use this
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
232 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
233
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
234 // skip to next block
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
235 in += len;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
236
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
237 // blocks are supposed to be 4-byte aligned with zero-padding...
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
238 byte const* unaligned = in;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
239 while ( (in - begin) & 3 && in < end )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
240 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
241 if ( *in++ != 0 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
242 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
243 // ...but some files have no padding
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
244 in = unaligned;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
245 break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
246 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
247 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
248 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
249 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
250
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
251 static void get_spc_info_( Spc_Emu::header_t const& h, byte const* xid6, long xid6_size,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
252 track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
253 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
254 // decode length (can be in text or binary format)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
255 char s [4] = { h.len_secs [0], h.len_secs [1], h.len_secs [2], 0 };
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
256 int len_secs = (unsigned char) s [1] * 0x100 + s [0];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
257 if ( s [1] >= ' ' || (!s [1] && isdigit( s [0] )) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
258 len_secs = atoi( s );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
259 if ( len_secs )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
260 out->length = len_secs * 1000;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
261
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
262 if ( xid6_size )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
263 get_spc_xid6( xid6, xid6_size, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
264
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
265 // use header to fill any remaining fields
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
266 if ( !out->ti->performer ) out->ti->performer = DUPE_FIELD( h.author );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
267 if ( !out->ti->album_name ) out->ti->album_name = DUPE_FIELD( h.game );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
268 if ( !out->ti->track_name ) out->ti->track_name = DUPE_FIELD( h.song );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
269 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
270
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
271 inline void get_info_emu( Spc_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
272 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
273 get_spc_info_( emu.header(), emu.trailer(), emu.trailer_size(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
274 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
275
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
276 inline void get_file_info( Spc_Emu::header_t const& h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
277 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
278 // handle xid6 data at end of file
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
279 long const xid6_skip = 0x10200 - sizeof (Spc_Emu::header_t);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
280 long xid6_size = in.remain() - xid6_skip;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
281 blargg_vector<byte> xid6;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
282 if ( xid6_size <= 0 || xid6.resize( xid6_size ) || in.skip( xid6_skip ) ||
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
283 in.read( xid6.begin(), xid6.size() ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
284 xid6_size = 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
285
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
286 get_spc_info_( h, xid6.begin(), xid6_size, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
287 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
288
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
289 // VGM
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
290
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
291 static void get_gd3_str( byte const* in, byte const* end, gchar** out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
292 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
293 int len = (end - in) / 2 - 1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
294 if ( len > 0 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
295 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
296 *out = g_strndup( "", len );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
297 if ( !*out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
298 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
299 for ( int i = 0; i < len; i++ )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
300 (*out) [i] = in [i * 2]; // to do: convert to utf-8
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
301 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
302 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
303
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
304 static byte const* skip_gd3_str( byte const* in, byte const* end )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
305 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
306 while ( end - in >= 2 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
307 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
308 in += 2;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
309 if ( !(in [-2] | in [-1]) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
310 break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
311 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
312 return in;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
313 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
314
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
315 static byte const* get_gd3_pair( byte const* in, byte const* end, gchar** out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
316 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
317 byte const* mid = skip_gd3_str( in, end );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
318 if ( out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
319 get_gd3_str( in, mid, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
320 return skip_gd3_str( mid, end );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
321 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
322
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
323 static void get_vgm_gd3( byte const* in, long size, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
324 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
325 byte const* end = in + size;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
326 in = get_gd3_pair( in, end, &out->ti->track_name );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
327 in = get_gd3_pair( in, end, &out->ti->album_name );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
328 in = get_gd3_pair( in, end, 0 ); // system
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
329 in = get_gd3_pair( in, end, &out->ti->performer );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
330 in = get_gd3_pair( in, end, 0 ); // copyright
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
331 // ... other fields (release date, dumper, notes)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
332 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
333
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
334 static void get_vgm_length( Vgm_Emu::header_t const& h, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
335 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
336 long length = get_le32( h.track_duration );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
337 if ( length > 0 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
338 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
339 out->length = length * 10 / 441; // 1000 / 44100 (VGM files used 44100 as timebase)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
340 out->loop = 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
341
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
342 long loop = get_le32( h.loop_duration );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
343 if ( loop > 0 && get_le32( h.loop_offset ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
344 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
345 out->loop = loop * 10 / 441;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
346 out->intro = out->length - out->loop;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
347 out->length = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
348 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
349 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
350 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
351
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
352 inline void get_info_emu( Vgm_Emu& emu, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
353 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
354 get_vgm_length( emu.header(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
355
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
356 int size;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
357 byte const* data = emu.gd3_data( &size );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
358 if ( data )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
359 get_vgm_gd3( data + 12, size, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
360 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
361
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
362 inline void get_file_info( Vgm_Emu::header_t const& vgm_h, Data_Reader& in, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
363 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
364 get_vgm_length( vgm_h, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
365
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
366 // find gd3 header
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
367 long gd3_offset = get_le32( vgm_h.gd3_offset ) + offsetof(Vgm_Emu::header_t,gd3_offset) -
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
368 sizeof vgm_h;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
369 long gd3_max_size = in.remain() - gd3_offset;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
370 byte gd3_h [12];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
371 if ( gd3_offset <= 0 || gd3_max_size < (int) sizeof gd3_h )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
372 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
373
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
374 // read gd3 header
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
375 if ( in.skip( gd3_offset ) || in.read( gd3_h, sizeof gd3_h ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
376 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
377
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
378 // check header signature and version
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
379 if ( memcmp( gd3_h, "Gd3 ", 4 ) || get_le32( gd3_h + 4 ) >= 0x200 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
380 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
381
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
382 // get and check size
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
383 long gd3_size = get_le32( gd3_h + 8 );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
384 if ( gd3_size > gd3_max_size - 12 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
385 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
386
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
387 // read and parse gd3 data
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
388 blargg_vector<byte> gd3;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
389 if ( gd3.resize( gd3_size ) || in.read( gd3.begin(), gd3.size() ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
390 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
391
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
392 get_vgm_gd3( gd3.begin(), gd3.size(), out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
393 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
394
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
395 // File identification
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
396
1198
311c4a27c3dd [svn] - yeah, JMA sucks -- i don't have the time for this
nenolod
parents: 1196
diff changeset
397 enum { type_none = 0, type_spc, type_nsf, type_nsfe, type_vgm, type_gbs, type_gym };
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
398
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
399 int const tag_size = 4;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
400 typedef char tag_t [tag_size];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
401
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
402 static int identify_file( gchar* path, tag_t tag )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
403 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
404 // GYM file format doesn't require *any* header, just the ".gym" extension
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
405 if ( g_str_has_suffix( path, ".gym" ) ) // to do: is pathname in unicode?
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
406 return type_gym;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
407 // to do: trust suffix for all file types, avoiding having to look inside files?
1125
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
408
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
409 int result = type_none;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
410 if ( !memcmp( tag, "SNES", 4 ) ) result = type_spc;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
411 if ( !memcmp( tag, "NESM", 4 ) ) result = type_nsf;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
412 if ( !memcmp( tag, "NSFE", 4 ) ) result = type_nsfe;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
413 if ( !memcmp( tag, "GYMX", 4 ) ) result = type_gym;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
414 if ( !memcmp( tag, "GBS" , 3 ) ) result = type_gbs;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
415 if ( !memcmp( tag, "Vgm ", 4 ) ) result = type_vgm;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
416 return result;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
417 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
418
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
419 // Get info
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
420
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
421 static int begin_get_info( const char* path, track_info_t* out )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
422 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
423 out->track = 0;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
424 out->length = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
425 out->loop = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
426 out->intro = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
427 TitleInput* fields = bmp_title_input_new();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
428 out->ti = fields;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
429 if ( !fields )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
430 return true;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
431
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
432 fields->file_name = g_path_get_basename( path );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
433 fields->file_path = g_path_get_dirname( path );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
434 return false;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
435 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
436
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
437 static char* end_get_info( track_info_t const& info, int* length, bool* has_length )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
438 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
439 *length = info.length;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
440 if ( has_length )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
441 *has_length = (*length > 0);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
442
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
443 if ( *length <= 0 )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
444 *length = audcfg.loop_length * 1000;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
445
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
446 // use filename for formats that don't have field for name of game
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
447 // to do: strip off file extension
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
448 if ( !info.ti->track_name )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
449 info.ti->track_name = g_strdup( info.ti->file_name );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
450
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
451 char* result = xmms_get_titlestring( xmms_get_gentitle_format(), info.ti );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
452 g_free( info.ti );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
453 return result;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
454 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
455
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
456 template<class Header>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
457 inline void get_info_t( tag_t tag, Data_Reader& in, track_info_t* out, Header* )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
458 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
459 Header h;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
460 memcpy( &h, tag, tag_size );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
461 if ( !in.read( (char*) &h + tag_size, sizeof h - tag_size ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
462 get_file_info( h, in, out );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
463 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
464
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
465 static void get_song_info( char* path, char** title, int* length )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
466 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
467 int track = 0; // to do: way to select other tracks
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
468
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
469 // extract the subsong id from the virtual path
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
470 gchar *path2 = g_strdup(path);
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
471 gchar *_path = strchr(path2, '?');
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
472
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
473 if (_path != NULL && *_path == '?')
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
474 {
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
475 *_path = '\0';
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
476 _path++;
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
477 track = atoi(_path);
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
478 }
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
479
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
480 *length = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
481 *title = NULL;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
482 Audacious_Reader in;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
483 tag_t tag;
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
484 if ( in.open( path2 ) || in.read( tag, sizeof tag ) )
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
485 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
486
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
487 int type = identify_file( path2, tag );
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
488 if ( !type )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
489 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
490
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
491 track_info_t info;
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
492 if ( begin_get_info( path2, &info ) )
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
493 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
494 info.track = track;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
495
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
496 switch ( type )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
497 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
498 case type_nsf: get_info_t( tag, in, &info, (Nsf_Emu::header_t*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
499 case type_gbs: get_info_t( tag, in, &info, (Gbs_Emu::header_t*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
500 case type_gym: get_info_t( tag, in, &info, (Gym_Emu::header_t*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
501 case type_vgm: get_info_t( tag, in, &info, (Vgm_Emu::header_t*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
502 case type_spc: get_info_t( tag, in, &info, (Spc_Emu::header_t*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
503 case type_nsfe:get_info_t( tag, in, &info, (Nsfe_Emu::header_t*)0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
504 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
505 *title = end_get_info( info, length, 0 );
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
506
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
507 g_free(path2);
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
508 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
509
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
510 // Playback
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
511
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
512 static void* play_loop_track( gpointer )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
513 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
514 g_static_mutex_lock( &playback_mutex );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
515
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
516 while ( console_ip_is_going )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
517 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
518 int const buf_size = 1024;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
519 Music_Emu::sample_t buf [buf_size];
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
520
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
521 // handle pending seek
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
522 long s = pending_seek;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
523 pending_seek = -1; // to do: use atomic swap
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
524 if ( s >= 0 )
497
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
525 {
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
526 console_ip.output->flush( s * 1000 );
495
a371216b5c8a [svn] Close enough... does some sort of speedup for 3 seconds like timidity, but close enough.
nenolod
parents: 494
diff changeset
527 track_emu.seek( s * 1000 );
497
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
528 }
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
529
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
530 // fill buffer
528
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
531 if ( track_ended )
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
532 {
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
533 if ( track_ended++ > emu->sample_rate() * 3 / (buf_size / 2) )
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
534 console_ip_is_going = false;
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
535 memset( buf, 0, sizeof buf );
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
536 }
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
537 else if ( track_emu.play( buf_size, buf ) )
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
538 {
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
539 track_ended = 1;
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
540 }
497
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
541 produce_audio( console_ip.output->written_time(),
499
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
542 FMT_S16_NE, 1, sizeof buf, buf,
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
543 &console_ip_is_going );
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
544 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
545
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
546 // stop playing
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
547 unload_file();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
548 console_ip.output->close_audio();
499
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
549 console_ip_is_going = 0;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
550 g_static_mutex_unlock( &playback_mutex );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
551 // to do: should decode_thread be cleared here?
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
552 g_thread_exit( NULL );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
553 return NULL;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
554 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
555
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
556 template<class Emu>
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
557 void load_file( tag_t tag, Data_Reader& in, long rate, track_info_t* out, Emu* dummy )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
558 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
559 typename Emu::header_t h;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
560 memcpy( &h, tag, tag_size );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
561 if ( in.read( (char*) &h + tag_size, sizeof h - tag_size ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
562 return;
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
563
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
564 if ( rate == 0 )
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
565 rate = 44100;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
566
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
567 Emu* local_emu = new Emu;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
568 if ( !local_emu || local_emu->set_sample_rate( rate ) || local_emu->load( h, in ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
569 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
570 delete local_emu; // delete NULL is safe
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
571 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
572 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
573
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
574 emu = local_emu;
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
575 if (out != NULL)
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
576 get_info_emu( *local_emu, out );
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
577 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
578
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
579 static void play_file( char* path )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
580 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
581 int track = 0; // to do: some way to select other tracks
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
582
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
583 // open and identify file
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
584 unload_file();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
585 Audacious_Reader in;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
586 tag_t tag;
1125
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
587
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
588 // extract the subsong id from the virtual path
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
589 gchar *path2 = g_strdup(path);
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
590 gchar *_path = strchr(path2, '?');
1125
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
591
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
592 if (_path != NULL && *_path == '?')
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
593 {
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
594 *_path = '\0';
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
595 _path++;
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
596 track = atoi(_path);
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
597 }
790c3a23eea2 [svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
nenolod
parents: 1006
diff changeset
598
1198
311c4a27c3dd [svn] - yeah, JMA sucks -- i don't have the time for this
nenolod
parents: 1196
diff changeset
599 if ( in.open( path2 ) || in.read( tag, sizeof tag ) )
311c4a27c3dd [svn] - yeah, JMA sucks -- i don't have the time for this
nenolod
parents: 1196
diff changeset
600 return;
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
601 int type = identify_file( path2, tag );
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
602
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
603 // setup info
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
604 long sample_rate = 44100;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
605 if ( type == type_spc )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
606 sample_rate = Spc_Emu::native_sample_rate;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
607 if ( audcfg.resample )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
608 sample_rate = audcfg.resample_rate;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
609 track_info_t info;
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
610 if ( begin_get_info( path2, &info ) )
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
611 return;
1128
69b1707d83a5 [svn] - fix NSFE metadata
nenolod
parents: 1127
diff changeset
612 info.track = track;
69b1707d83a5 [svn] - fix NSFE metadata
nenolod
parents: 1127
diff changeset
613
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
614 // load in emulator and get info
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
615 switch ( type )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
616 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
617 case type_nsf: load_file( tag, in, sample_rate, &info, (Nsf_Emu*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
618 case type_nsfe:load_file( tag, in, sample_rate, &info, (Nsfe_Emu*)0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
619 case type_gbs: load_file( tag, in, sample_rate, &info, (Gbs_Emu*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
620 case type_gym: load_file( tag, in, sample_rate, &info, (Gym_Emu*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
621 case type_vgm: load_file( tag, in, sample_rate, &info, (Vgm_Emu*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
622 case type_spc: load_file( tag, in, sample_rate, &info, (Spc_Emu*) 0 ); break;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
623 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
624 in.close();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
625 if ( !emu )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
626 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
627
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
628 // set info
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
629 int length = -1;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
630 bool has_length = false;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
631 char* title = end_get_info( info, &length, &has_length );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
632 if ( title )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
633 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
634 console_ip.set_info( title, length, emu->voice_count() * 1000, sample_rate, 2 );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
635 g_free( title );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
636 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
637
1006
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
638 // set frequency equalization
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
639 if ( audcfg.treble || audcfg.bass )
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
640 {
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
641 Music_Emu::equalizer_t eq = emu->equalizer();
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
642
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
643 // bass - logarithmic, 2 to 8194 Hz
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
644 double bass = 1.0 - (audcfg.bass / 200.0 + 0.5);
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
645 eq.bass = (long int) pow(2.0, bass * 13.0) + (long int) 2.0;
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
646
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
647 // treble - -50 to 0 to +5 dB
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
648 double treble = audcfg.treble / 100.0;
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
649 eq.treble = treble * (treble < 0 ? 50.0 : 5.0);
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
650
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
651 emu->set_equalizer(eq);
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
652 }
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
653
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
654 // start
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
655 if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
656 return;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
657 pending_seek = -1;
528
980261e29f97 [svn] Patch for improved GYM/VGM file support ala blargg.
nenolod
parents: 499
diff changeset
658 track_ended = 0;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
659 track_emu.start_track( emu, track, length, !has_length );
499
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
660 console_ip_is_going = 1;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
661 decode_thread = g_thread_create( play_loop_track, NULL, TRUE, NULL );
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
662 g_free(path2);
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
663 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
664
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
665 static void seek( gint time )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
666 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
667 // to do: be sure seek works at all
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
668 // to do: disallow seek on slow formats (SPC, GYM, VGM using FM)?
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
669 pending_seek = time;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
670 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
671
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
672 static void console_stop(void)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
673 {
499
626c86bda311 [svn] If a track has a length, then we *really* do not want silence detection,
nenolod
parents: 497
diff changeset
674 console_ip_is_going = 0;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
675 if ( decode_thread )
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
676 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
677 g_thread_join( decode_thread );
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
678 decode_thread = NULL;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
679 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
680 console_ip.output->close_audio();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
681 unload_file();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
682 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
683
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
684 static void console_pause(gshort p)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
685 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
686 console_ip.output->pause(p);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
687 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
688
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
689 static int get_time(void)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
690 {
497
dfba4ac44dd8 [svn] New output driver which makes use of Output objects ability to flush
nenolod
parents: 496
diff changeset
691 return console_ip_is_going ? console_ip.output->output_time() : -1;
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
692 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
693
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
694 static gint is_our_file( gchar* path )
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
695 {
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
696 Audacious_Reader in;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
697 tag_t tag;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
698
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
699 // extract the subsong id from the virtual path
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
700 gchar *path2 = g_strdup(path);
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
701 gchar *_path = strchr(path2, '?');
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
702 gboolean is_subsong = FALSE;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
703 gint type;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
704
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
705 if (_path != NULL && *_path == '?')
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
706 {
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
707 *_path = '\0';
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
708 _path++;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
709 is_subsong = TRUE;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
710 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
711
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
712 gint ret = !in.open( path2 ) && !in.read( tag, sizeof tag ) && (type = identify_file( path2, tag ));
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
713
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
714 if (ret == TRUE && is_subsong == FALSE)
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
715 {
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
716 if (type == type_spc || type == type_gym || type == type_vgm)
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
717 {
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
718 g_free(path2);
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
719 return ret;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
720 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
721
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
722 // do subsong stuff here
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
723 ret = FALSE; // dewire track 0 from this stuff
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
724
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
725 switch ( type )
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
726 {
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
727 case type_nsf: load_file( tag, in, 0, NULL, (Nsf_Emu*) 0 ); break;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
728 case type_nsfe:load_file( tag, in, 0, NULL, (Nsfe_Emu*)0 ); break;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
729 case type_gbs: load_file( tag, in, 0, NULL, (Gbs_Emu*) 0 ); break;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
730 case type_gym: load_file( tag, in, 0, NULL, (Gym_Emu*) 0 ); break;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
731 case type_vgm: load_file( tag, in, 0, NULL, (Vgm_Emu*) 0 ); break;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
732 case type_spc: load_file( tag, in, 0, NULL, (Spc_Emu*) 0 ); break;
1223
f1e57db353a3 [svn] - Don't crash when we encounter an unsupported NSF/NSFE type
nenolod
parents: 1198
diff changeset
733 default: return FALSE;
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
734 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
735
1223
f1e57db353a3 [svn] - Don't crash when we encounter an unsupported NSF/NSFE type
nenolod
parents: 1198
diff changeset
736 if (emu == NULL)
f1e57db353a3 [svn] - Don't crash when we encounter an unsupported NSF/NSFE type
nenolod
parents: 1198
diff changeset
737 return FALSE;
f1e57db353a3 [svn] - Don't crash when we encounter an unsupported NSF/NSFE type
nenolod
parents: 1198
diff changeset
738
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
739 for (int i = 0; i < emu->track_count(); i++)
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
740 {
1127
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
741 gchar _buf[65535];
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
742 g_snprintf(_buf, 65535, "%s?%d", path2, i);
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
743
a49cc8e8e38d [svn] - present subsongs as playlist entities (will be enqueued at the current position)
nenolod
parents: 1126
diff changeset
744 playlist_add_url(_buf);
1126
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
745 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
746
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
747 unload_file();
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
748 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
749
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
750 g_free(path2);
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
751 return ret;
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
752 }
537e8cc47060 [svn] - allow load_file<class Emu> to load files into the parser without reading the tag information
nenolod
parents: 1125
diff changeset
753
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
754 // Setup
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
755
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
756 static void console_init(void)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
757 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
758 ConfigDb *db;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
759
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
760 db = bmp_cfg_db_open();
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
761
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
762 bmp_cfg_db_get_int(db, "console", "loop_length", &audcfg.loop_length);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
763 bmp_cfg_db_get_bool(db, "console", "resample", &audcfg.resample);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
764 bmp_cfg_db_get_int(db, "console", "resample_rate", &audcfg.resample_rate);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
765 bmp_cfg_db_get_bool(db, "console", "nsfe_playlist", &audcfg.nsfe_playlist);
1006
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
766 bmp_cfg_db_get_int(db, "console", "treble", &audcfg.treble);
8f1b7d07bef5 [svn] via Shay Green:
nenolod
parents: 900
diff changeset
767 bmp_cfg_db_get_int(db, "console", "bass", &audcfg.bass);
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
768
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
769 bmp_cfg_db_close(db);
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
770 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
771
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
772 extern "C" void console_aboutbox(void)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
773 {
900
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
774 static GtkWidget * aboutbox = NULL;
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
775
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
776 if (!aboutbox)
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
777 {
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
778 aboutbox = xmms_show_message(_("About the Console Music Decoder"),
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
779 _("Console music decoder engine based on Game_Music_Emu 0.3.0.\n"
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
780 "Audacious implementation by: William Pitcock <nenolod@nenolod.net>, \n"
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
781 // Please do not put my hotpop.com address in the clear (I hate spam)
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
782 " Shay Green <hotpop.com@blargg>"),
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
783 _("Ok"),
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
784 FALSE, NULL, NULL);
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
785 gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy",
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
786 (GCallback)gtk_widget_destroyed, &aboutbox);
9eaff2f6cd4b [svn] prevent libconsole aboutbox from spawning multiple times
giacomo
parents: 701
diff changeset
787 }
493
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
788 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
789
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
790 InputPlugin console_ip =
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
791 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
792 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
793 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
794 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
795 console_init,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
796 console_aboutbox,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
797 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
798 is_our_file,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
799 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
800 play_file,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
801 console_stop,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
802 console_pause,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
803 seek,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
804 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
805 get_time,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
806 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
807 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
808 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
809 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
810 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
811 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
812 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
813 get_song_info,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
814 NULL,
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
815 NULL
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
816 };
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
817
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
818 extern "C" InputPlugin *get_iplugin_info(void)
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
819 {
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
820 console_ip.description = g_strdup_printf(_("SPC, VGM, NSF/NSFE, GBS, and GYM module decoder"));
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
821 return &console_ip;
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
822 }
c04dff121e1d [svn] hostile merge, phase 2: reimport based on new plugin code
nenolod
parents:
diff changeset
823