Add LPCM .ladpcm [Melty Blood Type Lumina (Sw)]

This commit is contained in:
bnnm 2021-10-03 13:48:22 +02:00
parent fc4f7f8f7f
commit 67241ebda5
8 changed files with 82 additions and 11 deletions

View File

@ -266,6 +266,7 @@ static const char* extension_list[] = {
"l",
"l00", //txth/reserved [Disney's Dinosaur (PS2)]
"laac", //fake extension for .aac (tri-Ace)
"ladpcm", //not fake
"laif", //fake extension for .aif (various)
"laiff", //fake extension for .aiff
"laifc", //fake extension for .aifc
@ -1364,7 +1365,8 @@ static const meta_info meta_info_list[] = {
{meta_BNK_RELIC, "Relic BNK header"},
{meta_XSH_XSD_XSS, "Treyarch XSH+XSD/XSS header"},
{meta_PSB, "M2 PSB header"},
{meta_LOPU, "French-Break LOPU header"},
{meta_LOPU_FB, "French-Bread LOPU header"},
{meta_LPCM_FB, "French-Bread LPCM header"},
};
void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) {

View File

@ -215,7 +215,8 @@
<ClCompile Include="meta\ktsr.c" />
<ClCompile Include="meta\ktss.c" />
<ClCompile Include="meta\kwb.c" />
<ClCompile Include="meta\lopu.c" />
<ClCompile Include="meta\lopu_fb.c" />
<ClCompile Include="meta\lpcm_fb.c" />
<ClCompile Include="meta\lrmd.c" />
<ClCompile Include="meta\lsf.c" />
<ClCompile Include="meta\mattel_hyperscan.c" />

View File

@ -1903,7 +1903,10 @@
<ClCompile Include="meta\kwb.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\lopu.c">
<ClCompile Include="meta\lopu_fb.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\lpcm_fb.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\lrmd.c">

View File

@ -2,11 +2,11 @@
#include "../coding/coding.h"
/* LOPU - French-Bread's Opus [Melty Blood: Type Lumina (Switch)] */
VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf) {
/* LOPU - French-Bread's Opus [Melty Blood: Type Lumina (Switch)] */
VGMSTREAM* init_vgmstream_lopu_fb(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
int loop_flag, channels, sample_rate;
uint32_t start_offset, data_size;
int loop_flag, channels, sample_rate;
int32_t num_samples, loop_start, loop_end, skip;
/* checks */
@ -18,7 +18,7 @@ VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf) {
goto fail;
start_offset = read_u32le(0x04, sf);
sample_rate = read_u32le(0x08, sf);
sample_rate = read_s32le(0x08, sf);
channels = read_s16le(0x0c, sf);
/* 0x10: ? (1984) */
num_samples = read_s32le(0x14, sf);
@ -37,7 +37,7 @@ VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf) {
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_LOPU;
vgmstream->meta_type = meta_LOPU_FB;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = num_samples;
vgmstream->loop_start_sample = loop_start;

61
src/meta/lpcm_fb.c Normal file
View File

@ -0,0 +1,61 @@
#include "meta.h"
#include "../coding/coding.h"
/* LPCM - French-Bread's DSP [Melty Blood: Type Lumina (Switch)] */
VGMSTREAM* init_vgmstream_lpcm_fb(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
uint32_t start_offset;
int loop_flag, channels, sample_rate;
int32_t num_samples;
/* checks */
if (!is_id32be(0x00, sf, "LPCM"))
goto fail;
/* .ladpcm: real extension (honest) */
if (!check_extensions(sf, "ladpcm"))
goto fail;
/* 0x04: dsp offset (0x20) */
if (read_u32le(0x04, sf) != 0x20)
goto fail;
num_samples = read_s32le(0x20, sf);
/* 0x24: nibbles? */
sample_rate = read_s32le(0x28, sf);
/* 0x2c: 0? */
/* 0x30: 2? */
/* 0x34: nibbles? */
/* 0x38: 2? */
if (read_u32le(0x38, sf) != 2)
goto fail;
channels = 1;
loop_flag = 0;
start_offset = 0x78; /* could be 0x80 but this is closer to num_samples */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_LPCM_FB;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = num_samples;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none;
dsp_read_coefs_le(vgmstream, sf, 0x3c, 0);
/* 0x5c: hist? */
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -964,6 +964,8 @@ VGMSTREAM* init_vgmstream_xsh_xsd_xss(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_psb(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_lopu(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_lopu_fb(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_lpcm_fb(STREAMFILE* sf);
#endif /*_META_H*/

View File

@ -527,7 +527,8 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_bnk_relic,
init_vgmstream_xsh_xsd_xss,
init_vgmstream_psb,
init_vgmstream_lopu,
init_vgmstream_lopu_fb,
init_vgmstream_lpcm_fb,
/* 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 */

View File

@ -747,7 +747,8 @@ typedef enum {
meta_BNK_RELIC,
meta_XSH_XSD_XSS,
meta_PSB,
meta_LOPU,
meta_LOPU_FB,
meta_LPCM_FB,
} meta_t;