Conversation
`PreviewTime` was written as -1 on every save and never read on load, so the point a song previews from was lost in both directions. It is the same value as `#SAMPLESTART`, counted in milliseconds rather than seconds. The loader now reads it into `previewStart`, treating osu!'s -1 as "no preview", and the writer emits the stored value, still writing -1 when there is none. Neither format records how long the preview runs, so only the start carries over.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The point a song previews from is lost in both directions when a
.osufile isinvolved.
Why
PreviewTimeis the same value as#SAMPLESTART, counted in millisecondsrather than seconds. The writer emits a constant:
so a simfile that has a preview loses it on export, and
ParseGeneralreadsonly
AudioFilenameandMode, so a.osuthat has one loses it on import.osu! itself sets the field from its editor, and most ranked maps carry a real
value.
The change
The loader reads it into
previewStart, and the writer emits what is stored:osu! writes -1 for a song with no preview, so that value is left alone on the
way in and still written on the way out when there is nothing to write.
Neither osu! nor a simfile agree on the length: osu! records only where the
preview starts.
#SAMPLELENGTHtherefore stays at zero on import, which iswhat the games fall back to their own default on - the same thing that already
happens today, since nothing was imported at all.
Reproducing
Open it and look at File -> Properties: the preview fields are empty. Save it
as
.smand#SAMPLESTARTis0.000000.Testing
Built on Windows with clang-tidy and clang-format enforced, as the build does.
With the change, that file gives
#SAMPLESTART:60.819000;, and saving back to.osugivesPreviewTime:60819. The same file withPreviewTime: -1stillgives
#SAMPLESTART:0.000000;and is written back asPreviewTime:-1, so amap with no preview does not gain one at the start of the song.