Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Allow embedding any file into a .cat file. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Nov 4, 2024

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.

This allows file types other than WAV to be inserted.

File types not supported by OpenTTD will be ignored.
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the format fix at line 170-172 (original).

Given these variables are not used anymore, they should be removed from sample.hpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants