Add base_offset to coef_offset in TXTH

This commit is contained in:
bnnm 2019-11-06 23:06:38 +01:00
parent 6eecc5303d
commit 302b264b13

View File

@ -1058,9 +1058,9 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
/* COEFS */ /* COEFS */
else if (is_string(key,"coef_offset")) { else if (is_string(key,"coef_offset")) {
if (!parse_num(txth->streamHead,txth,val, &txth->coef_offset)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->coef_offset)) goto fail;
/* special subsong adjustment */ /* special adjustment */
if (txth->subsong_offset) if (txth->subsong_offset)
txth->coef_offset = txth->coef_offset + txth->subsong_offset * (txth->target_subsong - 1); txth->coef_offset = txth->base_offset + txth->coef_offset + txth->subsong_offset * (txth->target_subsong - 1);
} }
else if (is_string(key,"coef_spacing")) { else if (is_string(key,"coef_spacing")) {
if (!parse_num(txth->streamHead,txth,val, &txth->coef_spacing)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->coef_spacing)) goto fail;
@ -1084,9 +1084,9 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
else if (is_string(key,"hist_offset")) { else if (is_string(key,"hist_offset")) {
if (!parse_num(txth->streamHead,txth,val, &txth->hist_offset)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->hist_offset)) goto fail;
txth->hist_set = 1; txth->hist_set = 1;
/* special subsong adjustment */ /* special adjustment */
if (txth->subsong_offset) if (txth->subsong_offset)
txth->hist_offset = txth->hist_offset + txth->subsong_offset * (txth->target_subsong - 1); txth->hist_offset = txth->base_offset + txth->hist_offset + txth->subsong_offset * (txth->target_subsong - 1);
} }
else if (is_string(key,"hist_spacing")) { else if (is_string(key,"hist_spacing")) {
if (!parse_num(txth->streamHead,txth,val, &txth->hist_spacing)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->hist_spacing)) goto fail;
@ -1109,9 +1109,9 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
else if (is_string(key,"name_offset")) { else if (is_string(key,"name_offset")) {
if (!parse_num(txth->streamHead,txth,val, &txth->name_offset)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->name_offset)) goto fail;
txth->name_offset_set = 1; txth->name_offset_set = 1;
/* special subsong adjustment */ /* special adjustment */
if (txth->subsong_offset) if (txth->subsong_offset)
txth->name_offset = txth->name_offset + txth->subsong_offset * (txth->target_subsong - 1); txth->name_offset = txth->base_offset + txth->name_offset + txth->subsong_offset * (txth->target_subsong - 1);
} }
else if (is_string(key,"name_size")) { else if (is_string(key,"name_size")) {
if (!parse_num(txth->streamHead,txth,val, &txth->name_size)) goto fail; if (!parse_num(txth->streamHead,txth,val, &txth->name_size)) goto fail;