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:
parent
964a5e6dfb
commit
012df14a5f
21 changed files with 71 additions and 69 deletions
|
@ -54,7 +54,7 @@ void Nsf_init( struct Nsf_Emu* this )
|
|||
{
|
||||
this->sample_rate = 0;
|
||||
this->mute_mask_ = 0;
|
||||
this->tempo = 1.0;
|
||||
this->tempo = (int)(FP_ONE_TEMPO);
|
||||
this->gain = 1.0;
|
||||
|
||||
// defaults
|
||||
|
@ -474,16 +474,16 @@ void Sound_mute_voices( struct Nsf_Emu* this, int mask )
|
|||
}
|
||||
}
|
||||
|
||||
void Sound_set_tempo( struct Nsf_Emu* this, double t )
|
||||
void Sound_set_tempo( struct Nsf_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;
|
||||
|
||||
set_play_period( this, (int) (play_period( &this->header ) / t) );
|
||||
set_play_period( this, (int) ((play_period( &this->header ) * FP_ONE_TEMPO) / t) );
|
||||
|
||||
Apu_set_tempo( &this->apu, t );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue