1 // Nintendo NES/Famicom NSFE music file emulator
2 
3 // Game_Music_Emu 0.5.5
4 #ifndef NSFE_EMU_H
5 #define NSFE_EMU_H
6 
7 #include "blargg_common.h"
8 #include "Nsf_Emu.h"
9 
10 // Allows reading info from NSFE file without creating emulator
11 class Nsfe_Info {
12 public:
13 	blargg_err_t load( Data_Reader&, Nsf_Emu* );
14 
15 	struct info_t : Nsf_Emu::header_t
16 	{
17 		char game      [256];
18 		char author    [256];
19 		char copyright [256];
20 		char dumper    [256];
21 	} info;
22 
23 	void disable_playlist( bool = true );
24 
25 	blargg_err_t track_info_( track_info_t* out, int track ) const;
26 
27 	int remap_track( int i ) const;
28 
29 	void unload();
30 
31 	Nsfe_Info();
32 	~Nsfe_Info();
33 private:
34 	blargg_vector<char> track_name_data;
35 	blargg_vector<const char*> track_names;
36 	blargg_vector<unsigned char> playlist;
37 	blargg_vector<char [4]> track_times;
38 	int actual_track_count_;
39 	bool playlist_disabled;
40 };
41 
42 class Nsfe_Emu : public Nsf_Emu {
43 public:
static_type()44 	static gme_type_t static_type() { return gme_nsfe_type; }
45 
46 public:
47 	// deprecated
48 	struct header_t { char tag [4]; };
49 	using Music_Emu::load;
load(header_t const & h,Data_Reader & in)50 	blargg_err_t load( header_t const& h, Data_Reader& in ) // use Remaining_Reader
51 			{ return load_remaining_( &h, sizeof h, in ); }
52 	void disable_playlist( bool = true ); // use clear_playlist()
53 
54 public:
55 	Nsfe_Emu();
56 	~Nsfe_Emu();
57 protected:
58 	blargg_err_t load_( Data_Reader& );
59 	blargg_err_t track_info_( track_info_t*, int track ) const;
60 	blargg_err_t start_track_( int );
61 	void unload();
62 	void clear_playlist_();
63 private:
64 	Nsfe_Info info;
65 	bool loading;
66 };
67 
68 #endif
69