mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-15 02:57:38 +01:00
Move dsp_str to its own file for clarity (not using standard DSP header)
This commit is contained in:
parent
6145cd3ddc
commit
7b1fed0720
@ -662,6 +662,10 @@
|
|||||||
RelativePath=".\meta\ngc_ssm.c"
|
RelativePath=".\meta\ngc_ssm.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\meta\ngc_str_cauldron.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\meta\ngc_tydsp.c"
|
RelativePath=".\meta\ngc_tydsp.c"
|
||||||
>
|
>
|
||||||
|
@ -271,6 +271,7 @@
|
|||||||
<ClCompile Include="meta\ngc_pdt.c" />
|
<ClCompile Include="meta\ngc_pdt.c" />
|
||||||
<ClCompile Include="meta\ngc_sck_dsp.c" />
|
<ClCompile Include="meta\ngc_sck_dsp.c" />
|
||||||
<ClCompile Include="meta\ngc_ssm.c" />
|
<ClCompile Include="meta\ngc_ssm.c" />
|
||||||
|
<ClCompile Include="meta\ngc_str_cauldron.c" />
|
||||||
<ClCompile Include="meta\ngc_tydsp.c" />
|
<ClCompile Include="meta\ngc_tydsp.c" />
|
||||||
<ClCompile Include="meta\ngc_ymf.c" />
|
<ClCompile Include="meta\ngc_ymf.c" />
|
||||||
<ClCompile Include="meta\ngc_ulw.c" />
|
<ClCompile Include="meta\ngc_ulw.c" />
|
||||||
|
@ -397,6 +397,9 @@
|
|||||||
<ClCompile Include="meta\ngc_ssm.c">
|
<ClCompile Include="meta\ngc_ssm.c">
|
||||||
<Filter>meta\Source Files</Filter>
|
<Filter>meta\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="meta\ngc_str_cauldron.c">
|
||||||
|
<Filter>meta\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="meta\ngc_tydsp.c">
|
<ClCompile Include="meta\ngc_tydsp.c">
|
||||||
<Filter>meta\Source Files</Filter>
|
<Filter>meta\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -24,6 +24,7 @@ struct dsp_header {
|
|||||||
uint16_t loop_ps;
|
uint16_t loop_ps;
|
||||||
int16_t loop_hist1;
|
int16_t loop_hist1;
|
||||||
int16_t loop_hist2;
|
int16_t loop_hist2;
|
||||||
|
/* later/mdsp extension */
|
||||||
int16_t channel_count;
|
int16_t channel_count;
|
||||||
int16_t block_size;
|
int16_t block_size;
|
||||||
};
|
};
|
||||||
@ -581,67 +582,6 @@ fail:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* str: a very simple header format with implicit loop values
|
|
||||||
* it's allways in interleaved stereo format
|
|
||||||
*/
|
|
||||||
VGMSTREAM * init_vgmstream_ngc_str(STREAMFILE *streamFile) {
|
|
||||||
VGMSTREAM * vgmstream = NULL;
|
|
||||||
char filename[PATH_LIMIT];
|
|
||||||
|
|
||||||
const off_t start_offset = 0x60;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("str",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* always 0xFAAF0001 @ offset 0 */
|
|
||||||
if (read_32bitBE(0x00,streamFile)!=0xFAAF0001) goto fail;
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
|
||||||
/* always loop & stereo */
|
|
||||||
vgmstream = allocate_vgmstream(2,1);
|
|
||||||
if (!vgmstream) goto fail;
|
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
|
||||||
vgmstream->num_samples = read_32bitBE(0x08,streamFile);
|
|
||||||
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
|
|
||||||
|
|
||||||
/* always loop to the beginning */
|
|
||||||
vgmstream->loop_start_sample=0;
|
|
||||||
vgmstream->loop_end_sample=vgmstream->num_samples;
|
|
||||||
|
|
||||||
vgmstream->coding_type = coding_NGC_DSP;
|
|
||||||
vgmstream->layout_type = layout_interleave;
|
|
||||||
vgmstream->interleave_block_size = read_32bitBE(0x0C,streamFile);
|
|
||||||
vgmstream->meta_type = meta_DSP_STR;
|
|
||||||
|
|
||||||
/* coeffs */
|
|
||||||
for (i=0;i<16;i++) {
|
|
||||||
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x10+(i*2),streamFile);
|
|
||||||
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x30+(i*2),streamFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the file for reading */
|
|
||||||
for (i=0;i<2;i++) {
|
|
||||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
|
|
||||||
vgmstream->interleave_block_size);
|
|
||||||
|
|
||||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
|
||||||
vgmstream->ch[i].offset=start_offset+
|
|
||||||
vgmstream->interleave_block_size*i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return vgmstream;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* a bunch of formats that are identical except for file extension,
|
/* a bunch of formats that are identical except for file extension,
|
||||||
* but have different interleaves */
|
* but have different interleaves */
|
||||||
VGMSTREAM * init_vgmstream_ngc_dsp_std_int(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_ngc_dsp_std_int(STREAMFILE *streamFile) {
|
||||||
@ -882,7 +822,6 @@ fail:
|
|||||||
#define SADB_MAX_CHANNELS 2
|
#define SADB_MAX_CHANNELS 2
|
||||||
/* sadb - Procyon Studio header + interleaved dsp [Shiren the Wanderer 3 (Wii), Disaster: Day of Crisis (Wii)] */
|
/* sadb - Procyon Studio header + interleaved dsp [Shiren the Wanderer 3 (Wii), Disaster: Day of Crisis (Wii)] */
|
||||||
VGMSTREAM * init_vgmstream_sadb(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_sadb(STREAMFILE *streamFile) {
|
||||||
|
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
off_t start_offset, header_offset;
|
off_t start_offset, header_offset;
|
||||||
size_t header_spacing, interleave;
|
size_t header_spacing, interleave;
|
||||||
|
46
src/meta/ngc_str_cauldron.c
Normal file
46
src/meta/ngc_str_cauldron.c
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#include "meta.h"
|
||||||
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
/* .str - Cauldron/Conan mini-header + interleaved dsp data [Conan (GC)] */
|
||||||
|
VGMSTREAM * init_vgmstream_ngc_str(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
off_t start_offset;
|
||||||
|
int channel_count, loop_flag;
|
||||||
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if (!check_extensions(streamFile, "str"))
|
||||||
|
goto fail;
|
||||||
|
if (read_32bitBE(0x00,streamFile) != 0xFAAF0001) /* header id */
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
channel_count = 2; /* always loop & stereo */
|
||||||
|
loop_flag = 1;
|
||||||
|
start_offset = 0x60;
|
||||||
|
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
|
||||||
|
vgmstream->num_samples = read_32bitBE(0x08,streamFile);
|
||||||
|
vgmstream->loop_start_sample = 0;
|
||||||
|
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||||
|
|
||||||
|
vgmstream->meta_type = meta_DSP_STR;
|
||||||
|
vgmstream->coding_type = coding_NGC_DSP;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = read_32bitBE(0x0C,streamFile);
|
||||||
|
|
||||||
|
dsp_read_coefs_be(vgmstream, streamFile, 0x10, 0x20);
|
||||||
|
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||||
|
goto fail;
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user