mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Fix formatting
This commit is contained in:
parent
5106ccba68
commit
49c1a0d985
@ -5,38 +5,38 @@
|
||||
|
||||
static uint16_t slopeTable[64] =
|
||||
{
|
||||
0x0000, 0x0100, 0x0200, 0x0400, 0x0610, 0x0810, 0x0C18, 0x1020,
|
||||
0x0100, 0x0300, 0x0508, 0x0908, 0x0D18, 0x1118, 0x1920, 0x2128,
|
||||
0x0208, 0x0508, 0x0810, 0x0E10, 0x1420, 0x1A20, 0x2628, 0x3230,
|
||||
0x0310, 0x0710, 0x0B18, 0x1318, 0x1B28, 0x2328, 0x2930, 0x4338,
|
||||
0x0418, 0x0918, 0x0E20, 0x1820, 0x2230, 0x2C30, 0x4038, 0x5438,
|
||||
0x0520, 0x0B20, 0x1128, 0x1D28, 0x2938, 0x3538, 0x4D38, 0x6F38,
|
||||
0x0628, 0x0D28, 0x1430, 0x2230, 0x3038, 0x3E38, 0x5A38, 0x7638,
|
||||
0x0730, 0x0F30, 0x1738, 0x2738, 0x3738, 0x4738, 0x6738, 0x7D38
|
||||
0x0000, 0x0100, 0x0200, 0x0400, 0x0610, 0x0810, 0x0C18, 0x1020,
|
||||
0x0100, 0x0300, 0x0508, 0x0908, 0x0D18, 0x1118, 0x1920, 0x2128,
|
||||
0x0208, 0x0508, 0x0810, 0x0E10, 0x1420, 0x1A20, 0x2628, 0x3230,
|
||||
0x0310, 0x0710, 0x0B18, 0x1318, 0x1B28, 0x2328, 0x2930, 0x4338,
|
||||
0x0418, 0x0918, 0x0E20, 0x1820, 0x2230, 0x2C30, 0x4038, 0x5438,
|
||||
0x0520, 0x0B20, 0x1128, 0x1D28, 0x2938, 0x3538, 0x4D38, 0x6F38,
|
||||
0x0628, 0x0D28, 0x1430, 0x2230, 0x3038, 0x3E38, 0x5A38, 0x7638,
|
||||
0x0730, 0x0F30, 0x1738, 0x2738, 0x3738, 0x4738, 0x6738, 0x7D38
|
||||
};
|
||||
|
||||
void decode_tgc(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int32_t first_sample, int32_t samples_to_do)
|
||||
{
|
||||
for (int i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count++)
|
||||
{
|
||||
uint8_t samp = ((uint8_t)read_8bit(i/2, stream->streamfile) >>
|
||||
(i & 1 ? 4 : 0)) & 0xf;
|
||||
for (int i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count++)
|
||||
{
|
||||
uint8_t samp = ((uint8_t)read_8bit(i/2, stream->streamfile) >>
|
||||
(i & 1 ? 4 : 0)) & 0xf;
|
||||
|
||||
uint8_t slopeIndex = stream->adpcm_scale | (samp >> 1);
|
||||
uint8_t slopeIndex = stream->adpcm_scale | (samp >> 1);
|
||||
|
||||
stream->adpcm_step_index = slopeTable[slopeIndex] >> 8;
|
||||
stream->adpcm_scale = slopeTable[slopeIndex] & 0xff;
|
||||
stream->adpcm_step_index = slopeTable[slopeIndex] >> 8;
|
||||
stream->adpcm_scale = slopeTable[slopeIndex] & 0xff;
|
||||
|
||||
stream->adpcm_history1_16 += (samp & 1) ?
|
||||
-stream->adpcm_step_index:
|
||||
stream->adpcm_step_index;
|
||||
stream->adpcm_history1_16 += (samp & 1) ?
|
||||
-stream->adpcm_step_index:
|
||||
stream->adpcm_step_index;
|
||||
|
||||
if (stream->adpcm_history1_16 < 0)
|
||||
stream->adpcm_history1_16 = 0;
|
||||
if (stream->adpcm_history1_16 < 0)
|
||||
stream->adpcm_history1_16 = 0;
|
||||
|
||||
if (stream->adpcm_history1_16 > 0xff)
|
||||
stream->adpcm_history1_16 = 0xff;
|
||||
if (stream->adpcm_history1_16 > 0xff)
|
||||
stream->adpcm_history1_16 = 0xff;
|
||||
|
||||
outbuf[sample_count] = stream->adpcm_history1_16 * 0x100 - 0x8000;
|
||||
}
|
||||
outbuf[sample_count] = stream->adpcm_history1_16 * 0x100 - 0x8000;
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ static const char* extension_list[] = {
|
||||
"208",
|
||||
"2dx9",
|
||||
"2pfs",
|
||||
"4",
|
||||
"4",
|
||||
"8", //txth/reserved [Gungage (PS1)]
|
||||
"800",
|
||||
"9tav",
|
||||
@ -178,7 +178,7 @@ static const char* extension_list[] = {
|
||||
"gbts",
|
||||
"gca",
|
||||
"gcm",
|
||||
"gcomadpcm",
|
||||
"gcomadpcm",
|
||||
"gcub",
|
||||
"gcw",
|
||||
"genh",
|
||||
@ -476,7 +476,7 @@ static const char* extension_list[] = {
|
||||
"sxd3",
|
||||
|
||||
"tec",
|
||||
"tgcadpcm",
|
||||
"tgcadpcm",
|
||||
"tgq",
|
||||
"thp",
|
||||
"tk5",
|
||||
|
@ -3,28 +3,28 @@
|
||||
|
||||
/* Tiger Game.com ADPCM file */
|
||||
VGMSTREAM * init_vgmstream_tgc(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "gcomadpcm,tgcadpcm,4"))
|
||||
goto fail;
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "gcomadpcm,tgcadpcm,4"))
|
||||
goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(1, 0);
|
||||
if (!vgmstream) goto fail;
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(1, 0);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->sample_rate = 8000;
|
||||
vgmstream->num_samples = (read_16bitBE(1, streamFile) - 3) * 2;
|
||||
vgmstream->meta_type = meta_TGC;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->coding_type = coding_TGC;
|
||||
vgmstream->sample_rate = 8000;
|
||||
vgmstream->num_samples = (read_16bitBE(1, streamFile) - 3) * 2;
|
||||
vgmstream->meta_type = meta_TGC;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->coding_type = coding_TGC;
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, streamFile, 3))
|
||||
goto fail;
|
||||
if (!vgmstream_open_stream(vgmstream, streamFile, 3))
|
||||
goto fail;
|
||||
|
||||
return vgmstream;
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -36,7 +36,7 @@ typedef enum {
|
||||
PCM4_U = 26, /* 4-bit unsigned PCM (3rd and 4th gen games) */
|
||||
OKI16 = 27, /* OKI ADPCM with 16-bit output (unlike OKI/VOX/Dialogic ADPCM's 12-bit) */
|
||||
AAC = 28, /* Advanced Audio Coding (raw without .mp4) */
|
||||
TGC = 29 /* Tiger Game.com 4-bit ADPCM */
|
||||
TGC = 29 /* Tiger Game.com 4-bit ADPCM */
|
||||
} txth_type;
|
||||
|
||||
typedef struct {
|
||||
@ -222,7 +222,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
|
||||
case PCM4: coding = coding_PCM4; break;
|
||||
case PCM4_U: coding = coding_PCM4_U; break;
|
||||
case OKI16: coding = coding_OKI16; break;
|
||||
case TGC: coding = coding_TGC; break;
|
||||
case TGC: coding = coding_TGC; break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
@ -268,7 +268,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
|
||||
case coding_IMA:
|
||||
case coding_AICA:
|
||||
case coding_APPLE_IMA4:
|
||||
case coding_TGC:
|
||||
case coding_TGC:
|
||||
vgmstream->interleave_block_size = txth.interleave;
|
||||
vgmstream->interleave_last_block_size = txth.interleave_last;
|
||||
if (vgmstream->channels > 1)
|
||||
@ -846,8 +846,8 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
|
||||
else if (is_string(val,"PCM4_U")) txth->codec = PCM4_U;
|
||||
else if (is_string(val,"OKI16")) txth->codec = OKI16;
|
||||
else if (is_string(val,"AAC")) txth->codec = AAC;
|
||||
else if (is_string(val,"TGC")) txth->codec = TGC;
|
||||
else if (is_string(val,"GCOM_ADPCM")) txth->codec = TGC;
|
||||
else if (is_string(val,"TGC")) txth->codec = TGC;
|
||||
else if (is_string(val,"GCOM_ADPCM")) txth->codec = TGC;
|
||||
else goto fail;
|
||||
|
||||
/* set common interleaves to simplify usage
|
||||
@ -1703,7 +1703,7 @@ static int get_bytes_to_samples(txth_header * txth, uint32_t bytes) {
|
||||
return pcm_bytes_to_samples(bytes, txth->channels, 8);
|
||||
case PCM4:
|
||||
case PCM4_U:
|
||||
case TGC:
|
||||
case TGC:
|
||||
return pcm_bytes_to_samples(bytes, txth->channels, 4);
|
||||
case MSADPCM:
|
||||
return msadpcm_bytes_to_samples(bytes, txth->interleave, txth->channels);
|
||||
|
@ -487,7 +487,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_xma_ue3,
|
||||
init_vgmstream_csb,
|
||||
init_vgmstream_fda,
|
||||
init_vgmstream_tgc,
|
||||
init_vgmstream_tgc,
|
||||
|
||||
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
|
||||
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
|
||||
@ -2032,12 +2032,12 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
vgmstream->channels,vgmstream->samples_into_block,samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_TGC:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_tgc(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
|
||||
vgmstream->samples_into_block,samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_TGC:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_tgc(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
|
||||
vgmstream->samples_into_block,samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_NDS_PROCYON:
|
||||
for (ch = 0; ch < vgmstream->channels; ch++) {
|
||||
decode_nds_procyon(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
|
||||
|
@ -154,7 +154,7 @@ typedef enum {
|
||||
coding_ASKA, /* Aska ADPCM */
|
||||
coding_NXAP, /* NXAP ADPCM */
|
||||
|
||||
coding_TGC, /* Tiger Game.com 4-bit ADPCM */
|
||||
coding_TGC, /* Tiger Game.com 4-bit ADPCM */
|
||||
|
||||
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
|
||||
coding_L5_555, /* Level-5 0x555 ADPCM */
|
||||
@ -722,7 +722,7 @@ typedef enum {
|
||||
meta_XSSB,
|
||||
meta_XMA_UE3,
|
||||
meta_FDA,
|
||||
meta_TGC,
|
||||
meta_TGC,
|
||||
} meta_t;
|
||||
|
||||
/* standard WAVEFORMATEXTENSIBLE speaker positions */
|
||||
|
Loading…
x
Reference in New Issue
Block a user