Add PCM_FLOAT_LE codec to TXTH

This commit is contained in:
bnnm 2022-05-01 12:13:02 +02:00
parent a3645e9f69
commit cdc5753847
2 changed files with 47 additions and 37 deletions

View File

@ -92,6 +92,9 @@ as explained below, but often will use default values. Accepted codec strings:
# * Variation with modified encoding
# - PCM8_U_int PCM 8-bit unsigned (interleave block)
# * Variation with modified encoding
# - PCM_FLOAT_LE PCM 32-bit float little endian
# * For few rare games [Ikinari Maou (Switch)]
# * Interleave is multiple of 0x4 (default)
# - IMA IMA ADPCM (mono/stereo)
# * For some PC games, and rarely consoles
# * Special interleave is multiple of 0x1, often +0x80

View File

@ -46,6 +46,7 @@ typedef enum {
XA,
XA_EA,
CP_YM,
PCM_FLOAT_LE,
UNKNOWN = 99,
} txth_codec_t;
@ -220,6 +221,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
case PCM16BE: interleave = 0x02; break;
case PCM8: interleave = 0x01; break;
case PCM8_U: interleave = 0x01; break;
case PCM_FLOAT_LE: interleave = 0x04; break;
default:
break;
}
@ -235,6 +237,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
case PCM16BE: coding = coding_PCM16BE; break;
case PCM16LE: coding = coding_PCM16LE; break;
case PCM8: coding = coding_PCM8; break;
case PCM_FLOAT_LE: coding = coding_PCMFLOAT; break;
case SDX2: coding = coding_SDX2; break;
case DVI_IMA: coding = coding_DVI_IMA; break;
#ifdef VGM_USE_MPEG
@ -305,6 +308,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
case coding_PCM16BE:
case coding_PCM8:
case coding_PCM8_U:
case coding_PCMFLOAT:
case coding_PCM4:
case coding_PCM4_U:
case coding_SDX2:
@ -963,6 +967,7 @@ static txth_codec_t parse_codec(txth_header* txth, const char* val) {
else if (is_string(val,"XA")) return XA;
else if (is_string(val,"XA_EA")) return XA_EA;
else if (is_string(val,"CP_YM")) return CP_YM;
else if (is_string(val,"PCM_FLOAT_LE")) return PCM_FLOAT_LE;
/* special handling */
else if (is_string(val,"name_value")) return txth->name_values[0];
else if (is_string(val,"name_value1")) return txth->name_values[0];
@ -2039,6 +2044,8 @@ static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
case PCM8_U_int:
case PCM8_U:
return pcm_bytes_to_samples(bytes, txth->channels, 8);
case PCM_FLOAT_LE:
return pcm_bytes_to_samples(bytes, txth->channels, 32);
case PCM4:
case PCM4_U:
case TGC: