add note about using threshold for subtitle duration

This commit is contained in:
Isse 2023-05-03 16:15:28 +02:00
parent 77b7d1a49e
commit 922ba9ed5c
2 changed files with 4 additions and 3 deletions

View File

@ -255,6 +255,9 @@ impl AudioFrontend {
},
};
// NOTE: Threshold here is meant to give subtitles some idea of the duration of
// the audio, it doesn't have to be perfect but in the future, if possible we
// might want to switch it out for the actual duration.
(file, item.threshold, item.subtitle.as_deref())
})
}

View File

@ -289,9 +289,7 @@ impl<'a> Widget for Subtitles<'a> {
subtitles
.subtitles
.iter()
.filter_map(|(localization, data)| {
Some((localization, data.last()?))
})
.filter_map(|(localization, data)| Some((localization, data.last()?)))
.filter(|(_, data)| {
data.position.map_or(true, |pos| {
pos.distance_squared(listener_pos)