2008-11-28 15:27:51 +01:00
|
|
|
#include "meta.h"
|
2023-06-24 17:56:09 +02:00
|
|
|
#include "../coding/coding.h"
|
2008-11-28 15:27:51 +01:00
|
|
|
|
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* YDSP - from Yuke's games [WWE Day of Reckoning (GC), WWE WrestleMania XIX (GC)] */
|
|
|
|
VGMSTREAM* init_vgmstream_ydsp(STREAMFILE* sf) {
|
|
|
|
VGMSTREAM* vgmstream = NULL;
|
|
|
|
int channels, loop_flag;
|
|
|
|
uint32_t start_offset;
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* checks */
|
|
|
|
if (!is_id32be(0x00,sf, "YDSP"))
|
|
|
|
return NULL;
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* .ydsp: header id (in bigfile, .yds is the likely extension comparing similar files) */
|
|
|
|
if (!check_extensions(sf, "ydsp"))
|
|
|
|
return NULL;
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
loop_flag = (read_s32be(0xB0,sf) != 0x0);
|
|
|
|
channels = read_u16be(0x10,sf);
|
2008-11-28 15:27:51 +01:00
|
|
|
start_offset = 0x120;
|
2010-05-02 21:16:35 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
2010-05-02 21:16:35 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
vgmstream->meta_type = meta_YDSP;
|
|
|
|
vgmstream->sample_rate = read_s32be(0x0C,sf);
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
vgmstream->num_samples = dsp_bytes_to_samples(read_u32be(0x08,sf), channels);
|
|
|
|
vgmstream->loop_start_sample = read_s32be(0xB0,sf);
|
|
|
|
vgmstream->loop_end_sample = read_s32be(0xB4,sf);
|
2010-05-02 21:16:35 +02:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
vgmstream->coding_type = coding_NGC_DSP;
|
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->interleave_block_size = read_32bitBE(0x14,sf);
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
dsp_read_coefs_be(vgmstream, sf, 0x20, 0x24);
|
|
|
|
//dsp_read_hist_be(vgmstream, sf, 0x20 + 0x20, 0x24);
|
2008-11-28 15:27:51 +01:00
|
|
|
|
2023-06-24 17:56:09 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
|
|
|
goto fail;
|
2008-11-28 15:27:51 +01:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2023-06-24 17:56:09 +02:00
|
|
|
close_vgmstream(vgmstream);
|
2008-11-28 15:27:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|