Cog/Window/PositionSlider.m
Christopher Snowhill e5ff6cd23d [Position Slider] Fix invalid duration setting
Fix NaN condition occurring when an invalid file is played.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-13 02:01:26 -07:00

34 lines
713 B
Objective-C

//
// PositionSlider.m
// Cog
//
// Created by Vincent Spader on 2/22/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "PositionSlider.h"
#import "TimeField.h"
@implementation PositionSlider
- (void)setDoubleValue:(double)value {
self.positionTextField.currentTime = (long)value;
[super setDoubleValue:value];
}
- (void)setMaxValue:(double)value {
if(isnan(value) || isinf(value)) value = 0.0; // Clip invalid values from bad file playlist entries
self.positionTextField.duration = (long)value;
[super setMaxValue:value];
}
- (void)mouseDragged:(NSEvent *)theEvent {
self.positionTextField.currentTime = (long)[self doubleValue];
[super mouseDragged:theEvent];
}
@end