diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-17 22:20:09 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-17 22:20:09 +0000 |
| commit | 4d01ace73fdffca366211157b54418516b3a73b6 (patch) | |
| tree | 8165a373967a826ba67826b60f55911ac344c028 /apps/codecs/libgme/resampler.h | |
| parent | 4070f4f17b77a030049e146245fc9a399bb68204 (diff) | |
| download | rockbox-4d01ace73fdffca366211157b54418516b3a73b6.zip rockbox-4d01ace73fdffca366211157b54418516b3a73b6.tar.gz rockbox-4d01ace73fdffca366211157b54418516b3a73b6.tar.bz2 rockbox-4d01ace73fdffca366211157b54418516b3a73b6.tar.xz | |
Submit a patch to the VGM codec by Mauricio Gama which saves some more RAM through changes of the buffer configuration and an update of the resampler code. Additionally enable VGM for low memory targets and update the manual.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30327 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libgme/resampler.h')
| -rw-r--r-- | apps/codecs/libgme/resampler.h | 74 |
1 files changed, 41 insertions, 33 deletions
diff --git a/apps/codecs/libgme/resampler.h b/apps/codecs/libgme/resampler.h index 3106b84..1d8f866 100644 --- a/apps/codecs/libgme/resampler.h +++ b/apps/codecs/libgme/resampler.h @@ -4,10 +4,10 @@ #ifndef RESAMPLER_H #define RESAMPLER_H -#include "blargg_config.h" +#include "blargg_common.h" #include "multi_buffer.h" -typedef short dsample_t; +typedef short sample_t; enum { stereo = 2 }; enum { max_buf_size = 3960 }; @@ -15,54 +15,62 @@ enum { max_resampler_size = 5942 }; enum { write_offset = 8 * stereo }; enum { gain_bits = 14 }; -struct Resampler { - int (*callback)( void*, blip_time_t, int, dsample_t* ); - void* callback_data; - - dsample_t sample_buf [max_buf_size]; - int sample_buf_size; - int oversamples_per_frame; - int buf_pos; - int resampler_size; - int gain_; - - // Internal resampler - dsample_t buf [max_resampler_size]; - int buffer_size; - - int write_pos; - int rate_; - - int pos; - int step; +struct Resampler { + int (*callback)( void*, blip_time_t, int, sample_t* ); + void* callback_data; + + int sample_buffer_size; + int sample_buf_size; + int oversamples_per_frame; + int buf_pos; + int resampler_size; + int gain_; + + int buffer_size; + int write_pos; + + int pos; + int step; + + int rate_; + + sample_t sample_buf [max_buf_size]; + sample_t buf [max_resampler_size]; // Internal resampler }; static inline void Resampler_init( struct Resampler* this ) { - this->pos = 0; - this->write_pos = 0; - this->rate_ = 0; + this->pos = 0; + this->write_pos = 0; + this->rate_ = 0; + this->sample_buf_size = 0; + this->sample_buffer_size = 0; + this->oversamples_per_frame = 0; } blargg_err_t Resampler_reset( struct Resampler* this, int max_pairs ); void Resampler_resize( struct Resampler* this, int pairs_per_frame ); - -void Resampler_play( struct Resampler* this, long count, dsample_t* out, struct Stereo_Buffer* ); +void Resampler_play( struct Resampler* this, int count, sample_t* out, struct Blip_Buffer* ); -static inline void Resampler_set_callback(struct Resampler* this, int (*func)( void*, blip_time_t, int, dsample_t* ), void* user_data ) +static inline void Resampler_set_callback(struct Resampler* this, int (*func)( void*, blip_time_t, int, sample_t* ), void* user_data ) { - this->callback = func; - this->callback_data = user_data; + this->callback = func; + this->callback_data = user_data; } blargg_err_t Resampler_setup( struct Resampler* this, int fm_rate, int fm_gain, int rate, int gain ); static inline void Resampler_clear( struct Resampler* this ) { - this->buf_pos = this->sample_buf_size; + this->buf_pos = this->sample_buf_size; + + this->pos = 0; + this->write_pos = 0; +} - this->pos = 0; - this->write_pos = 0; +static inline int Resampler_rate( struct Resampler* this ) +{ + return this->rate_; } #endif |