Merge pull request #229 from bxaimc/master

SADF DSP for sfx from Xenoblade Chronicles 2 (Switch)
This commit is contained in:
Christopher Snowhill 2018-05-20 16:34:33 -07:00 committed by GitHub
commit 93838471df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 0 deletions

View File

@ -1016,6 +1016,7 @@ static const meta_info meta_info_list[] = {
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
{meta_TA_AAC_VITA, "tri-Ace AAC (Vita) header"},
{meta_OGG_GWM, "Ogg Vorbis (GWM header)"},
{meta_DSP_SADF, "Procyon Studio SADF header"},
#ifdef VGM_USE_FFMPEG
{meta_FFmpeg, "FFmpeg supported file format"},

View File

@ -752,4 +752,6 @@ VGMSTREAM * init_vgmstream_opus_ppp(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ubi_bao_pk(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dsp_switch_audio(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dsp_sadf(STREAMFILE *streamFile);
#endif /*_META_H*/

View File

@ -695,6 +695,49 @@ fail:
return NULL;
}
/* sadf - Procyon Studio Header Variant [Xenoblade Chronicles 2 (Switch)] (sfx) */
VGMSTREAM * init_vgmstream_dsp_sadf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int channel_count, loop_flag;
off_t start_offset;
/* checks */
if (!check_extensions(streamFile, "sad"))
goto fail;
if (read_32bitBE(0x00, streamFile) != 0x73616466) /* "sadf" */
goto fail;
channel_count = read_8bit(0x18, streamFile);
loop_flag = read_8bit(0x19, streamFile);
start_offset = read_32bitLE(0x1C, streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->num_samples = read_32bitLE(0x28, streamFile);
vgmstream->sample_rate = read_32bitLE(0x24, streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x2c, streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x30, streamFile);
}
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = channel_count == 1 ? 0x8 :
read_32bitLE(0x20, streamFile) / channel_count;
vgmstream->meta_type = meta_DSP_SADF;
dsp_read_coefs_le(vgmstream, streamFile, 0x80, 0x80);
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}
#define WSI_MAX_CHANNELS 2
/* .wsi - blocked dsp [Alone in the Dark (Wii)] */
VGMSTREAM * init_vgmstream_wsi(STREAMFILE *streamFile) {

View File

@ -409,6 +409,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_opus_ppp,
init_vgmstream_ubi_bao_pk,
init_vgmstream_dsp_switch_audio,
init_vgmstream_dsp_sadf,
init_vgmstream_txth, /* should go at the end (lower priority) */
#ifdef VGM_USE_FFMPEG

View File

@ -282,6 +282,7 @@ typedef enum {
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
meta_DSP_SADF, /* Procyon Studio SADF - Xenoblade Chronicles 2 (Switch) */
/* Nintendo */
meta_STRM, /* Nintendo STRM */