mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Merge pull request #414 from bnnm/hca
Fix installed TXTP loops in HCA files
This commit is contained in:
commit
0de4762bfc
@ -193,7 +193,7 @@ void free_ea_mt(ea_mt_codec_data *data, int channels);
|
||||
hca_codec_data *init_hca(STREAMFILE *streamFile);
|
||||
void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do);
|
||||
void reset_hca(hca_codec_data * data);
|
||||
void loop_hca(hca_codec_data * data);
|
||||
void loop_hca(hca_codec_data * data, int32_t num_sample);
|
||||
void free_hca(hca_codec_data * data);
|
||||
int test_hca_key(hca_codec_data * data, unsigned long long keycode);
|
||||
|
||||
|
@ -130,9 +130,19 @@ void reset_hca(hca_codec_data * data) {
|
||||
data->samples_to_discard = data->info.encoderDelay;
|
||||
}
|
||||
|
||||
void loop_hca(hca_codec_data * data) {
|
||||
void loop_hca(hca_codec_data * data, int32_t num_sample) {
|
||||
if (!data) return;
|
||||
|
||||
/* manually calc loop values if not set (should only happen with installed/forced looping,
|
||||
* as actual files usually pad encoder delay so earliest loopStartBlock becomes 1-2,
|
||||
* probably for decoding cleanup so this may not be as exact) */
|
||||
if (data->info.loopStartBlock == 0 && data->info.loopStartDelay == 0) {
|
||||
int target_sample = num_sample + data->info.encoderDelay;
|
||||
|
||||
data->info.loopStartBlock = target_sample / data->info.samplesPerBlock;
|
||||
data->info.loopStartDelay = target_sample - (data->info.loopStartBlock * data->info.samplesPerBlock);
|
||||
}
|
||||
|
||||
data->current_block = data->info.loopStartBlock;
|
||||
data->samples_filled = 0;
|
||||
data->samples_consumed = 0;
|
||||
|
@ -2162,7 +2162,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
|
||||
/* prepare certain codecs' internal state for looping */
|
||||
|
||||
if (vgmstream->coding_type == coding_CRI_HCA) {
|
||||
loop_hca(vgmstream->codec_data);
|
||||
loop_hca(vgmstream->codec_data, vgmstream->loop_sample);
|
||||
}
|
||||
|
||||
if (vgmstream->coding_type == coding_EA_MT) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user