summaryrefslogtreecommitdiff
path: root/apps/codecs/libgme/nsf_emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libgme/nsf_emu.c')
-rw-r--r--apps/codecs/libgme/nsf_emu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/codecs/libgme/nsf_emu.c b/apps/codecs/libgme/nsf_emu.c
index 1b8d98e51a..79a15e21f2 100644
--- a/apps/codecs/libgme/nsf_emu.c
+++ b/apps/codecs/libgme/nsf_emu.c
@@ -179,9 +179,9 @@ static bool pal_only( struct header_t* this )
179 return (this->speed_flags & 3) == 1; 179 return (this->speed_flags & 3) == 1;
180} 180}
181 181
182static double clock_rate( struct header_t* this ) 182static long clock_rate( struct header_t* this )
183{ 183{
184 return pal_only( this ) ? 1662607.125 : 1789772.727272727; 184 return pal_only( this ) ? (long)1662607.125 : (long)1789772.727272727;
185} 185}
186 186
187static int play_period( struct header_t* this ) 187static int play_period( struct header_t* this )
@@ -206,7 +206,7 @@ static int play_period( struct header_t* this )
206 206
207 // Custom rate 207 // Custom rate
208 if ( rate != value ) 208 if ( rate != value )
209 clocks = (int) (rate * clock_rate( this ) * (1.0/1000000.0)); 209 clocks = (int) ((1LL * rate * clock_rate( this )) / 1000000);
210 210
211 return clocks; 211 return clocks;
212} 212}
@@ -285,7 +285,7 @@ blargg_err_t Nsf_post_load( struct Nsf_Emu* this )
285 this->track_count = this->header.track_count; 285 this->track_count = this->header.track_count;
286 286
287 // Change clock rate & setup buffer 287 // Change clock rate & setup buffer
288 this->clock_rate__ = (long) (clock_rate( &this->header ) + 0.5); 288 this->clock_rate__ = (long) clock_rate( &this->header );
289 Buffer_clock_rate( &this->stereo_buf, this->clock_rate__ ); 289 Buffer_clock_rate( &this->stereo_buf, this->clock_rate__ );
290 this->buf_changed_count = Buffer_channels_changed_count( &this->stereo_buf ); 290 this->buf_changed_count = Buffer_channels_changed_count( &this->stereo_buf );
291 return 0; 291 return 0;