mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Tweak VDS/VDM num_samples
This commit is contained in:
parent
16423580a2
commit
15206915d1
@ -912,7 +912,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_XB3D_ADX, "Xenoblade 3D ADX header"},
|
||||
{meta_HCA, "CRI MiddleWare HCA Header"},
|
||||
{meta_PS2_SVAG_SNK, "SNK SVAG header"},
|
||||
{meta_PS2_VDS_VDM, "Graffiti Kingdom VDS/VDM header"},
|
||||
{meta_PS2_VDS_VDM, "Procyon Studio VDS/VDM header"},
|
||||
{meta_X360_CXS, "tri-Crescendo CXS header"},
|
||||
{meta_AKB, "Square-Enix AKB header"},
|
||||
{meta_NUB_XMA, "Namco NUB XMA header"},
|
||||
|
@ -1,43 +1,46 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* VDS/VDM - from Grafitti Kingdom / Rakugaki Oukoku 2 */
|
||||
/* VDS/VDM - from Procyon Studio games [Grafitti Kingdom / Rakugaki Oukoku 2 (PS2), Tsukiyo ni Saraba (PS2)] */
|
||||
VGMSTREAM * init_vgmstream_ps2_vds_vdm(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
|
||||
/* checks */
|
||||
if ( !check_extensions(streamFile,"vds,vdm"))
|
||||
goto fail;
|
||||
|
||||
if (read_32bitBE(0x00,streamFile) != 0x56445320 && /* "VDS " (music)*/
|
||||
read_32bitBE(0x00,streamFile) != 0x56444D20) /* "VDM " (voices) */
|
||||
goto fail;
|
||||
|
||||
loop_flag = read_8bit(0x20,streamFile);
|
||||
channel_count = read_32bitLE(0x10,streamFile);
|
||||
start_offset = 0x800;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = channel_count > 1 ? layout_interleave : layout_none;
|
||||
vgmstream->meta_type = meta_PS2_VDS_VDM;
|
||||
|
||||
start_offset = 0x800;
|
||||
vgmstream->num_samples = read_32bitLE(0x04,streamFile) * 28 / 16 / channel_count;
|
||||
/* 0x08: unknown, always 10 */
|
||||
/* 0x08: unknown, always 0x10 */
|
||||
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
|
||||
vgmstream->channels = channel_count; /*0x10*/
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
|
||||
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile) - start_offset) * 28 / 16 / channel_count;
|
||||
vgmstream->loop_end_sample = (read_32bitLE(0x1c,streamFile) - start_offset) * 28 / 16 / channel_count;
|
||||
vgmstream->loop_flag = loop_flag; /*0x20*/
|
||||
/*0x21: volume? */
|
||||
/*0x22: pan? */
|
||||
/*0x23: 02=VDS 04=VDM? */
|
||||
|
||||
/* open the file for reading */
|
||||
/* when looping (or maybe when stereo) data_size at 0x04 is actually smaller than file_size,
|
||||
* sometimes cutting outros with loop disabled; doesn't affect looping though */
|
||||
if (!loop_flag)
|
||||
vgmstream->num_samples = ps_bytes_to_samples(read_32bitLE(0x04,streamFile), channel_count);
|
||||
else
|
||||
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(streamFile) - start_offset, channel_count);
|
||||
vgmstream->loop_start_sample = ps_bytes_to_samples(read_32bitLE(0x18,streamFile) - start_offset, channel_count);
|
||||
vgmstream->loop_end_sample = ps_bytes_to_samples(read_32bitLE(0x1c,streamFile) - start_offset, channel_count);
|
||||
/* 0x21: volume?, 0x22: pan?, 0x23: 02=VDS 04=VDM? 02/05=VDM in Tsukiyo ni Saraba? */
|
||||
|
||||
vgmstream->meta_type = meta_PS2_VDS_VDM;
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = (channel_count == 1) ? layout_none : layout_interleave;
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
|
||||
|
||||
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
Loading…
x
Reference in New Issue
Block a user