1 // Nintendo Game Boy GBS music file emulator 2 3 // Game_Music_Emu $vers 4 #ifndef GBS_EMU_H 5 #define GBS_EMU_H 6 7 #include "Classic_Emu.h" 8 #include "Gbs_Core.h" 9 10 class Gbs_Emu : public Classic_Emu { 11 public: 12 // Equalizer profiles for Game Boy speaker and headphones 13 static equalizer_t const handheld_eq; 14 static equalizer_t const headphones_eq; 15 static equalizer_t const cgb_eq; // Game Boy Color headphones have less bass 16 17 // GBS file header (see Gbs_Core.h) 18 typedef Gbs_Core::header_t header_t; 19 20 // Header for currently loaded file header()21 header_t const& header() const { return core_.header(); } 22 23 // Selects which sound hardware to use. AGB hardware is cleaner than the 24 // others. Doesn't take effect until next start_track(). 25 enum sound_t { 26 sound_dmg = Gb_Apu::mode_dmg, // Game Boy monochrome 27 sound_cgb = Gb_Apu::mode_cgb, // Game Boy Color 28 sound_agb = Gb_Apu::mode_agb, // Game Boy Advance 29 sound_gbs // Use DMG/CGB based on GBS (default) 30 }; set_sound(sound_t s)31 void set_sound( sound_t s ) { sound_hardware = s; } 32 33 // If true, makes APU more accurate, which results in more clicking. 34 void enable_clicking( bool enable = true ) { core_.apu().reduce_clicks( !enable ); } 35 static_type()36 static gme_type_t static_type() { return gme_gbs_type; } 37 core()38 Gbs_Core& core() { return core_; } 39 40 blargg_err_t hash_( Hash_Function& ) const; 41 42 // Internal 43 public: 44 Gbs_Emu(); 45 ~Gbs_Emu(); 46 47 protected: 48 // Overrides 49 virtual blargg_err_t track_info_( track_info_t*, int track ) const; 50 virtual blargg_err_t load_( Data_Reader& ); 51 virtual blargg_err_t start_track_( int ); 52 virtual blargg_err_t run_clocks( blip_time_t&, int ); 53 virtual void set_tempo_( double ); 54 virtual void set_voice( int, Blip_Buffer*, Blip_Buffer*, Blip_Buffer* ); 55 virtual void update_eq( blip_eq_t const& ); 56 virtual void unload(); 57 58 private: 59 sound_t sound_hardware; 60 Gbs_Core core_; 61 }; 62 63 #endif 64