Skip to content

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