adl: Add crude loop detection#126
Merged
Merged
Conversation
278189c to
09c6f94
Compare
The adl driver doesn't detect looping songs and plays them forever. In theory, the file format allows for quite complex channel control flow, and a reliable detection whether a song is endlessly repeating previously played parts is not feasible. In practice, for the music actually released in this format, a simple check seems to be good enough (although it's easy to craft malicious examples where this check fails; both false positives and false negatives): Let's assume a song is repeating if all channels which are still playing have jumped back or are (transitively) waiting on channels which have jumped back. Bug: adplug#122
09c6f94 to
d55e5e8
Compare
Contributor
|
Might another approach be to do the same as for IMF. Make a database for limiting the length per subsong, and we could also add hiding of non-used subsongs. |
Member
|
How is this one going, do you think it's ready to merge? |
Contributor
Author
|
Haven't been working on adplug for a while (real life…) I think the PR is ready to merge if you like the approach. Didn't merge myself because I'm not sure whether it's the right thing to do to deal with the issue. It's not a perfect solution, but well, it's an improvement; nobody complained or proposed a better solution, so I'd say go ahead. |
binarymaster
approved these changes
Dec 1, 2022
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.
Trying to avoid endlessly playing .adl files. Detecting loops properly would be way too complex, so I'm using a simple heuristics instead. Some testing wouldn't hurt.
In my tests with the music from Dune II, Legend of Kyrandia, and the playertest files all endless loops were eliminated, but I haven't checked whether some parts are missing now. If someone wants to check, the previously endless songs (and their new length) are:
(The Kyra files contain very long subsongs up to 75 min. They repeat a finite number of times and I deliberately left them as is.)