1
0
Fork 0
forked from len0rd/rockbox

2nd part of FS#12176. Tempo setting migrated to fixed point for libgme.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30274 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-08-09 20:21:55 +00:00
parent 964a5e6dfb
commit 012df14a5f
21 changed files with 71 additions and 69 deletions

View file

@ -46,7 +46,7 @@ void Sgc_init( struct Sgc_Emu* this )
this->sample_rate = 0;
this->mute_mask_ = 0;
this->tempo = 1.0;
this->tempo = (int)FP_ONE_TEMPO;
this->gain = 1.0;
this->voice_count = 0;
@ -294,16 +294,16 @@ void Sound_mute_voices( struct Sgc_Emu* this, int mask )
}
}
void Sound_set_tempo( struct Sgc_Emu* this, double t )
void Sound_set_tempo( struct Sgc_Emu* this, int t )
{
require( this->sample_rate ); // sample rate must be set first
double const min = 0.02;
double const max = 4.00;
int const min = (int)(FP_ONE_TEMPO*0.02);
int const max = (int)(FP_ONE_TEMPO*4.00);
if ( t < min ) t = min;
if ( t > max ) t = max;
this->tempo = t;
this->play_period = (int) (clock_rate( this ) / (this->header.rate ? 50 : 60) / t);
this->play_period = (int) ((clock_rate( this ) * FP_ONE_TEMPO) / (this->header.rate ? 50 : 60) / t);
}
void fill_buf( struct Sgc_Emu* this ) ICODE_ATTR;