Use millisecond in Make Adjacent step in Timing Post-Processor
Fix wangqr/Aegisub#57
This commit is contained in:
parent
1e3e478f5f
commit
8dececc3cb
2 changed files with 8 additions and 2 deletions
|
@ -31,6 +31,9 @@ public:
|
|||
// Always round up for 5ms because the range is [start, stop)
|
||||
operator int() const { return (time + 5) - (time + 5) % 10; }
|
||||
|
||||
/// Get millisecond, without centisecond round
|
||||
int GetMillisecond() const noexcept { return time; }
|
||||
|
||||
/// Return the time as a string
|
||||
/// @param ms Use milliseconds precision, for non-ASS formats
|
||||
std::string GetAssFormatted(bool ms=false) const;
|
||||
|
|
|
@ -407,9 +407,12 @@ void DialogTimingProcessor::Process() {
|
|||
AssDialogue *prev = sorted[i - 1];
|
||||
AssDialogue *cur = sorted[i];
|
||||
|
||||
int dist = cur->Start - prev->End;
|
||||
// Raw millisecond values are used in this step instead of the typical centisecond.
|
||||
// In this step, we need to distinguish between gap and overlap, as they have different thresholds.
|
||||
// A small gap / overlap less than 1 centisecond may not be distinguishable using rounded centisecond values.
|
||||
int dist = cur->Start.GetMillisecond() - prev->End.GetMillisecond();
|
||||
if ((dist < 0 && -dist <= adjOverlap) || (dist > 0 && dist <= adjGap)) {
|
||||
int setPos = prev->End + int(dist * bias);
|
||||
int setPos = prev->End.GetMillisecond() + int(dist * bias + 0.5);
|
||||
cur->Start = setPos;
|
||||
prev->End = setPos;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue