From 9a2a2e4c2e32083434787ebcac1a6f7087cbd0f7 Mon Sep 17 00:00:00 2001 From: bnnm Date: Wed, 29 Aug 2018 20:48:35 +0200 Subject: [PATCH] Export extra sample values in clHCA_getInfo --- ext_includes/clHCA.h | 9 +++++++-- ext_libs/clHCA.c | 9 +++++++-- src/coding/hca_decoder.c | 2 +- src/meta/hca.c | 6 +++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ext_includes/clHCA.h b/ext_includes/clHCA.h index 8961f86d..75441c83 100644 --- a/ext_includes/clHCA.h +++ b/ext_includes/clHCA.h @@ -49,8 +49,13 @@ typedef struct clHCA_stInfo { unsigned int blockSize; unsigned int blockCount; unsigned int loopEnabled; - unsigned int loopStart; - unsigned int loopEnd; + unsigned int loopStartBlock; + unsigned int loopEndBlock; + unsigned int loopStartDelay; /* samples in block before loop starts */ + unsigned int loopEndPadding; /* samples in block after loop ends */ + unsigned int encoderDelay; /* samples appended to the beginning */ + unsigned int encoderPadding; /* samples appended to the end */ + unsigned int samplesPerBlock; const char *comment; } clHCA_stInfo; diff --git a/ext_libs/clHCA.c b/ext_libs/clHCA.c index c2935d60..8ae28172 100644 --- a/ext_libs/clHCA.c +++ b/ext_libs/clHCA.c @@ -785,8 +785,13 @@ int clHCA_getInfo(clHCA *hca, clHCA_stInfo *info){ info->blockSize=hca->_blockSize; info->blockCount=hca->_blockCount; info->loopEnabled=hca->_loopFlg; - info->loopStart=hca->_loopStart; - info->loopEnd=hca->_loopEnd; + info->loopStartBlock=hca->_loopStart; + info->loopEndBlock=hca->_loopEnd; + info->loopStartDelay=hca->_loop_r01; + info->loopEndPadding=hca->_loop_r02; + info->encoderDelay=hca->_fmt_r01; + info->encoderPadding=hca->_fmt_r02; + info->samplesPerBlock = 0x80 * 8; info->comment=hca->_comm_comment; return 0; } diff --git a/src/coding/hca_decoder.c b/src/coding/hca_decoder.c index 9ddec2b2..1a0b1cd8 100644 --- a/src/coding/hca_decoder.c +++ b/src/coding/hca_decoder.c @@ -130,7 +130,7 @@ void loop_hca(VGMSTREAM *vgmstream) { hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data); if (!data) return; - data->curblock = data->info.loopStart; + data->curblock = data->info.loopStartBlock; data->sample_ptr = clHCA_samplesPerBlock; data->samples_discard = 0; } diff --git a/src/meta/hca.c b/src/meta/hca.c index fce60855..9bf14e15 100644 --- a/src/meta/hca.c +++ b/src/meta/hca.c @@ -56,9 +56,9 @@ VGMSTREAM * init_vgmstream_hca(STREAMFILE *streamFile) { vgmstream->meta_type = meta_HCA; vgmstream->sample_rate = hca_data->info.samplingRate; - vgmstream->num_samples = hca_data->info.blockCount * clHCA_samplesPerBlock; - vgmstream->loop_start_sample = hca_data->info.loopStart * clHCA_samplesPerBlock; - vgmstream->loop_end_sample = hca_data->info.loopEnd * clHCA_samplesPerBlock; + vgmstream->num_samples = hca_data->info.blockCount * hca_data->info.samplesPerBlock; + vgmstream->loop_start_sample = hca_data->info.loopStartBlock * hca_data->info.samplesPerBlock; + vgmstream->loop_end_sample = hca_data->info.loopEndBlock * hca_data->info.samplesPerBlock; vgmstream->coding_type = coding_CRI_HCA; vgmstream->layout_type = layout_none;