mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
cleanup: voi
This commit is contained in:
parent
842735b8db
commit
8db9d8ead3
@ -1179,6 +1179,7 @@ static const meta_info meta_info_list[] = {
|
|||||||
{meta_PS2_GCM, "Namco GCM header"},
|
{meta_PS2_GCM, "Namco GCM header"},
|
||||||
{meta_SMPL, "Skonec SMPL header"},
|
{meta_SMPL, "Skonec SMPL header"},
|
||||||
{meta_PS2_MSA, "Success .MSA header"},
|
{meta_PS2_MSA, "Success .MSA header"},
|
||||||
|
{meta_VOI, "Irem .VOI header"},
|
||||||
{meta_NGC_PDT, "Hudson .PDT header"},
|
{meta_NGC_PDT, "Hudson .PDT header"},
|
||||||
{meta_NGC_RKV, "Legacy of Kain - Blood Omen 2 RKV GC header"},
|
{meta_NGC_RKV, "Legacy of Kain - Blood Omen 2 RKV GC header"},
|
||||||
{meta_DSP_DDSP, ".DDSP header"},
|
{meta_DSP_DDSP, ".DDSP header"},
|
||||||
|
@ -452,7 +452,7 @@ VGMSTREAM* init_vgmstream_smpl(STREAMFILE* sf);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE* streamFile);
|
VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE* streamFile);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_voi(STREAMFILE* streamFile);
|
VGMSTREAM* init_vgmstream_voi(STREAMFILE* sf);
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ngc_rkv(STREAMFILE* streamFile);
|
VGMSTREAM * init_vgmstream_ngc_rkv(STREAMFILE* streamFile);
|
||||||
|
|
||||||
|
@ -1,81 +1,56 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../util.h"
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
/* VOI - found in "RAW Danger" (PS2) */
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_voi(STREAMFILE *streamFile) {
|
/* .VOI - from Raw Danger (PS2) */
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM* init_vgmstream_voi(STREAMFILE* sf) {
|
||||||
char filename[PATH_LIMIT];
|
VGMSTREAM* vgmstream = NULL;
|
||||||
int loop_flag = 0;
|
int channels, loop_flag = 0;
|
||||||
int channel_count;
|
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
|
||||||
if (strcasecmp("voi",filename_extension(filename))) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
|
||||||
if (((read_32bitLE(0x04,streamFile)*2)+0x800) != (get_streamfile_size(streamFile)))
|
|
||||||
{
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* checks */
|
||||||
|
if (read_u32le(0x00,sf) != 1 && read_u32le(0x00,sf) != 2)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!check_extensions(sf, "voi"))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* probably number of samples of all channels */
|
||||||
|
if ((read_u32le(0x04,sf) * 2 + 0x800) != get_streamfile_size(sf))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
channels = read_s32le(0x00,sf);
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
channel_count = read_32bitLE(0x00,streamFile);
|
start_offset = 0x800;
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
/* fill in the vital statistics */
|
vgmstream->meta_type = meta_VOI;
|
||||||
start_offset = 0x800;
|
vgmstream->num_samples = pcm16_bytes_to_samples(get_streamfile_size(sf) - start_offset, channels);
|
||||||
vgmstream->channels = channel_count;
|
|
||||||
vgmstream->coding_type = coding_PCM16LE;
|
vgmstream->coding_type = coding_PCM16LE;
|
||||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/channel_count/2;
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
|
||||||
if (loop_flag)
|
if (read_32bitLE(0x08,sf) == 0) {
|
||||||
{
|
|
||||||
vgmstream->loop_start_sample = 0;
|
|
||||||
vgmstream->loop_end_sample = (read_32bitLE(0x04,streamFile)/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (read_32bitLE(0x08,streamFile) == 0)
|
|
||||||
{
|
|
||||||
vgmstream->sample_rate = 48000;
|
vgmstream->sample_rate = 48000;
|
||||||
vgmstream->interleave_block_size = 0x200;
|
vgmstream->interleave_block_size = 0x200;
|
||||||
}
|
}
|
||||||
else if (read_32bitLE(0x08,streamFile) == 1)
|
else if (read_32bitLE(0x08,sf) == 1) {
|
||||||
{
|
|
||||||
vgmstream->sample_rate = 24000;
|
vgmstream->sample_rate = 24000;
|
||||||
vgmstream->interleave_block_size = 0x100;
|
vgmstream->interleave_block_size = 0x100;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
goto fail;
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
vgmstream->layout_type = layout_interleave;
|
|
||||||
vgmstream->meta_type = meta_PS2_VOI;
|
|
||||||
|
|
||||||
/* open the file for reading */
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
STREAMFILE * file;
|
|
||||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
|
||||||
if (!file) goto fail;
|
|
||||||
for (i=0;i<channel_count;i++) {
|
|
||||||
vgmstream->ch[i].streamfile = file;
|
|
||||||
|
|
||||||
vgmstream->ch[i].channel_start_offset=
|
|
||||||
vgmstream->ch[i].offset=start_offset+
|
|
||||||
vgmstream->interleave_block_size*i;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||||
|
goto fail;
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
/* clean up anything we may have opened */
|
|
||||||
fail:
|
fail:
|
||||||
if (vgmstream) close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ VGMSTREAM* init_vgmstream_ymf(STREAMFILE* sf) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* .ymf can contain audio or video, but not both (videos start with 0x100 and change minor values),
|
/* .ymf can contain audio or video, but not both (videos start with 0x100 and change minor values),
|
||||||
* though it's are found in ./movie/*.* and probably are considered so */
|
* though it's are found in ./movie/... and probably are considered so */
|
||||||
|
|
||||||
loop_flag = 0;
|
loop_flag = 0;
|
||||||
channels = 2;
|
channels = 2;
|
||||||
|
@ -209,7 +209,7 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
|||||||
init_vgmstream_ps2_gcm,
|
init_vgmstream_ps2_gcm,
|
||||||
init_vgmstream_smpl,
|
init_vgmstream_smpl,
|
||||||
init_vgmstream_ps2_msa,
|
init_vgmstream_ps2_msa,
|
||||||
init_vgmstream_ps2_voi,
|
init_vgmstream_voi,
|
||||||
init_vgmstream_ngc_rkv,
|
init_vgmstream_ngc_rkv,
|
||||||
init_vgmstream_dsp_ddsp,
|
init_vgmstream_dsp_ddsp,
|
||||||
init_vgmstream_p3d,
|
init_vgmstream_p3d,
|
||||||
|
@ -466,7 +466,7 @@ typedef enum {
|
|||||||
meta_PS2_GCM, /* NamCollection */
|
meta_PS2_GCM, /* NamCollection */
|
||||||
meta_SMPL,
|
meta_SMPL,
|
||||||
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
|
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
|
||||||
meta_PS2_VOI, /* RAW Danger (Zettaizetsumei Toshi 2 - Itetsuita Kiokutachi) [PS2] */
|
meta_VOI,
|
||||||
meta_P3D, /* Prototype P3D */
|
meta_P3D, /* Prototype P3D */
|
||||||
meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */
|
meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */
|
||||||
meta_DSP_DDSP, /* Various (2 dsp files stuck together */
|
meta_DSP_DDSP, /* Various (2 dsp files stuck together */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user