1 // Atari XL/XE SAP music file emulator
2 
3 // Game_Music_Emu $vers
4 #ifndef SAP_EMU_H
5 #define SAP_EMU_H
6 
7 #include "Classic_Emu.h"
8 #include "Sap_Apu.h"
9 #include "Sap_Core.h"
10 
11 class Sap_Emu : public Classic_Emu {
12 public:
13 	enum { max_tracks = 32 }; // TODO: no fixed limit
14 
15 	// SAP file info (see Sap_Core.h for more)
16 	struct info_t : Sap_Core::info_t {
17 		byte const* rom_data;
18 		const char* warning;
19 		int  track_count;
20 		int  track_times [max_tracks];
21 		char author    [256];
22 		char name      [256];
23 		char copyright [ 32];
24 	};
25 
26 	// Info for currently loaded file
info()27 	info_t const& info() const { return info_; }
28 
29 	blargg_err_t hash_( Hash_Function& ) const;
30 
static_type()31 	static gme_type_t static_type() { return gme_sap_type; }
32 
33 // Implementation
34 public:
35 	Sap_Emu();
36 	~Sap_Emu();
37 
38 protected:
39 	virtual blargg_err_t track_info_( track_info_t*, int track ) const;
40 	virtual blargg_err_t load_mem_( byte const [], int );
41 	virtual blargg_err_t start_track_( int );
42 	virtual blargg_err_t run_clocks( blip_time_t&, int );
43 	virtual void set_tempo_( double );
44 	virtual void set_voice( int, Blip_Buffer*, Blip_Buffer*, Blip_Buffer* );
45 	virtual void update_eq( blip_eq_t const& );
46 
47 private:
48 	info_t info_;
49 	byte const* file_end;
50 	Sap_Core core;
51 };
52 
53 #endif
54