2007-10-11 23:11:58 +00:00
|
|
|
// Nintendo NES/Famicom NSF music file emulator
|
|
|
|
|
2013-09-28 03:24:23 +00:00
|
|
|
// Game_Music_Emu $vers
|
2007-10-11 23:11:58 +00:00
|
|
|
#ifndef NSF_EMU_H
|
|
|
|
#define NSF_EMU_H
|
|
|
|
|
|
|
|
#include "Classic_Emu.h"
|
2013-09-28 03:24:23 +00:00
|
|
|
#include "Nsf_Core.h"
|
2007-10-11 23:11:58 +00:00
|
|
|
|
2013-09-28 03:24:23 +00:00
|
|
|
void hash_nsf_file( Nsf_Core::header_t const& h, unsigned char const* data, int data_size, Music_Emu::Hash_Function& out );
|
|
|
|
|
|
|
|
class Nsf_Emu : public Classic_Emu {
|
2007-10-11 23:11:58 +00:00
|
|
|
public:
|
|
|
|
// Equalizer profiles for US NES and Japanese Famicom
|
|
|
|
static equalizer_t const nes_eq;
|
|
|
|
static equalizer_t const famicom_eq;
|
|
|
|
|
2013-09-28 03:24:23 +00:00
|
|
|
// NSF file header (see Nsf_Impl.h)
|
|
|
|
typedef Nsf_Core::header_t header_t;
|
2007-10-11 23:11:58 +00:00
|
|
|
|
|
|
|
// Header for currently loaded file
|
2013-09-28 03:24:23 +00:00
|
|
|
header_t const& header() const { return core_.header(); }
|
|
|
|
|
|
|
|
blargg_err_t hash_( Hash_Function& ) const;
|
2007-10-11 23:11:58 +00:00
|
|
|
|
|
|
|
static gme_type_t static_type() { return gme_nsf_type; }
|
|
|
|
|
2013-09-28 03:24:23 +00:00
|
|
|
Nsf_Core& core() { return core_; }
|
|
|
|
|
2007-10-11 23:11:58 +00:00
|
|
|
public:
|
|
|
|
Nsf_Emu();
|
|
|
|
~Nsf_Emu();
|
2013-09-28 03:24:23 +00:00
|
|
|
virtual void unload();
|
|
|
|
|
2007-10-11 23:11:58 +00:00
|
|
|
protected:
|
2013-09-28 03:24:23 +00:00
|
|
|
virtual blargg_err_t track_info_( track_info_t*, int track ) const;
|
|
|
|
virtual blargg_err_t load_( Data_Reader& );
|
|
|
|
virtual blargg_err_t start_track_( int );
|
|
|
|
virtual blargg_err_t run_clocks( blip_time_t&, int );
|
|
|
|
virtual void set_tempo_( double );
|
|
|
|
virtual void set_voice( int, Blip_Buffer*, Blip_Buffer*, Blip_Buffer* );
|
|
|
|
virtual void update_eq( blip_eq_t const& );
|
2007-10-11 23:11:58 +00:00
|
|
|
|
|
|
|
private:
|
2013-09-28 03:24:23 +00:00
|
|
|
enum { max_voices = 32 };
|
|
|
|
const char* voice_names_ [32];
|
|
|
|
int voice_types_ [32];
|
|
|
|
int voice_count_;
|
|
|
|
Nsf_Core core_;
|
2007-10-11 23:11:58 +00:00
|
|
|
|
2013-09-28 03:24:23 +00:00
|
|
|
blargg_err_t init_sound();
|
|
|
|
void append_voices( const char* const names [], int const types [], int count );
|
2007-10-11 23:11:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|