Add switch_audio [Gal Gun 2 (Switch)]

This commit is contained in:
bnnm 2018-04-29 21:04:55 +02:00
parent 65b322943f
commit d292531654
5 changed files with 34 additions and 1 deletions

View File

@ -338,6 +338,7 @@ static const char* extension_list[] = {
"swag",
"swav",
"swd",
"switch_audio"
"sx",
"sxd",
"sxd2",
@ -487,7 +488,7 @@ static const coding_info coding_info_list[] = {
{coding_PSX, "Playstation 4-bit ADPCM"},
{coding_PSX_badflags, "Playstation 4-bit ADPCM (bad flags)"},
{coding_PSX_cfg, "Playstation 4-bit ADPCM (configurable)"},
{coding_HEVAG, "Playstation Vita HEVAG 4-bit ADPCM"},
{coding_HEVAG, "Sony HEVAG 4-bit ADPCM"},
{coding_EA_XA, "Electronic Arts EA-XA 4-bit ADPCM v1"},
{coding_EA_XA_int, "Electronic Arts EA-XA 4-bit ADPCM v1 (mono/interleave)"},
@ -1009,6 +1010,7 @@ static const meta_info meta_info_list[] = {
{meta_PPST, "Parappa PPST header"},
{meta_OPUS_PPP, "AT9 OPUS header"},
{meta_UBI_BAO, "Ubisoft BAO header"},
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
#ifdef VGM_USE_FFMPEG
{meta_FFmpeg, "FFmpeg supported file format"},

View File

@ -749,4 +749,5 @@ VGMSTREAM * init_vgmstream_opus_ppp(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ubi_bao_pk(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dsp_switch_audio(STREAMFILE *streamFile);
#endif /*_META_H*/

View File

@ -1340,3 +1340,31 @@ VGMSTREAM * init_vgmstream_dsp_mcadpcm(STREAMFILE *streamFile) {
fail:
return NULL;
}
/* .switch_audio - UE4 standard LE header + full interleaved dsp [Gal Gun 2 (Switch)] */
VGMSTREAM * init_vgmstream_dsp_switch_audio(STREAMFILE *streamFile) {
dsp_meta dspm = {0};
/* checks */
/* .switch_audio: possibly UE4 class name rather than extension, .dsp: assumed */
if (!check_extensions(streamFile, "switch_audio,dsp"))
goto fail;
/* manual double header test */
if (read_32bitLE(0x00, streamFile) == read_32bitLE(get_streamfile_size(streamFile) / 2, streamFile))
dspm.channel_count = 2;
else
dspm.channel_count = 1;
dspm.max_channels = 2;
dspm.little_endian = 1;
dspm.header_offset = 0x00;
dspm.header_spacing = get_streamfile_size(streamFile) / dspm.channel_count;
dspm.start_offset = dspm.header_offset + 0x60;
dspm.interleave = dspm.header_spacing;
dspm.meta_type = meta_DSP_SWITCH_AUDIO;
return init_vgmstream_dsp_common(streamFile, &dspm);
fail:
return NULL;
}

View File

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

View File

@ -674,6 +674,7 @@ typedef enum {
meta_PPST, /* PPST [Parappa the Rapper (PSP)] */
meta_OPUS_PPP, /* .at9 Opus [Penny-Punching Princess (Switch)] */
meta_UBI_BAO, /* Ubisoft BAO */
meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */
#ifdef VGM_USE_FFMPEG
meta_FFmpeg,