Fixed overflow error.
parent
086acdc849
commit
5f7215e5e7
|
@ -18,7 +18,7 @@
|
||||||
@interface OutputNode : Node {
|
@interface OutputNode : Node {
|
||||||
AudioStreamBasicDescription format;
|
AudioStreamBasicDescription format;
|
||||||
|
|
||||||
int amountPlayed;
|
unsigned long amountPlayed;
|
||||||
OutputCoreAudio *output;
|
OutputCoreAudio *output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
- (void)seek:(double)time
|
- (void)seek:(double)time
|
||||||
{
|
{
|
||||||
amountPlayed = time*format.mBytesPerFrame*(format.mSampleRate/1000.0);
|
amountPlayed = time*format.mBytesPerFrame*(format.mSampleRate/1000.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)process
|
- (void)process
|
||||||
|
@ -72,7 +71,6 @@
|
||||||
|
|
||||||
- (double)amountPlayed
|
- (double)amountPlayed
|
||||||
{
|
{
|
||||||
|
|
||||||
return (amountPlayed/format.mBytesPerFrame)/(format.mSampleRate/1000.0);
|
return (amountPlayed/format.mBytesPerFrame)/(format.mSampleRate/1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -557,9 +557,9 @@ static inline signed int scale (mad_fixed_t sample)
|
||||||
|
|
||||||
- (double)seekToTime:(double)milliseconds
|
- (double)seekToTime:(double)milliseconds
|
||||||
{
|
{
|
||||||
int new_position;
|
unsigned long new_position;
|
||||||
int seconds = milliseconds/1000.0;
|
unsigned long seconds = milliseconds/1000.0;
|
||||||
int total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
unsigned long total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
||||||
|
|
||||||
if (seconds > total_seconds)
|
if (seconds > total_seconds)
|
||||||
seconds = total_seconds;
|
seconds = total_seconds;
|
||||||
|
@ -578,6 +578,8 @@ static inline signed int scale (mad_fixed_t sample)
|
||||||
|
|
||||||
_seekSkip = YES;
|
_seekSkip = YES;
|
||||||
|
|
||||||
|
NSLog(@"Seeking: %lf", seconds*1000.0);
|
||||||
|
|
||||||
return seconds*1000.0;
|
return seconds*1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue