annotate src/console/gme.h @ 3052:95b34f46a231

Comment out MPEG2/MPEG4 determination using the variable id. It is not used anywhere. Code analysis run, unique ID 6nYoHM.
author Tony Vroon <chainsaw@gentoo.org>
date Sat, 18 Apr 2009 19:06:20 +0100
parents 986f098da058
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
1 /* Game music emulator library C interface (also usable from C++) */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
2
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
3 /* Game_Music_Emu 0.5.2 */
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
4 #ifndef GME_H
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
5 #define GME_H
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
6
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
7 #ifdef __cplusplus
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
8 extern "C" {
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
9 #endif
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
10
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
11 /* Error string returned by library functions, or NULL if no error (success) */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
12 typedef const char* gme_err_t;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
13
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
14 /* First parameter of most gme_ functions is a pointer to the Music_Emu */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
15 typedef struct Music_Emu Music_Emu;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
16
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
17
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
18 /******** Basic operations ********/
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
19
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
20 /* Create emulator and load game music file/data into it. Sets *out to new emulator. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
21 gme_err_t gme_open_file( const char* path, Music_Emu** out, long sample_rate );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
22
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
23 /* Number of tracks available */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
24 int gme_track_count( Music_Emu const* );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
25
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
26 /* Start a track, where 0 is the first track */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
27 gme_err_t gme_start_track( Music_Emu*, int index );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
28
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
29 /* Generate 'count' 16-bit signed samples info 'out'. Output is in stereo. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
30 gme_err_t gme_play( Music_Emu*, long count, short* out );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
31
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
32 /* Finish using emulator and free memory */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
33 void gme_delete( Music_Emu* );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
34
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
35
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
36 /******** Track position/length ********/
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
37
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
38 /* Set time to start fading track out. Once fade ends track_ended() returns true.
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
39 Fade time can be changed while track is playing. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
40 void gme_set_fade( Music_Emu*, long start_msec );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
41
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
42 /* True if a track has reached its end */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
43 int gme_track_ended( Music_Emu const* );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
44
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
45 /* Number of milliseconds (1000 = one second) played since beginning of track */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
46 long gme_tell( Music_Emu const* );
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
47
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
48 /* Seek to new time in track. Seeking backwards or far forward can take a while. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
49 gme_err_t gme_seek( Music_Emu*, long msec );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
50
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
51
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
52 /******** Informational ********/
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
53
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
54 /* If you only need track information from a music file, pass gme_info_only for
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
55 sample_rate to open/load. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
56 enum { gme_info_only = -1 };
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
57
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
58 /* Most recent warning string, or NULL if none. Clears current warning after returning.
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
59 Warning is also cleared when loading a file and starting a track. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
60 const char* gme_warning( Music_Emu* );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
61
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
62 /* Load m3u playlist file (must be done after loading music) */
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
63 gme_err_t gme_load_m3u( Music_Emu*, const char* path );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
64
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
65 /* Clear any loaded m3u playlist and any internal playlist that the music format
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
66 supports (NSFE for example). */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
67 void gme_clear_playlist( Music_Emu* );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
68
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
69 /* Get information for a particular track (length, name, author, etc.) */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
70 typedef struct track_info_t track_info_t;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
71 gme_err_t gme_track_info( Music_Emu const*, track_info_t* out, int track );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
72
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
73 struct track_info_t
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
74 {
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
75 long track_count;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
76
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
77 /* times in milliseconds; -1 if unknown */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
78 long length;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
79 long intro_length;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
80 long loop_length;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
81
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
82 /* empty string if not available */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
83 char system [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
84 char game [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
85 char song [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
86 char author [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
87 char copyright [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
88 char comment [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
89 char dumper [256];
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
90 };
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
91 enum { gme_max_field = 255 };
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
92
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
93
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
94 /******** Advanced playback ********/
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
95
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
96 /* Adjust stereo echo depth, where 0.0 = off and 1.0 = maximum. Has no effect for
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
97 GYM, SPC, and Sega Genesis VGM music */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
98 void gme_set_stereo_depth( Music_Emu*, double depth );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
99
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
100 /* Disable automatic end-of-track detection and skipping of silence at beginning
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
101 if ignore is true */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
102 void gme_ignore_silence( Music_Emu*, int ignore );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
103
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
104 /* Adjust song tempo, where 1.0 = normal, 0.5 = half speed, 2.0 = double speed.
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
105 Track length as returned by track_info() assumes a tempo of 1.0. */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
106 void gme_set_tempo( Music_Emu*, double tempo );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
107
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
108 /* Number of voices used by currently loaded file */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
109 int gme_voice_count( Music_Emu const* );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
110
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
111 /* Names of voices */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
112 const char** gme_voice_names( Music_Emu const* );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
113
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
114 /* Mute/unmute voice i, where voice 0 is first voice */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
115 void gme_mute_voice( Music_Emu*, int index, int mute );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
116
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
117 /* Set muting state of all voices at once using a bit mask, where -1 mutes all
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
118 voices, 0 unmutes them all, 0x01 mutes just the first voice, etc. */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
119 void gme_mute_voices( Music_Emu*, int muting_mask );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
120
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
121 /* Frequency equalizer parameters (see gme.txt) */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
122 typedef struct gme_equalizer_t
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
123 {
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
124 double treble; /* -50.0 = muffled, 0 = flat, +5.0 = extra-crisp */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
125 long bass; /* 1 = full bass, 90 = average, 16000 = almost no bass */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
126 } gme_equalizer_t;
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
127
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
128 /* Get current frequency equalizater parameters */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
129 gme_equalizer_t gme_equalizer( Music_Emu const* );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
130
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
131 /* Change frequency equalizer parameters */
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
132 void gme_set_equalizer( Music_Emu*, gme_equalizer_t const* eq );
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
133
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
134
341
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
135
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
136 /******** Game music types ********/
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
137
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
138 /* Emulator type constants for each supported file type */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
139 extern struct gme_type_t_ const gme_ay_type [], gme_gbs_type [], gme_gym_type [],
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
140 gme_hes_type [], gme_kss_type [], gme_nsf_type [], gme_nsfe_type [],
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
141 gme_sap_type [], gme_spc_type [], gme_vgm_type [], gme_vgz_type [];
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
142 typedef struct gme_type_t_ const* gme_type_t;
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
143
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
144 /* Type of this emulator */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
145 gme_type_t gme_type( Music_Emu const* );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
146
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
147 /* gme_type_t is a pointer to this structure. For example, gme_nsf_type->system is
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
148 "Nintendo NES" and gme_nsf_type->new_emu() is equilvant to new Nsf_Emu (in C++). */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
149 struct gme_type_t_
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
150 {
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
151 const char* system; /* name of system this music file type is generally for */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
152 int track_count; /* non-zero for formats with a fixed number of tracks */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
153 Music_Emu* (*new_emu)(); /* Create new emulator for this type (useful in C++ only) */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
154 Music_Emu* (*new_info)(); /* Create new info reader for this type */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
155
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
156 /* internal */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
157 const char* extension_;
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
158 int flags_;
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
159 };
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
160
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
161 /* Pointer to array of all music types, with NULL entry at end. Allows a player linked
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
162 to this library to support new music types without having to be updated. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
163 gme_type_t const* gme_type_list();
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
164
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
165
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
166 /******** Advanced file loading ********/
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
167
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
168 /* Error returned if file type is not supported */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
169 extern const char gme_wrong_file_type [];
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
170
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
171 /* Same as gme_open_file(), but uses file data already in memory. Makes copy of data. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
172 gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, long sample_rate );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
173
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
174 /* Determine likely game music type based on first four bytes of file. Returns
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
175 string containing proper file suffix (i.e. "NSF", "SPC", etc.) or "" if
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
176 file header is not recognized. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
177 const char* gme_identify_header( void const* header );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
178
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
179 /* Get corresponding music type for file path or extension passed in. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
180 gme_type_t gme_identify_extension( const char* path_or_extension );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
181
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
182 /* Determine file type based on file's extension or header (if extension isn't recognized).
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
183 Sets *type_out to type, or 0 if unrecognized or error. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
184 gme_err_t gme_identify_file( const char* path, gme_type_t* type_out );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
185
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
186 /* Create new emulator and set sample rate. Returns NULL if out of memory. If you only need
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
187 track information, pass gme_info_only for sample_rate. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
188 Music_Emu* gme_new_emu( gme_type_t, long sample_rate );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
189
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
190 /* Load music file into emulator */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
191 gme_err_t gme_load_file( Music_Emu*, const char* path );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
192
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
193 /* Load music file from memory into emulator. Makes a copy of data passed. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
194 gme_err_t gme_load_data( Music_Emu*, void const* data, long size );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
195
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
196 /* Load music file using custom data reader function that will be called to
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
197 read file data. Most emulators load the entire file in one read call. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
198 typedef gme_err_t (*gme_reader_t)( void* your_data, void* out, long count );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
199 gme_err_t gme_load_custom( Music_Emu*, gme_reader_t, long file_size, void* your_data );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
200
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
201 /* Load m3u playlist file from memory (must be done after loading music) */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
202 gme_err_t gme_load_m3u_data( Music_Emu*, void const* data, long size );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
203
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
204
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
205 /******** User data ********/
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
206
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
207 /* Set/get pointer to data you want to associate with this emulator.
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
208 You can use this for whatever you want. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
209 void gme_set_user_data( Music_Emu*, void* new_user_data );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
210 void* gme_user_data( Music_Emu const* );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
211
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
212 /* Register cleanup function to be called when deleting emulator, or NULL to
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
213 clear it. Passes user_data to cleanup function. */
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
214 typedef void (*gme_user_cleanup_t)( void* user_data );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
215 void gme_set_user_cleanup( Music_Emu*, gme_user_cleanup_t func );
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
216
986f098da058 [svn] - merge in blargg's changes
nenolod
parents: 316
diff changeset
217
316
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
218 #ifdef __cplusplus
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
219 }
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
220 #endif
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
221
fb513e10174e [svn] - merge libconsole-blargg into mainline libconsole:
nenolod
parents:
diff changeset
222 #endif