Change: Allow embedding any file into a .cat file.#3
Open
PeterN wants to merge 1 commit intoOpenTTD:masterfrom
Open
Change: Allow embedding any file into a .cat file.#3PeterN wants to merge 1 commit intoOpenTTD:masterfrom
PeterN wants to merge 1 commit intoOpenTTD:masterfrom
Conversation
This allows file types other than WAV to be inserted. File types not supported by OpenTTD will be ignored.
rubidium42
reviewed
Nov 7, 2024
Comment on lines
-187
to
+150
| writer.WriteDword('FFIR'); | ||
| writer.WriteDword(this->size - 8); | ||
| writer.WriteDword('EVAW'); | ||
|
|
||
| writer.WriteDword(' tmf'); | ||
| writer.WriteDword(16); | ||
| writer.WriteWord(1); | ||
| writer.WriteWord(this->num_channels); | ||
| writer.WriteDword(this->sample_rate); | ||
| writer.WriteDword(this->sample_rate * this->num_channels * this->bits_per_sample / 8); | ||
| writer.WriteWord(this->num_channels * this->bits_per_sample / 8); | ||
| writer.WriteWord(this->bits_per_sample); | ||
|
|
||
| writer.WriteDword('atad'); | ||
| writer.WriteDword(this->sample_size); | ||
| writer.WriteRaw(this->sample_data, this->size - RIFF_HEADER_SIZE); | ||
| writer.WriteRaw(this->sample_data, this->size); |
Contributor
There was a problem hiding this comment.
This breaks the format fix at line 170-172 (original).
Given these variables are not used anymore, they should be removed from sample.hpp.
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.
To support OpenTTD/OpenTTD#13055, catcodec needs to be extended to allow Ogg Opus files to be included.
To properly test for a valid Ogg Opus files would require additional dependencies and complicated code to test each file, so this PR takes the approach of allowing any file to be packed into the .cat file and it's up to the user to ensure the files are correct.
This allows file types other than WAV to be embedded. File types not supported by OpenTTD will be ignored.