This commit is contained in:
bnnm 2020-05-24 16:28:07 +02:00
parent 98c450c4b9
commit c7b2fed324
3 changed files with 37 additions and 39 deletions

View File

@ -1220,7 +1220,7 @@ static const meta_info meta_info_list[] = {
{meta_UBI_BAO, "Ubisoft BAO header"},
{meta_DSP_SWITCH_AUDIO, "UE4 Switch Audio header"},
{meta_TA_AAC_VITA, "tri-Ace AAC (Vita) header"},
{meta_DSP_SADF, "Procyon Studio SADF header"},
{meta_SADF, "Procyon Studio SADF header"},
{meta_H4M, "Hudson HVQM4 header"},
{meta_ASF, "Argonaut ASF header"},
{meta_XMD, "Konami XMD header"},

View File

@ -1,41 +1,41 @@
#include "meta.h"
#include "../util.h"
/* sadf - from Procyon Studio games [Xenoblade Chronicles 2 (Switch)] (sfx) */
VGMSTREAM * init_vgmstream_sadf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int channel_count, loop_flag;
/* sadf - from Procyon Studio audio driver games [Xenoblade Chronicles 2 (Switch)] (sfx) */
VGMSTREAM* init_vgmstream_sadf(STREAMFILE* sf) {
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" */
if (!check_extensions(sf, "sad"))
goto fail;
channel_count = read_8bit(0x18, streamFile);
loop_flag = read_8bit(0x19, streamFile);
start_offset = read_32bitLE(0x1C, streamFile);
if (read_32bitBE(0x00, sf) != 0x73616466) /* "sadf" */
goto fail;
channel_count = read_8bit(0x18, sf);
loop_flag = read_8bit(0x19, sf);
start_offset = read_32bitLE(0x1C, sf);
/* 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);
vgmstream->num_samples = read_32bitLE(0x28, sf);
vgmstream->sample_rate = read_32bitLE(0x24, sf);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x2c, streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x30, streamFile);
vgmstream->loop_start_sample = read_32bitLE(0x2c, sf);
vgmstream->loop_end_sample = read_32bitLE(0x30, sf);
}
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;
vgmstream->interleave_block_size = channel_count == 1 ? 0x8 : read_32bitLE(0x20, sf) / channel_count;
vgmstream->meta_type = meta_SADF;
dsp_read_coefs_le(vgmstream, streamFile, 0x80, 0x80);
dsp_read_coefs_le(vgmstream, sf, 0x80, 0x80);
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;

View File

@ -1,32 +1,30 @@
#include "meta.h"
#include "../util.h"
/* sadl - from DS games with Procyon Studio audio driver */
VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
/* sadl - from DS games with Procyon Studio audio driver [Professor Layton (DS), Soma Bringer (DS)] */
VGMSTREAM* init_vgmstream_sadl(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
int channel_count, loop_flag;
off_t start_offset;
int loop_flag, channel_count;
/* checks */
if (!check_extensions(streamFile, "sad"))
if (!check_extensions(sf, "sad"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x7361646c) /* "sadl" */
if (read_32bitBE(0x00,sf) != 0x7361646c) /* "sadl" */
goto fail;
if (read_32bitLE(0x40,streamFile) != get_streamfile_size(streamFile))
if (read_32bitLE(0x40,sf) != get_streamfile_size(sf))
goto fail;
loop_flag = read_8bit(0x31,streamFile);
channel_count = read_8bit(0x32,streamFile);
loop_flag = read_8bit(0x31,sf);
channel_count = read_8bit(0x32,sf);
start_offset = 0x100;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
switch (read_8bit(0x33,streamFile) & 6) {
switch (read_8bit(0x33,sf) & 6) {
case 4:
vgmstream->sample_rate = 32728;
break;
@ -42,20 +40,20 @@ VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
switch(read_8bit(0x33,streamFile) & 0xf0) {
switch(read_8bit(0x33,sf) & 0xf0) {
case 0x70: /* Ni no Kuni (DS), Professor Layton and the Curious Village (DS), Soma Bringer (DS) */
vgmstream->coding_type = coding_IMA_int;
vgmstream->num_samples = (read_32bitLE(0x40,streamFile)-start_offset)/channel_count*2;
vgmstream->loop_start_sample = (read_32bitLE(0x54,streamFile)-start_offset)/channel_count*2;
vgmstream->num_samples = (read_32bitLE(0x40,sf)-start_offset)/channel_count*2;
vgmstream->loop_start_sample = (read_32bitLE(0x54,sf)-start_offset)/channel_count*2;
vgmstream->loop_end_sample = vgmstream->num_samples;
break;
case 0xb0: /* Soma Bringer (DS), Rekishi Taisen Gettenka (DS) */
vgmstream->coding_type = coding_NDS_PROCYON;
vgmstream->num_samples = (read_32bitLE(0x40,streamFile)-start_offset)/channel_count/16*30;
vgmstream->loop_start_sample = (read_32bitLE(0x54,streamFile)-start_offset)/channel_count/16*30;
vgmstream->num_samples = (read_32bitLE(0x40,sf)-start_offset)/channel_count/16*30;
vgmstream->loop_start_sample = (read_32bitLE(0x54,sf)-start_offset)/channel_count/16*30;
vgmstream->loop_end_sample = vgmstream->num_samples;
break;
@ -63,7 +61,7 @@ VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
goto fail;
}
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;