Split idsp.c into idsp_ie.c and nub_idsp.c

This commit is contained in:
bnnm 2018-08-28 20:40:02 +02:00
parent f7c26a493d
commit 5afd33d62a
6 changed files with 59 additions and 48 deletions

View File

@ -588,10 +588,14 @@
RelativePath=".\meta\his.c"
>
</File>
<File
RelativePath=".\meta\idsp.c"
>
</File>
<File
RelativePath=".\meta\idsp_ie.c"
>
</File>
<File
RelativePath=".\meta\nub_idsp.c"
>
</File>
<File
RelativePath=".\meta\ios_psnd.c"
>

View File

@ -261,7 +261,8 @@
<ClCompile Include="meta\hca.c" />
<ClCompile Include="meta\hd3_bd3.c" />
<ClCompile Include="meta\his.c" />
<ClCompile Include="meta\idsp.c" />
<ClCompile Include="meta\idsp_ie.c" />
<ClCompile Include="meta\nub_idsp.c" />
<ClCompile Include="meta\ish_isd.c" />
<ClCompile Include="meta\ivaud.c" />
<ClCompile Include="meta\ivb.c" />

View File

@ -370,7 +370,10 @@
<ClCompile Include="meta\his.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\idsp.c">
<ClCompile Include="meta\nub_idsp.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\idsp_ie.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ish_isd.c">

44
src/meta/idsp_ie.c Normal file
View File

@ -0,0 +1,44 @@
#include "meta.h"
#include "../coding/coding.h"
/* IDSP - from Inevitable Entertainment games [Defender (GC)] */
VGMSTREAM * init_vgmstream_idsp_ie(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* checks */
if ( !check_extensions(streamFile,"idsp") )
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x49445350) /* "IDSP" */
goto fail;
loop_flag = 0;
channel_count = read_32bitBE(0x0C,streamFile);
if (channel_count > 2) goto fail;
start_offset = 0x70;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_IDSP_IE;
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = dsp_bytes_to_samples(read_32bitBE(0x04,streamFile), channel_count);
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x10,streamFile);
dsp_read_coefs_be(vgmstream,streamFile,0x14,0x2E);
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -280,6 +280,7 @@ VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_xa2(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_nub_idsp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_idsp_ie(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_ymf(STREAMFILE * streamFile);

View File

@ -53,45 +53,3 @@ fail:
close_vgmstream(vgmstream);
return NULL;
}
/* IDSP - from Inevitable Entertainment games [Defender (GC)] */
VGMSTREAM * init_vgmstream_idsp_ie(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* checks */
if ( !check_extensions(streamFile,"idsp") )
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x49445350) /* "IDSP" */
goto fail;
loop_flag = 0;
channel_count = read_32bitBE(0x0C,streamFile);
if (channel_count > 2) goto fail;
start_offset = 0x70;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_IDSP_IE;
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = dsp_bytes_to_samples(read_32bitBE(0x04,streamFile), channel_count);
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x10,streamFile);
dsp_read_coefs_be(vgmstream,streamFile,0x14,0x2E);
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}