mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-24 15:37:38 -04:00
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
This commit is contained in:
parent
d089e10403
commit
13cbade08a
68 changed files with 4113 additions and 4893 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Multi-channel sound buffer interface, and basic mono and stereo buffers
|
||||
// Multi-channel sound buffer interface, stereo and effects buffers
|
||||
|
||||
// Blip_Buffer 0.4.1
|
||||
#ifndef MULTI_BUFFER_H
|
||||
|
|
@ -16,57 +16,99 @@ struct channel_t {
|
|||
|
||||
enum { type_index_mask = 0xFF };
|
||||
enum { wave_type = 0x100, noise_type = 0x200, mixed_type = wave_type | noise_type };
|
||||
enum { buf_count = 3 };
|
||||
|
||||
struct Stereo_Buffer {
|
||||
struct Blip_Buffer bufs [buf_count];
|
||||
struct channel_t chan;
|
||||
int stereo_added;
|
||||
int was_stereo;
|
||||
|
||||
unsigned channels_changed_count_;
|
||||
long sample_rate_;
|
||||
int length_;
|
||||
int samples_per_frame_;
|
||||
enum { stereo = 2 };
|
||||
enum { bufs_size = 3 };
|
||||
|
||||
// Tracked_Blip_Buffer
|
||||
struct Tracked_Blip_Buffer {
|
||||
struct Blip_Buffer blip;
|
||||
int last_non_silence;
|
||||
};
|
||||
|
||||
// Initializes Stereo_Buffer structure
|
||||
void Buffer_init( struct Stereo_Buffer* this );
|
||||
void Tracked_init( struct Tracked_Blip_Buffer* this );
|
||||
unsigned Tracked_non_silent( struct Tracked_Blip_Buffer* this );
|
||||
void Tracked_remove_all_samples( struct Tracked_Blip_Buffer * this );
|
||||
int Tracked_read_samples( struct Tracked_Blip_Buffer* this, blip_sample_t [], int );
|
||||
void Tracked_remove_silence( struct Tracked_Blip_Buffer* this, int );
|
||||
void Tracked_remove_samples( struct Tracked_Blip_Buffer* this, int );
|
||||
void Tracked_clear( struct Tracked_Blip_Buffer* this );
|
||||
void Tracked_end_frame( struct Tracked_Blip_Buffer* this, blip_time_t );
|
||||
|
||||
blargg_err_t Buffer_set_sample_rate( struct Stereo_Buffer* this, long, int msec );
|
||||
void Buffer_clock_rate( struct Stereo_Buffer* this, long );
|
||||
void Buffer_bass_freq( struct Stereo_Buffer* this, int );
|
||||
void Buffer_clear( struct Stereo_Buffer* this );
|
||||
struct channel_t Buffer_channel( struct Stereo_Buffer* this );
|
||||
void Buffer_end_frame( struct Stereo_Buffer* this, blip_time_t );
|
||||
|
||||
long Buffer_read_samples( struct Stereo_Buffer* this, blip_sample_t*, long );
|
||||
|
||||
// Count of changes to channel configuration. Incremented whenever
|
||||
// a change is made to any of the Blip_Buffers for any channel.
|
||||
unsigned Buffer_channels_changed_count( struct Stereo_Buffer* this );
|
||||
void Buffer_channels_changed( struct Stereo_Buffer* this );
|
||||
|
||||
void Buffer_mix_stereo_no_center( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
|
||||
void Buffer_mix_stereo( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
|
||||
void Buffer_mix_mono( struct Stereo_Buffer* this, blip_sample_t*, blargg_long );
|
||||
|
||||
// Number of samples per output frame (1 = mono, 2 = stereo)
|
||||
static inline int Buffer_samples_per_frame( struct Stereo_Buffer* this )
|
||||
static inline delta_t unsettled( struct Blip_Buffer* this )
|
||||
{
|
||||
return this->samples_per_frame_;
|
||||
return this->reader_accum_ >> delta_bits;
|
||||
}
|
||||
|
||||
// See Blip_Buffer.h
|
||||
static inline long Buffer_sample_rate( struct Stereo_Buffer* this )
|
||||
{
|
||||
return this->sample_rate_;
|
||||
}
|
||||
// Stereo Mixer
|
||||
struct Stereo_Mixer {
|
||||
struct Tracked_Blip_Buffer* bufs [3];
|
||||
int samples_read;
|
||||
};
|
||||
|
||||
// Length of buffer, in milliseconds
|
||||
static inline int Buffer_length( struct Stereo_Buffer* this )
|
||||
void Mixer_init( struct Stereo_Mixer* this );
|
||||
void Mixer_read_pairs( struct Stereo_Mixer* this, blip_sample_t out [], int count );
|
||||
|
||||
typedef struct Tracked_Blip_Buffer buf_t;
|
||||
|
||||
// Multi_Buffer
|
||||
struct Multi_Buffer {
|
||||
unsigned channels_changed_count_;
|
||||
int sample_rate_;
|
||||
int length_;
|
||||
int channel_count_;
|
||||
int samples_per_frame_;
|
||||
int const *channel_types_;
|
||||
bool immediate_removal_;
|
||||
|
||||
buf_t bufs [bufs_size];
|
||||
struct Stereo_Mixer mixer;
|
||||
struct channel_t chan;
|
||||
};
|
||||
|
||||
blargg_err_t Buffer_set_channel_count( struct Multi_Buffer* this, int n, int const* types );
|
||||
|
||||
// Buffers used for all channels
|
||||
static inline struct Blip_Buffer* center( struct Multi_Buffer* this ) { return &this->bufs [2].blip; }
|
||||
static inline struct Blip_Buffer* left( struct Multi_Buffer* this ) { return &this->bufs [0].blip; }
|
||||
static inline struct Blip_Buffer* right( struct Multi_Buffer* this ) { return &this->bufs [1].blip; }
|
||||
|
||||
// Initializes Multi_Buffer structure
|
||||
void Buffer_init( struct Multi_Buffer* this );
|
||||
|
||||
blargg_err_t Buffer_set_sample_rate( struct Multi_Buffer* this, int, int msec );
|
||||
void Buffer_clock_rate( struct Multi_Buffer* this, int );
|
||||
void Buffer_bass_freq( struct Multi_Buffer* this, int );
|
||||
void Buffer_clear( struct Multi_Buffer* this );
|
||||
void Buffer_end_frame( struct Multi_Buffer* this, blip_time_t ) ICODE_ATTR;
|
||||
|
||||
static inline int Buffer_length( struct Multi_Buffer* this )
|
||||
{
|
||||
return this->length_;
|
||||
}
|
||||
|
||||
// Count of changes to channel configuration. Incremented whenever
|
||||
// a change is made to any of the Blip_Buffers for any channel.
|
||||
static inline unsigned Buffer_channels_changed_count( struct Multi_Buffer* this )
|
||||
{
|
||||
return this->channels_changed_count_;
|
||||
}
|
||||
|
||||
static inline void Buffer_disable_immediate_removal( struct Multi_Buffer* this )
|
||||
{
|
||||
this->immediate_removal_ = false;
|
||||
}
|
||||
|
||||
static inline int Buffer_sample_rate( struct Multi_Buffer* this )
|
||||
{
|
||||
return this->sample_rate_;
|
||||
}
|
||||
|
||||
static inline int Buffer_samples_avail( struct Multi_Buffer* this )
|
||||
{
|
||||
return (Blip_samples_avail(&this->bufs [0].blip) - this->mixer.samples_read) * 2;
|
||||
}
|
||||
|
||||
int Buffer_read_samples( struct Multi_Buffer* this, blip_sample_t*, int ) ICODE_ATTR;
|
||||
struct channel_t Buffer_channel( struct Multi_Buffer* this, int i );
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue