-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlxSound: add endTime, closes #1906 #1943
Conversation
private function set_loopTime(value:Float):Float | ||
{ | ||
loopTime = value; | ||
if (_sound != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we use the length
property to avoid the null checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, of course. i've missed this new property)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to remove the null checks. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. removed them
|
||
private function set_loopEndTime(value:Float):Float | ||
{ | ||
return loopEndTime = (value <= loopTime) ? length : value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you prevent invalid loopEndTime
values here... However, what these values are depends on loopTime
. What happens if loopTime
is set after loopEndTime
?
I'm not sure how much is gained by having setters for Maybe it's better to just trust the user to supply correct values? That way there are no bugs caused by Flixel / bounding the values at least. |
yeah, i think it would be better. |
It's really not as simple as it looks, there's a lot of things to take into account. :) |
*/ | ||
public function play(ForceRestart:Bool = false, StartTime:Float = 0.0):FlxSound | ||
public function play(ForceRestart:Bool = false, StartTime:Float = 0.0, EndTime:Float = 0.0):FlxSound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EndTime == 0
here used to mean "set it to length
", but now the behavior of set_endTime()
is different.
Maybe it should be ?EndTime:Float
, and if (EndTime == null)
, we set it to length
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Looks good now, thanks! 👍 |
See issue #1906