diff options
author | 2009-07-06 22:43:23 +0200 | |
---|---|---|
committer | 2009-07-06 22:49:04 +0200 | |
commit | 55cba1db948c3d6650a0d4162ffcd09ca73fe3a1 (patch) | |
tree | 534751d06881215854a7b15192983b5897e34c32 /gme/M3u_Playlist.h | |
parent | 02ed1cff137002904fb1d1413315769a7b7083d8 (diff) |
added GME support ; added subtune support
Diffstat (limited to 'gme/M3u_Playlist.h')
-rw-r--r-- | gme/M3u_Playlist.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gme/M3u_Playlist.h b/gme/M3u_Playlist.h new file mode 100644 index 00000000..eda0dc89 --- /dev/null +++ b/gme/M3u_Playlist.h @@ -0,0 +1,67 @@ +// M3U playlist file parser, with support for subtrack information + +// Game_Music_Emu 0.5.2 +#ifndef M3U_PLAYLIST_H +#define M3U_PLAYLIST_H + +#include "blargg_common.h" +#include "Data_Reader.h" + +class M3u_Playlist { +public: + // Load playlist data + blargg_err_t load( const char* path ); + blargg_err_t load( Data_Reader& in ); + blargg_err_t load( void const* data, long size ); + + // Line number of first parse error, 0 if no error. Any lines with parse + // errors are ignored. + int first_error() const { return first_error_; } + + struct info_t + { + const char* title; + const char* composer; + const char* engineer; + const char* ripping; + const char* tagging; + }; + info_t const& info() const { return info_; } + + struct entry_t + { + const char* file; // filename without stupid ::TYPE suffix + const char* type; // if filename has ::TYPE suffix, this will be "TYPE". "" if none. + const char* name; + bool decimal_track; // true if track was specified in hex + // integers are -1 if not present + int track; // 1-based + int length; // seconds + int intro; + int loop; + int fade; + int repeat; // count + }; + entry_t const& operator [] ( int i ) const { return entries [i]; } + int size() const { return entries.size(); } + + void clear(); + +private: + blargg_vector<entry_t> entries; + blargg_vector<char> data; + int first_error_; + info_t info_; + + blargg_err_t parse(); + blargg_err_t parse_(); +}; + +inline void M3u_Playlist::clear() +{ + first_error_ = 0; + entries.clear(); + data.clear(); +} + +#endif |