mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-21 12:51:57 +01:00
Move sadf from ngc_dsp_std.c to sadf.c since it's not very standard
This commit is contained in:
parent
45cda9b0ca
commit
98c450c4b9
@ -942,10 +942,14 @@
|
||||
RelativePath=".\meta\nds_rrds.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sadl.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sadf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sadl.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\nds_strm.c"
|
||||
>
|
||||
|
@ -360,6 +360,7 @@
|
||||
<ClCompile Include="meta\naomi_spsd.c" />
|
||||
<ClCompile Include="meta\nds_hwas.c" />
|
||||
<ClCompile Include="meta\nds_rrds.c" />
|
||||
<ClCompile Include="meta\sadf.c" />
|
||||
<ClCompile Include="meta\sadl.c" />
|
||||
<ClCompile Include="meta\nds_strm.c" />
|
||||
<ClCompile Include="meta\nds_strm_ffta2.c" />
|
||||
|
@ -595,6 +595,9 @@
|
||||
<ClCompile Include="meta\nds_rrds.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\sadf.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="meta\sadl.c">
|
||||
<Filter>meta\Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -655,48 +655,6 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* sadf - Procyon Studio Header Variant [Xenoblade Chronicles 2 (Switch)] (sfx) */
|
||||
VGMSTREAM * init_vgmstream_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;
|
||||
}
|
||||
|
||||
/* IDSP - Traveller's Tales header + interleaved dsps [Lego Batman (Wii), Lego Dimensions (Wii U)] */
|
||||
VGMSTREAM * init_vgmstream_idsp_tt(STREAMFILE *streamFile) {
|
||||
|
45
src/meta/sadf.c
Normal file
45
src/meta/sadf.c
Normal file
@ -0,0 +1,45 @@
|
||||
#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;
|
||||
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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user