mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Added PS ADPCM of configurable frame size (FF XI, Blur, Afrika)
This fuses the FF XI/BSF/Short VAG decoder variants into a single one (FF XI alone has 4 possible frame sizes); also fixed FF XI sample rate and some cleanup.
This commit is contained in:
parent
6c82a508ef
commit
ee5a40224d
@ -56,13 +56,9 @@ void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelsp
|
||||
|
||||
void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_ffxi_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_baf_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_short_vag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size);
|
||||
|
||||
void decode_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
|
||||
void init_get_high_nibble(VGMSTREAM * vgmstream);
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include "../util.h"
|
||||
|
||||
/* for some algos, maybe closer to the real thing */
|
||||
#define VAG_USE_INTEGER_TABLE 0
|
||||
|
||||
#define VAG_USE_INTEGER_TABLE 0
|
||||
|
||||
/* PS ADPCM table (precalculated divs) */
|
||||
static const double VAG_f[5][2] = {
|
||||
@ -14,6 +13,7 @@ static const double VAG_f[5][2] = {
|
||||
{ 98.0 / 64.0 , -55.0 / 64.0 },
|
||||
{ 122.0 / 64.0 , -60.0 / 64.0 }
|
||||
};
|
||||
#if VAG_USE_INTEGER_TABLE
|
||||
/* PS ADPCM table */
|
||||
static const int8_t VAG_coefs[5][2] = {
|
||||
{ 0 , 0 },
|
||||
@ -22,7 +22,7 @@ static const int8_t VAG_coefs[5][2] = {
|
||||
{ 98 , -55 },
|
||||
{ 122 , -60 }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* PSVita ADPCM table */
|
||||
static const int16_t HEVAG_coefs[128][4] = {
|
||||
@ -294,84 +294,6 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel
|
||||
stream->adpcm_history2_32=hist2;
|
||||
}
|
||||
|
||||
/* FF XI's Vag-ish format */
|
||||
void decode_ffxi_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
|
||||
int predict_nr, shift_factor, sample;
|
||||
int32_t hist1=stream->adpcm_history1_32;
|
||||
int32_t hist2=stream->adpcm_history2_32;
|
||||
|
||||
short scale;
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
int32_t predictor;
|
||||
|
||||
int framesin = first_sample/16;
|
||||
|
||||
predict_nr = read_8bit(stream->offset+framesin*9,stream->streamfile) >> 4;
|
||||
shift_factor = read_8bit(stream->offset+framesin*9,stream->streamfile) & 0xf;
|
||||
first_sample = first_sample % 16;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
||||
short sample_byte = (short)read_8bit(stream->offset+(framesin*9)+1+i/2,stream->streamfile);
|
||||
|
||||
sample=0;
|
||||
|
||||
scale = ((i&1 ?
|
||||
sample_byte >> 4 :
|
||||
sample_byte & 0x0f)<<12);
|
||||
|
||||
#if !VAG_USE_INTEGER_TABLE
|
||||
predictor =
|
||||
(int)((hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1]));
|
||||
#else
|
||||
predictor =
|
||||
(hist1*VAG_coefs[predict_nr][0]+hist2*VAG_coefs[predict_nr][1])/64;
|
||||
#endif
|
||||
sample=(scale >> shift_factor) + predictor;
|
||||
|
||||
outbuf[sample_count] = clamp16(sample);
|
||||
hist2=hist1;
|
||||
hist1=sample;
|
||||
}
|
||||
stream->adpcm_history1_32=hist1;
|
||||
stream->adpcm_history2_32=hist2;
|
||||
}
|
||||
|
||||
void decode_baf_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
|
||||
int predict_nr, shift_factor, sample;
|
||||
int32_t hist1=stream->adpcm_history1_32;
|
||||
int32_t hist2=stream->adpcm_history2_32;
|
||||
|
||||
short scale;
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
int framesin = first_sample/64;
|
||||
|
||||
predict_nr = read_8bit(stream->offset+framesin*33,stream->streamfile) >> 4;
|
||||
shift_factor = read_8bit(stream->offset+framesin*33,stream->streamfile) & 0xf;
|
||||
|
||||
first_sample = first_sample % 64;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
||||
short sample_byte = (short)read_8bit(stream->offset+(framesin*33)+1+i/2,stream->streamfile);
|
||||
|
||||
scale = ((i&1 ?
|
||||
sample_byte >> 4 :
|
||||
sample_byte & 0x0f)<<12);
|
||||
|
||||
sample=(int)((scale >> shift_factor)+hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1]);
|
||||
|
||||
outbuf[sample_count] = clamp16(sample);
|
||||
hist2=hist1;
|
||||
hist1=sample;
|
||||
}
|
||||
stream->adpcm_history1_32=hist1;
|
||||
stream->adpcm_history2_32=hist2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
|
||||
@ -442,11 +364,10 @@ void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels
|
||||
|
||||
|
||||
/**
|
||||
* Short VAG ADPCM, found in PS3 Afrika (SGDX type 5).
|
||||
* Uses 8 byte blocks and no flag.
|
||||
* PS ADPCM of configurable size, with no flag.
|
||||
* Found in PS3 Afrika (SGDX type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33.
|
||||
*/
|
||||
void decode_short_vag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
|
||||
void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) {
|
||||
uint8_t predict_nr, shift, byte;
|
||||
int16_t scale = 0;
|
||||
|
||||
@ -454,37 +375,45 @@ void decode_short_vag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int chan
|
||||
int32_t hist1 = stream->adpcm_history1_32;
|
||||
int32_t hist2 = stream->adpcm_history2_32;
|
||||
|
||||
int i, sample_count;
|
||||
int i, sample_count, bytes_per_frame, samples_per_frame;
|
||||
const int header_size = 1;
|
||||
|
||||
bytes_per_frame = frame_size - header_size;
|
||||
samples_per_frame = bytes_per_frame * 2;
|
||||
|
||||
int framesin = first_sample / 6;
|
||||
int framesin = first_sample / samples_per_frame;
|
||||
|
||||
/* 2 byte header: predictor = 1st, shift = 2nd */
|
||||
byte = (uint8_t)read_8bit(stream->offset+framesin*8+0,stream->streamfile);
|
||||
/* 1 byte header: predictor = 1st, shift = 2nd */
|
||||
byte = (uint8_t)read_8bit(stream->offset+framesin*frame_size+0,stream->streamfile);
|
||||
predict_nr = byte >> 4;
|
||||
shift = byte & 0x0f;
|
||||
|
||||
first_sample = first_sample % 6;
|
||||
first_sample = first_sample % samples_per_frame;
|
||||
|
||||
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
|
||||
sample = 0;
|
||||
|
||||
if (predict_nr < 5) {
|
||||
|
||||
if (i & 1) {/* odd/even nibble */
|
||||
scale = byte >> 4;
|
||||
} else {
|
||||
byte = (uint8_t)read_8bit(stream->offset+(framesin*8)+1+i/2,stream->streamfile);
|
||||
if (i%2 != 1) { /* low nibble first */
|
||||
byte = (uint8_t)read_8bit(stream->offset+(framesin*frame_size)+header_size+i/2,stream->streamfile);
|
||||
scale = (byte & 0x0f);
|
||||
} else { /* high nibble last */
|
||||
scale = byte >> 4;
|
||||
}
|
||||
scale = scale << 12; /* shift + sign extend (only if scale is int16_t) */
|
||||
/*if (scale > 7) {
|
||||
scale = scale - 16;
|
||||
}*/
|
||||
scale = scale << 12; /* shift + sign extend only if scale is int16_t */
|
||||
|
||||
sample = (hist1 * VAG_coefs[predict_nr][0] +
|
||||
#if VAG_USE_INTEGER_TABLE
|
||||
sample = (scale >> shift) +
|
||||
(hist1 * VAG_coefs[predict_nr][0] +
|
||||
hist2 * VAG_coefs[predict_nr][1] ) / 64;
|
||||
sample = sample + (scale >> shift);
|
||||
sample = sample + ;
|
||||
#else
|
||||
sample = (int)( (scale >> shift) +
|
||||
(hist1 * VAG_f[predict_nr][0] +
|
||||
hist2 * VAG_f[predict_nr][1]) );
|
||||
#endif
|
||||
}
|
||||
|
||||
outbuf[sample_count] = clamp16(sample);
|
||||
|
@ -1,36 +1,44 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../header.h"
|
||||
|
||||
/* .BAF - Bizarre Creations (Blur, James Bond 007: Blood Stone, etc) */
|
||||
|
||||
VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t WAVE_size,DATA_size;
|
||||
off_t WAVE_size, DATA_size;
|
||||
off_t start_offset;
|
||||
long sample_count;
|
||||
int sample_rate;
|
||||
|
||||
const int frame_size = 33;
|
||||
const int frame_samples = 64;
|
||||
const int frame_samples = (frame_size-1) * 2;
|
||||
int channels;
|
||||
int loop_flag = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("baf",filename_extension(filename))) goto fail;
|
||||
/* check extensions */
|
||||
if ( !header_check_extensions(streamFile, "baf") )
|
||||
goto fail;
|
||||
|
||||
/* check WAVE */
|
||||
if (read_32bitBE(0,streamFile) != 0x57415645) goto fail;
|
||||
if (read_32bitBE(0,streamFile) != 0x57415645) /* "WAVE" */
|
||||
goto fail;
|
||||
WAVE_size = read_32bitBE(4,streamFile);
|
||||
if (WAVE_size != 0x4c) goto fail;
|
||||
if (WAVE_size != 0x4c) /* && WAVE_size != 0x50*/
|
||||
goto fail;
|
||||
/* check for DATA after WAVE */
|
||||
if (read_32bitBE(WAVE_size,streamFile) != 0x44415441) goto fail;
|
||||
if (read_32bitBE(WAVE_size,streamFile) != 0x44415441) /* "DATA"*/
|
||||
goto fail;
|
||||
/* check that WAVE size is data size */
|
||||
DATA_size = read_32bitBE(0x30,streamFile);
|
||||
if (read_32bitBE(WAVE_size+4,streamFile)-8 != DATA_size) goto fail;
|
||||
|
||||
/*if (WAVE_size == 0x50) sample_count = DATA_size * frame_samples / frame_size / channels;*/
|
||||
sample_count = read_32bitBE(0x44,streamFile);
|
||||
|
||||
/*if (WAVE_size == 0x50) sample_rate = read_32bitBE(0x3c,streamFile);*/
|
||||
sample_rate = read_32bitBE(0x40,streamFile);
|
||||
|
||||
/* unsure how to detect channel count, so use a hack */
|
||||
channels = (long long)DATA_size / frame_size * frame_samples / sample_count;
|
||||
|
||||
@ -40,33 +48,22 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = WAVE_size + 8;
|
||||
vgmstream->sample_rate = read_32bitBE(0x40,streamFile);
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = sample_count;
|
||||
|
||||
vgmstream->coding_type = coding_BAF_ADPCM;
|
||||
vgmstream->coding_type = coding_VAG_ADPCM_cfg;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = frame_size;
|
||||
vgmstream->meta_type = meta_BAF;
|
||||
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE *file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channels;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+vgmstream->interleave_block_size*i;
|
||||
|
||||
}
|
||||
}
|
||||
/* open the file for reading */
|
||||
if ( !header_open_stream(vgmstream, streamFile, start_offset) )
|
||||
goto fail;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
117
src/meta/bgw.c
117
src/meta/bgw.c
@ -1,80 +1,93 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
#include "../header.h"
|
||||
|
||||
/* BGW (FF XI) */
|
||||
/* BGW (FF XI)
|
||||
*
|
||||
* Some info from POLUtils
|
||||
*/
|
||||
VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
uint32_t codec, filesize, blocksize, sample_rate;
|
||||
int32_t loop_start;
|
||||
uint8_t block_align;
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("bgw",filename_extension(filename))) goto fail;
|
||||
|
||||
/* "BGMStream" */
|
||||
if (read_32bitBE(0,streamFile) != 0x42474d53 ||
|
||||
read_32bitBE(4,streamFile) != 0x74726561 ||
|
||||
read_32bitBE(8,streamFile) != 0x6d000000 ||
|
||||
read_32bitBE(12,streamFile) != 0) goto fail;
|
||||
|
||||
/* check file size with header value */
|
||||
if (read_32bitLE(0x10,streamFile) != get_streamfile_size(streamFile))
|
||||
/* check extensions */
|
||||
if ( !header_check_extensions(streamFile, "bgw") )
|
||||
goto fail;
|
||||
|
||||
channel_count = read_8bit(0x2e,streamFile);
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x42474d53 || /* "BGMS" */
|
||||
read_32bitBE(0x04,streamFile) != 0x74726561 || /* "trea" */
|
||||
read_32bitBE(0x08,streamFile) != 0x6d000000 ) /* "m\0\0\0" */
|
||||
goto fail;
|
||||
|
||||
codec = read_32bitLE(0x0c,streamFile);
|
||||
filesize = read_32bitLE(0x10,streamFile);
|
||||
/*file_id = read_32bitLE(0x14,streamFile);*/
|
||||
blocksize = read_32bitLE(0x18,streamFile);
|
||||
loop_start = read_32bitLE(0x1c,streamFile);
|
||||
sample_rate = (read_32bitLE(0x20,streamFile) + read_32bitLE(0x24,streamFile)) & 0xFFFFFFFF; /* bizarrely obfuscated sample rate */
|
||||
start_offset = read_32bitLE(0x28,streamFile);
|
||||
/*0x2c: unk (vol?) */
|
||||
/*0x2d: unk (0x10?) */
|
||||
channel_count = read_8bit(0x2e,streamFile);
|
||||
block_align = read_8bit(0x2f,streamFile);
|
||||
|
||||
|
||||
/* check file size with header value */
|
||||
if (filesize != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
|
||||
loop_flag = (loop_start > 0);
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitLE(0x28,streamFile);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->coding_type = coding_FFXI;
|
||||
vgmstream->num_samples = read_32bitLE(0x18,streamFile)*16;
|
||||
vgmstream->meta_type = meta_FFXI_BGW;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = blocksize * block_align;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (loop_start-1)*16;
|
||||
vgmstream->loop_start_sample = (loop_start-1) * block_align;
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 9;
|
||||
vgmstream->meta_type = meta_FFXI_BGW;
|
||||
switch (codec) {
|
||||
case 0: { /* ADPCM */
|
||||
vgmstream->coding_type = coding_VAG_ADPCM_cfg;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */
|
||||
break;
|
||||
}
|
||||
case 1: /* PCM */
|
||||
case 3: /* ATRAC3 (encrypted) */
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+i*9;
|
||||
|
||||
}
|
||||
}
|
||||
if ( !header_open_stream(vgmstream, streamFile, start_offset) )
|
||||
goto fail;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* .spw (SEWave, PlayOnline viewer for FFXI), very similar to bgw */
|
||||
VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag = 0;
|
||||
@ -82,8 +95,8 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("spw",filename_extension(filename))) goto fail;
|
||||
if ( !header_check_extensions(streamFile, "spw") )
|
||||
goto fail;
|
||||
|
||||
/* "SeWave" */
|
||||
if (read_32bitBE(0,streamFile) != 0x53655761 ||
|
||||
@ -105,7 +118,7 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
start_offset = read_32bitLE(0x24,streamFile);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->coding_type = coding_FFXI;
|
||||
vgmstream->coding_type = coding_VAG_ADPCM_cfg;
|
||||
vgmstream->num_samples = read_32bitLE(0x14,streamFile)*16;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = (loop_start-1)*16;
|
||||
@ -116,20 +129,10 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
|
||||
vgmstream->interleave_block_size = 9;
|
||||
vgmstream->meta_type = meta_FFXI_SPW;
|
||||
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+i*9;
|
||||
|
||||
}
|
||||
}
|
||||
if ( !header_open_stream(vgmstream, streamFile, start_offset) )
|
||||
goto fail;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
|
@ -195,7 +195,7 @@ VGMSTREAM * init_vgmstream_ps3_sgdx(STREAMFILE *streamFile) {
|
||||
}
|
||||
#endif
|
||||
case 0x05: /* Short VAG ADPCM */
|
||||
vgmstream->coding_type = coding_SHORT_VAG_ADPCM;
|
||||
vgmstream->coding_type = coding_VAG_ADPCM_cfg;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x4;
|
||||
|
||||
|
@ -1024,20 +1024,16 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
||||
case coding_AICA:
|
||||
return 2;
|
||||
case coding_NGC_AFC:
|
||||
case coding_FFXI:
|
||||
return 16;
|
||||
case coding_PSX:
|
||||
case coding_PSX_badflags:
|
||||
case coding_invert_PSX:
|
||||
case coding_HEVAG_ADPCM:
|
||||
case coding_XA:
|
||||
return 28;
|
||||
case coding_SHORT_VAG_ADPCM:
|
||||
return 6;
|
||||
case coding_VAG_ADPCM_cfg:
|
||||
return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */
|
||||
case coding_XBOX:
|
||||
case coding_INT_XBOX:
|
||||
case coding_BAF_ADPCM:
|
||||
return 64;
|
||||
case coding_EAXA:
|
||||
return 28;
|
||||
case coding_MAXIS_ADPCM:
|
||||
@ -1155,16 +1151,14 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
||||
case coding_SNDS_IMA:
|
||||
return 0;
|
||||
case coding_NGC_AFC:
|
||||
case coding_FFXI:
|
||||
return 9;
|
||||
case coding_PSX:
|
||||
case coding_PSX_badflags:
|
||||
case coding_HEVAG_ADPCM:
|
||||
case coding_invert_PSX:
|
||||
case coding_NDS_PROCYON:
|
||||
return 16;
|
||||
case coding_SHORT_VAG_ADPCM:
|
||||
return 4;
|
||||
case coding_VAG_ADPCM_cfg:
|
||||
return vgmstream->interleave_block_size;
|
||||
case coding_XA:
|
||||
return 14*vgmstream->channels;
|
||||
case coding_XBOX:
|
||||
@ -1184,8 +1178,6 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
||||
return 1;
|
||||
case coding_APPLE_IMA4:
|
||||
return 34;
|
||||
case coding_BAF_ADPCM:
|
||||
return 33;
|
||||
case coding_LSF:
|
||||
return 28;
|
||||
#ifdef VGM_USE_G7221
|
||||
@ -1424,20 +1416,6 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_FFXI:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_ffxi_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_BAF_ADPCM:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_baf_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_HEVAG_ADPCM:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_hevag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
@ -1445,11 +1423,11 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_SHORT_VAG_ADPCM:
|
||||
case coding_VAG_ADPCM_cfg:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_short_vag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_vag_adpcm_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
samples_to_do, vgmstream->interleave_block_size);
|
||||
}
|
||||
break;
|
||||
case coding_XA:
|
||||
@ -1763,7 +1741,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
|
||||
vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32;
|
||||
}
|
||||
}
|
||||
/* todo preserve hevag, baf_adpcm, etc history? */
|
||||
/* todo preserve hevag/adjustable_vag_adpcm/others history? */
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -1973,17 +1951,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case coding_invert_PSX:
|
||||
snprintf(temp,TEMPSIZE,"BMDX \"encrypted\" Playstation 4-bit ADPCM");
|
||||
break;
|
||||
case coding_FFXI:
|
||||
snprintf(temp,TEMPSIZE,"FFXI Playstation-ish 4-bit ADPCM");
|
||||
break;
|
||||
case coding_BAF_ADPCM:
|
||||
snprintf(temp,TEMPSIZE,"Bizarre Creations Playstation-ish 4-bit ADPCM");
|
||||
break;
|
||||
case coding_HEVAG_ADPCM:
|
||||
snprintf(temp,TEMPSIZE,"PSVita HEVAG ADPCM");
|
||||
break;
|
||||
case coding_SHORT_VAG_ADPCM:
|
||||
snprintf(temp,TEMPSIZE,"Short VAG (SGXD type 5) ADPCM");
|
||||
case coding_VAG_ADPCM_cfg:
|
||||
snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)");
|
||||
break;
|
||||
case coding_XA:
|
||||
snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM");
|
||||
|
@ -91,10 +91,8 @@ typedef enum {
|
||||
coding_PSX, /* PSX & PS2 ADPCM */
|
||||
coding_invert_PSX, /* PSX ADPCM with some weirdness */
|
||||
coding_PSX_badflags, /* with garbage in the flags byte */
|
||||
coding_FFXI, /* FF XI PSX-ish ADPCM */
|
||||
coding_BAF_ADPCM, /* Bizarre Creations PSX-ish ADPCM */
|
||||
coding_HEVAG_ADPCM, /* PSVita games */
|
||||
coding_SHORT_VAG_ADPCM, /* SGXD type 5 (PS3 Afrika) */
|
||||
coding_VAG_ADPCM_cfg, /* VAG with configurable frame size: FF XI, SGXD type 5, Bizarre Creations */
|
||||
coding_XA, /* PSX CD-XA */
|
||||
coding_XBOX, /* XBOX IMA */
|
||||
coding_INT_XBOX, /* XBOX 'real interleaved' IMA */
|
||||
|
Loading…
x
Reference in New Issue
Block a user