1 // Loads NSF file and emulates CPU and sound chips 2 3 // Game_Music_Emu $vers 4 #ifndef NSF_CORE_H 5 #define NSF_CORE_H 6 7 #include "Nsf_Impl.h" 8 9 class Nes_Namco_Apu; 10 class Nes_Vrc6_Apu; 11 class Nes_Fme7_Apu; 12 class Nes_Mmc5_Apu; 13 class Nes_Vrc7_Apu; 14 class Nes_Fds_Apu; 15 16 class Nsf_Core : public Nsf_Impl { 17 public: 18 19 // Adjusts music tempo, where 1.0 is normal. Can be changed while playing. 20 // Loading a file resets tempo to 1.0. 21 void set_tempo( double ); 22 23 // Pointer to sound chip, or NULL if not used by current file. 24 // Must be assigned to a Blip_Buffer to get any sound. fds_apu()25 Nes_Fds_Apu * fds_apu () { return fds; } fme7_apu()26 Nes_Fme7_Apu * fme7_apu () { return fme7; } mmc5_apu()27 Nes_Mmc5_Apu * mmc5_apu () { return mmc5; } namco_apu()28 Nes_Namco_Apu* namco_apu() { return namco; } vrc6_apu()29 Nes_Vrc6_Apu * vrc6_apu () { return vrc6; } vrc7_apu()30 Nes_Vrc7_Apu * vrc7_apu () { return vrc7; } 31 32 // Mask for which chips are supported 33 #if NSF_EMU_APU_ONLY 34 enum { chips_mask = 0 }; 35 #else 36 enum { chips_mask = header_t::all_mask }; 37 #endif 38 39 protected: 40 virtual int unmapped_read( addr_t ); 41 virtual void unmapped_write( addr_t, int data ); 42 43 44 // Implementation 45 public: 46 Nsf_Core(); 47 ~Nsf_Core(); 48 virtual void unload(); 49 virtual blargg_err_t start_track( int ); 50 virtual void end_frame( time_t ); 51 52 protected: 53 virtual blargg_err_t post_load(); 54 virtual int cpu_read( addr_t ); 55 virtual void cpu_write( addr_t, int ); 56 57 private: 58 byte mmc5_mul [2]; 59 60 Nes_Fds_Apu* fds; 61 Nes_Fme7_Apu* fme7; 62 Nes_Mmc5_Apu* mmc5; 63 Nes_Namco_Apu* namco; 64 Nes_Vrc6_Apu* vrc6; 65 Nes_Vrc7_Apu* vrc7; 66 }; 67 68 #endif 69