From 13cbade08a07296d92e7a7d3e20475de0032cba1 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Wed, 31 Aug 2011 19:19:49 +0000 Subject: Update libgme to Blargg's Game_Music_Emu 0.6-pre. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30397 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libgme/ay_emu.h | 71 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 37 deletions(-) (limited to 'apps/codecs/libgme/ay_emu.h') diff --git a/apps/codecs/libgme/ay_emu.h b/apps/codecs/libgme/ay_emu.h index b320e69653..7334167876 100644 --- a/apps/codecs/libgme/ay_emu.h +++ b/apps/codecs/libgme/ay_emu.h @@ -10,14 +10,12 @@ #include "z80_cpu.h" #include "ay_apu.h" #include "m3u_playlist.h" - -typedef short sample_t; +#include "track_filter.h" // 64K memory to load code and data into before starting track. Caller // must parse the AY file. enum { mem_size = 0x10000 }; enum { ram_addr = 0x4000 }; // where official RAM starts -enum { buf_size = 2048 }; // AY file header enum { header_size = 0x14 }; @@ -62,43 +60,30 @@ struct Ay_Emu { bool cpc_mode; // general - int max_initial_silence; int voice_count; + int const* voice_types; int mute_mask_; int tempo; int gain; - long sample_rate; + int sample_rate; // track-specific int current_track; int track_count; - blargg_long out_time; // number of samples played since start of track - blargg_long emu_time; // number of samples emulator has generated since start of track - volatile bool track_ended; - bool emu_track_ended_; // emulator has reached end of track - - // fading - blargg_long fade_start; - int fade_step; - - // silence detection - bool ignore_silence; - int silence_lookahead; // speed to run emulator when looking ahead for silence - long silence_time; // number of samples where most recent silence began - long silence_count; // number of samples of silence to play before using buf - long buf_remain; // number of samples left in silence buffer - - long clock_rate_; + + int clock_rate_; unsigned buf_changed_count; // M3u Playlist struct M3u_Playlist m3u; // large items + struct setup_t tfilter; + struct Track_Filter track_filter; + struct Ay_Apu apu; - sample_t buf [buf_size]; - struct Stereo_Buffer stereo_buf; // NULL if using custom buffer + struct Multi_Buffer stereo_buf; // NULL if using custom buffer struct Z80_Cpu cpu; struct mem_t mem; }; @@ -106,46 +91,58 @@ struct Ay_Emu { // Basic functionality (see Gme_File.h for file loading/track info functions) void Ay_init( struct Ay_Emu* this ); -blargg_err_t Ay_load_mem( struct Ay_Emu* this, byte const in [], int size ); +blargg_err_t Ay_load_mem( struct Ay_Emu* this, byte const in [], long size ); // Set output sample rate. Must be called only once before loading file. -blargg_err_t Ay_set_sample_rate( struct Ay_Emu* this, long sample_rate ); +blargg_err_t Ay_set_sample_rate( struct Ay_Emu* this, int sample_rate ); // Start a track, where 0 is the first track. Also clears warning string. blargg_err_t Ay_start_track( struct Ay_Emu* this, int track ); // Generate 'count' samples info 'buf'. Output is in stereo. Any emulation // errors set warning string, and major errors also end track. -blargg_err_t Ay_play( struct Ay_Emu* this, long count, sample_t* buf ); +blargg_err_t Ay_play( struct Ay_Emu* this, int count, sample_t* buf ); // Track status/control // Number of milliseconds (1000 msec = 1 second) played since beginning of track -long Track_tell( struct Ay_Emu* this ); +int Track_tell( struct Ay_Emu* this ); // Seek to new time in track. Seeking backwards or far forward can take a while. -blargg_err_t Track_seek( struct Ay_Emu* this, long msec ); - +blargg_err_t Track_seek( struct Ay_Emu* this, int msec ); + // Skip n samples -blargg_err_t Track_skip( struct Ay_Emu* this, long n ); - +blargg_err_t Track_skip( struct Ay_Emu* this, int n ); + // Set start time and length of track fade out. Once fade ends track_ended() returns // true. Fade time can be changed while track is playing. -void Track_set_fade( struct Ay_Emu* this, long start_msec, long length_msec ); +void Track_set_fade( struct Ay_Emu* this, int start_msec, int length_msec ); + +// True if a track has reached its end +static inline bool Track_ended( struct Ay_Emu* this ) +{ + return track_ended( &this->track_filter ); +} + +// Disables automatic end-of-track detection and skipping of silence at beginning +static inline void Track_ignore_silence( struct Ay_Emu* this, bool disable ) +{ + this->track_filter.silence_ignored_ = disable; +} // Get track length in milliseconds -long Track_get_length( struct Ay_Emu* this, int n ); +int Track_get_length( struct Ay_Emu* this, int n ); // Sound customization // Adjust song tempo, where 1.0 = normal, 0.5 = half speed, 2.0 = double speed. // Track length as returned by track_info() assumes a tempo of 1.0. void Sound_set_tempo( struct Ay_Emu* this, int t ); - + // Mute/unmute voice i, where voice 0 is first voice void Sound_mute_voice( struct Ay_Emu* this, int index, bool mute ); - + // Set muting state of all voices at once using a bit mask, where -1 mutes them all, // 0 unmutes them all, 0x01 mutes just the first voice, etc. void Sound_mute_voices( struct Ay_Emu* this, int mask ); @@ -168,5 +165,5 @@ static inline void disable_beeper( struct Ay_Emu *this ) this->beeper_mask = 0; this->last_beeper = 0; } - + #endif -- cgit v1.2.3