mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Test Update:
* coding.h * pcm_decoder.c * txth.c * decode.c * formats.c NOTE: TXTH.md is not present in the build solution??
This commit is contained in:
parent
369f7bbe00
commit
8a9a798051
@ -83,6 +83,8 @@ as explained below, but often will use default values. Accepted codec strings:
|
||||
# - DTK|NGC_DTK Nintendo ADP/DTK ADPCM
|
||||
# * For rare GC games
|
||||
#
|
||||
# - PCM24LE PCM 24-bit little endian
|
||||
# * Interleave is multiple of 0x3 (default)
|
||||
# - PCM16LE PCM 16-bit little endian
|
||||
# * For many games (usually on PC)
|
||||
# * Interleave is multiple of 0x2 (default)
|
||||
|
@ -93,6 +93,7 @@ void decode_ulaw_int(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspac
|
||||
void decode_alaw(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcmfloat(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int big_endian);
|
||||
void decode_pcm24le(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcm24be(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
int32_t pcm_bytes_to_samples(size_t bytes, int channels, int bits_per_sample);
|
||||
int32_t pcm24_bytes_to_samples(size_t bytes, int channels);
|
||||
int32_t pcm16_bytes_to_samples(size_t bytes, int channels);
|
||||
|
@ -216,6 +216,17 @@ void decode_pcmfloat(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspac
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm24be(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count += channelspacing) {
|
||||
off_t offset = stream->offset + i * 0x03;
|
||||
int v = read_u8(offset+0x02, stream->streamfile) | (read_s16be(offset + 0x00, stream->streamfile) << 8);
|
||||
outbuf[sample_count] = (v >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm24le(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
@ -366,6 +366,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM* vgmstream) {
|
||||
case coding_ALAW:
|
||||
case coding_PCMFLOAT:
|
||||
case coding_PCM24LE:
|
||||
case coding_PCM24BE:
|
||||
return 1;
|
||||
#ifdef VGM_USE_VORBIS
|
||||
case coding_OGG_VORBIS:
|
||||
@ -594,6 +595,7 @@ int get_vgmstream_frame_size(VGMSTREAM* vgmstream) {
|
||||
case coding_PCMFLOAT:
|
||||
return 0x04;
|
||||
case coding_PCM24LE:
|
||||
case coding_PCM24BE:
|
||||
return 0x03;
|
||||
|
||||
case coding_SDX2:
|
||||
@ -897,6 +899,13 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
|
||||
}
|
||||
break;
|
||||
|
||||
case coding_PCM24BE:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_pcm24be(&vgmstream->ch[ch], buffer + ch,
|
||||
vgmstream->channels, vgmstream->samples_into_block, samples_to_do);
|
||||
}
|
||||
break;
|
||||
|
||||
case coding_NDS_IMA:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_nds_ima(&vgmstream->ch[ch], buffer+ch,
|
||||
|
@ -758,6 +758,7 @@ static const coding_info coding_info_list[] = {
|
||||
{coding_ALAW, "8-bit a-Law"},
|
||||
{coding_PCMFLOAT, "32-bit float PCM"},
|
||||
{coding_PCM24LE, "24-bit Little Endian PCM"},
|
||||
{coding_PCM24BE, "24-bit Big Endian PCM"},
|
||||
|
||||
{coding_CRI_ADX, "CRI ADX 4-bit ADPCM"},
|
||||
{coding_CRI_ADX_fixed, "CRI ADX 4-bit ADPCM (fixed coefficients)"},
|
||||
|
@ -44,7 +44,8 @@ typedef enum {
|
||||
ASF = 30, /* Argonaut ASF 4-bit ADPCM */
|
||||
EAXA = 31, /* Electronic Arts EA-XA 4-bit ADPCM v1 */
|
||||
OKI4S = 32, /* OKI ADPCM with 16-bit output (unlike OKI/VOX/Dialogic ADPCM's 12-bit) */
|
||||
PCM24LE = 33, /* 24-bit Little Endian PCM*/
|
||||
PCM24LE = 33, /* 24-bit Little Endian PCM */
|
||||
PCM24BE = 34, /* 24-bit Big Endian PCM */
|
||||
XA,
|
||||
XA_EA,
|
||||
CP_YM,
|
||||
@ -228,6 +229,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
|
||||
case HEVAG: interleave = 0x10; break;
|
||||
case NGC_DSP: interleave = 0x08; break;
|
||||
case PCM24LE: interleave = 0x03; break;
|
||||
case PCM24BE: interleave = 0x03; break;
|
||||
case PCM16LE:
|
||||
case PCM16BE: interleave = 0x02; break;
|
||||
case PCM8:
|
||||
@ -249,6 +251,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
|
||||
case XBOX: coding = coding_XBOX_IMA; break;
|
||||
case NGC_DTK: coding = coding_NGC_DTK; break;
|
||||
case PCM24LE: coding = coding_PCM24LE; break;
|
||||
case PCM24BE: coding = coding_PCM24BE; break;
|
||||
case PCM16LE: coding = coding_PCM16LE; break;
|
||||
case PCM16BE: coding = coding_PCM16BE; break;
|
||||
case PCM8: coding = coding_PCM8; break;
|
||||
@ -322,6 +325,7 @@ VGMSTREAM* init_vgmstream_txth(STREAMFILE* sf) {
|
||||
vgmstream->layout_type = layout_none;
|
||||
break;
|
||||
case coding_PCM24LE:
|
||||
case coding_PCM24BE:
|
||||
case coding_PCM16LE:
|
||||
case coding_PCM16BE:
|
||||
case coding_PCM8:
|
||||
@ -945,6 +949,7 @@ static txth_codec_t parse_codec(txth_header* txth, const char* val) {
|
||||
else if (is_string(val,"XBOX")) return XBOX;
|
||||
else if (is_string(val,"NGC_DTK")) return NGC_DTK;
|
||||
else if (is_string(val,"DTK")) return NGC_DTK;
|
||||
else if (is_string(val,"PCM24BE")) return PCM24BE;
|
||||
else if (is_string(val,"PCM24LE")) return PCM24LE;
|
||||
else if (is_string(val,"PCM16BE")) return PCM16BE;
|
||||
else if (is_string(val,"PCM16LE")) return PCM16LE;
|
||||
@ -2096,6 +2101,8 @@ static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
|
||||
case PSX_bf:
|
||||
case HEVAG:
|
||||
return ps_bytes_to_samples(bytes, txth->channels);
|
||||
case PCM24BE:
|
||||
return pcm24_bytes_to_samples(bytes, txth->channels);
|
||||
case PCM24LE:
|
||||
return pcm24_bytes_to_samples(bytes, txth->channels);
|
||||
case PCM16BE:
|
||||
|
@ -70,7 +70,8 @@ typedef enum {
|
||||
coding_ALAW, /* 8-bit a-Law (non-linear PCM) */
|
||||
|
||||
coding_PCMFLOAT, /* 32-bit float PCM */
|
||||
coding_PCM24LE, /* 24-bit PCM */
|
||||
coding_PCM24LE, /* little endian 24-bit PCM */
|
||||
coding_PCM24BE, /* big endian 24-bit PCM */
|
||||
|
||||
/* ADPCM */
|
||||
coding_CRI_ADX, /* CRI ADX */
|
||||
|
Loading…
x
Reference in New Issue
Block a user