Fixed overflow error.

CQTexperiment
vspader 2007-05-22 23:37:22 +00:00
parent 086acdc849
commit 5f7215e5e7
3 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@
@interface OutputNode : Node {
AudioStreamBasicDescription format;
int amountPlayed;
unsigned long amountPlayed;
OutputCoreAudio *output;
}

View File

@ -25,7 +25,6 @@
- (void)seek:(double)time
{
amountPlayed = time*format.mBytesPerFrame*(format.mSampleRate/1000.0);
}
- (void)process
@ -72,7 +71,6 @@
- (double)amountPlayed
{
return (amountPlayed/format.mBytesPerFrame)/(format.mSampleRate/1000.0);
}

View File

@ -557,9 +557,9 @@ static inline signed int scale (mad_fixed_t sample)
- (double)seekToTime:(double)milliseconds
{
int new_position;
int seconds = milliseconds/1000.0;
int total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
unsigned long new_position;
unsigned long seconds = milliseconds/1000.0;
unsigned long total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
if (seconds > total_seconds)
seconds = total_seconds;
@ -578,6 +578,8 @@ static inline signed int scale (mad_fixed_t sample)
_seekSkip = YES;
NSLog(@"Seeking: %lf", seconds*1000.0);
return seconds*1000.0;
}