fix ea header sample rate for file with GSTR id

add xbox_wvs

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@396 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-08-04 20:34:07 +00:00
parent ae33b01762
commit 1742eb818c
9 changed files with 221 additions and 122 deletions

View File

@ -114,7 +114,8 @@ META_OBJS=meta/adx_header.o \
meta/aix.o \
meta/ngc_tydsp.o \
meta/ngc_vjdsp.o \
meta/ngc_biodsp.o
meta/ngc_biodsp.o \
meta/xbox_wvs.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -17,8 +17,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
OutputDirectory="C:\Program Files\winamp\plugins"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
@ -269,6 +269,24 @@
<File
RelativePath=".\meta\mus_acm.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\meta\musc.c"
@ -522,6 +540,10 @@
RelativePath=".\meta\xbox_wavm.c"
>
</File>
<File
RelativePath=".\meta\xbox_wvs.c"
>
</File>
<File
RelativePath=".\meta\xbox_xwav.c"
>

View File

@ -1,93 +1,94 @@
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libmeta_la_LDFLAGS =
libmeta_la_SOURCES =
libmeta_la_SOURCES += Cstr.c
libmeta_la_SOURCES += adx_header.c
libmeta_la_SOURCES += afc_header.c
libmeta_la_SOURCES += agsc.c
libmeta_la_SOURCES += ast.c
libmeta_la_SOURCES += brstm.c
libmeta_la_SOURCES += ea_header.c
libmeta_la_SOURCES += gcsw.c halpst.c
libmeta_la_SOURCES += nds_strm.c
libmeta_la_SOURCES += ngc_adpdtk.c
libmeta_la_SOURCES += ngc_caf.c
libmeta_la_SOURCES += ngc_dsp_std.c
libmeta_la_SOURCES += ps2_ads.c
libmeta_la_SOURCES += ps2_exst.c
libmeta_la_SOURCES += ps2_ild.c
libmeta_la_SOURCES += ps2_int.c
libmeta_la_SOURCES += ps2_mib.c
libmeta_la_SOURCES += ps2_mic.c
libmeta_la_SOURCES += ps2_npsf.c
libmeta_la_SOURCES += ps2_pnb.c
libmeta_la_SOURCES += ps2_rxw.c
libmeta_la_SOURCES += ps2_str.c
libmeta_la_SOURCES += ps2_svag.c
libmeta_la_SOURCES += ps2_vag.c
libmeta_la_SOURCES += ps2_vpk.c
libmeta_la_SOURCES += psx_cdxa.c
libmeta_la_SOURCES += raw.c
libmeta_la_SOURCES += rs03.c
libmeta_la_SOURCES += rsf.c
libmeta_la_SOURCES += rwsd.c
libmeta_la_SOURCES += psx_gms.c
libmeta_la_SOURCES += xbox_xwav.c
libmeta_la_SOURCES += xbox_wavm.c
libmeta_la_SOURCES += genh.c
libmeta_la_SOURCES += ogg_vorbis_file.c
libmeta_la_SOURCES += ps2_bmdx.c
libmeta_la_SOURCES += aifc.c
libmeta_la_SOURCES += str_snds.c
libmeta_la_SOURCES += ws_aud.c
libmeta_la_SOURCES += ahx.c
libmeta_la_SOURCES += ivb.c
libmeta_la_SOURCES += svs.c
libmeta_la_SOURCES += riff.c
libmeta_la_SOURCES += pos.c
libmeta_la_SOURCES += nwa.c
libmeta_la_SOURCES += ps2_rws.c
libmeta_la_SOURCES += ps2_hgc1.c
libmeta_la_SOURCES += xss.c
libmeta_la_SOURCES += ps2_sl3.c
libmeta_la_SOURCES += ps2_aus.c
libmeta_la_SOURCES += fsb.c
libmeta_la_SOURCES += rsd.c
libmeta_la_SOURCES += rwx.c
libmeta_la_SOURCES += xwb.c
libmeta_la_SOURCES += ea_old.c
libmeta_la_SOURCES += ps2_xa30.c
libmeta_la_SOURCES += musc.c
libmeta_la_SOURCES += ps2_leg.c
libmeta_la_SOURCES += ps2_filp.c
libmeta_la_SOURCES += ps2_ikm.c
libmeta_la_SOURCES += musx.c
libmeta_la_SOURCES += ps2_sfs.c
libmeta_la_SOURCES += sat_dvi.c
libmeta_la_SOURCES += ps2_bg00.c
libmeta_la_SOURCES += dc_kcey.c
libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c
libmeta_la_SOURCES += ps2_psh.c
libmeta_la_SOURCES += mus_acm.c
libmeta_la_SOURCES += sli.c
libmeta_la_SOURCES += sfl.c
libmeta_la_SOURCES += pcm.c
libmeta_la_SOURCES += ps2_psw.c
libmeta_la_SOURCES += ps2_rkv.c
libmeta_la_SOURCES += ps2_vas.c
libmeta_la_SOURCES += ps2_tec.c
libmeta_la_SOURCES += ps2_enth.c
libmeta_la_SOURCES += sdt.c
libmeta_la_SOURCES += aix.c
libmeta_la_SOURCES += ngc_tydsp.c
libmeta_la_SOURCES += ngc_swd.c
libmeta_la_SOURCES += ngc_biodsp.c
EXTRA_DIST = meta.h
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libmeta_la_LDFLAGS =
libmeta_la_SOURCES =
libmeta_la_SOURCES += Cstr.c
libmeta_la_SOURCES += adx_header.c
libmeta_la_SOURCES += afc_header.c
libmeta_la_SOURCES += agsc.c
libmeta_la_SOURCES += ast.c
libmeta_la_SOURCES += brstm.c
libmeta_la_SOURCES += ea_header.c
libmeta_la_SOURCES += gcsw.c halpst.c
libmeta_la_SOURCES += nds_strm.c
libmeta_la_SOURCES += ngc_adpdtk.c
libmeta_la_SOURCES += ngc_caf.c
libmeta_la_SOURCES += ngc_dsp_std.c
libmeta_la_SOURCES += ps2_ads.c
libmeta_la_SOURCES += ps2_exst.c
libmeta_la_SOURCES += ps2_ild.c
libmeta_la_SOURCES += ps2_int.c
libmeta_la_SOURCES += ps2_mib.c
libmeta_la_SOURCES += ps2_mic.c
libmeta_la_SOURCES += ps2_npsf.c
libmeta_la_SOURCES += ps2_pnb.c
libmeta_la_SOURCES += ps2_rxw.c
libmeta_la_SOURCES += ps2_str.c
libmeta_la_SOURCES += ps2_svag.c
libmeta_la_SOURCES += ps2_vag.c
libmeta_la_SOURCES += ps2_vpk.c
libmeta_la_SOURCES += psx_cdxa.c
libmeta_la_SOURCES += raw.c
libmeta_la_SOURCES += rs03.c
libmeta_la_SOURCES += rsf.c
libmeta_la_SOURCES += rwsd.c
libmeta_la_SOURCES += psx_gms.c
libmeta_la_SOURCES += xbox_xwav.c
libmeta_la_SOURCES += xbox_wavm.c
libmeta_la_SOURCES += genh.c
libmeta_la_SOURCES += ogg_vorbis_file.c
libmeta_la_SOURCES += ps2_bmdx.c
libmeta_la_SOURCES += aifc.c
libmeta_la_SOURCES += str_snds.c
libmeta_la_SOURCES += ws_aud.c
libmeta_la_SOURCES += ahx.c
libmeta_la_SOURCES += ivb.c
libmeta_la_SOURCES += svs.c
libmeta_la_SOURCES += riff.c
libmeta_la_SOURCES += pos.c
libmeta_la_SOURCES += nwa.c
libmeta_la_SOURCES += ps2_rws.c
libmeta_la_SOURCES += ps2_hgc1.c
libmeta_la_SOURCES += xss.c
libmeta_la_SOURCES += ps2_sl3.c
libmeta_la_SOURCES += ps2_aus.c
libmeta_la_SOURCES += fsb.c
libmeta_la_SOURCES += rsd.c
libmeta_la_SOURCES += rwx.c
libmeta_la_SOURCES += xwb.c
libmeta_la_SOURCES += ea_old.c
libmeta_la_SOURCES += ps2_xa30.c
libmeta_la_SOURCES += musc.c
libmeta_la_SOURCES += ps2_leg.c
libmeta_la_SOURCES += ps2_filp.c
libmeta_la_SOURCES += ps2_ikm.c
libmeta_la_SOURCES += musx.c
libmeta_la_SOURCES += ps2_sfs.c
libmeta_la_SOURCES += sat_dvi.c
libmeta_la_SOURCES += ps2_bg00.c
libmeta_la_SOURCES += dc_kcey.c
libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c
libmeta_la_SOURCES += ps2_psh.c
libmeta_la_SOURCES += mus_acm.c
libmeta_la_SOURCES += sli.c
libmeta_la_SOURCES += sfl.c
libmeta_la_SOURCES += pcm.c
libmeta_la_SOURCES += ps2_psw.c
libmeta_la_SOURCES += ps2_rkv.c
libmeta_la_SOURCES += ps2_vas.c
libmeta_la_SOURCES += ps2_tec.c
libmeta_la_SOURCES += ps2_enth.c
libmeta_la_SOURCES += sdt.c
libmeta_la_SOURCES += aix.c
libmeta_la_SOURCES += ngc_tydsp.c
libmeta_la_SOURCES += ngc_swd.c
libmeta_la_SOURCES += ngc_biodsp.c
libmeta_la_SOURCES += xbox_wvs.c
EXTRA_DIST = meta.h

View File

@ -175,15 +175,19 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
if(ea.sample_rate!=0) {
vgmstream->sample_rate = ea.sample_rate;
} else {
switch(vgmstream->ea_platform) {
case EA_XBOX:
vgmstream->sample_rate=24000;
break;
case EA_X360:
vgmstream->sample_rate=44100;
break;
default:
vgmstream->sample_rate=22050;
if(read_32bitBE(0x08,streamFile)==0x47535452) { // GSTR
vgmstream->sample_rate=44100;
} else {
switch(vgmstream->ea_platform) {
case EA_XBOX:
vgmstream->sample_rate=24000;
break;
case EA_X360:
vgmstream->sample_rate=44100;
break;
default:
vgmstream->sample_rate=22050;
}
}
}

View File

@ -193,4 +193,6 @@ VGMSTREAM * init_vgmstream_ngc_vjdsp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_biodsp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_xbox_wvs(STREAMFILE *streamFile);
#endif

View File

@ -38,24 +38,28 @@ VGMSTREAM * init_vgmstream_ps2_psh(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (uint16_t)read_16bitLE(0x0C,streamFile)*0x800*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample =
((uint16_t)read_16bitLE(0x06,streamFile)-0x8000)*0x400*28/16;
// loop end is set by the loop marker which we need to find ...
fileLength = get_streamfile_size(streamFile);
do {
readOffset+=(off_t)read_streamfile(testBuffer,readOffset,0x10,streamFile);
// Loop End ...
if(testBuffer[0x01]==0x03) {
if(loopEnd==0) loopEnd = readOffset-0x10;
break;
}
// loop end is set by the loop marker which we need to find ...
// there's some extra data on unloop files, so we calculate
// the sample count with loop marker on this files
fileLength = get_streamfile_size(streamFile);
do {
readOffset+=(off_t)read_streamfile(testBuffer,readOffset,0x10,streamFile);
// Loop End ...
if(testBuffer[0x01]==0x03) {
if(loopEnd==0) loopEnd = readOffset-0x10;
break;
}
} while (streamFile->get_offset(streamFile)<(int32_t)fileLength);
if(loopEnd!=0)
vgmstream->num_samples = loopEnd*28/16/channel_count;
} while (streamFile->get_offset(streamFile)<(int32_t)fileLength);
vgmstream->loop_end_sample = loopEnd*28/16/channel_count;
}
if(loop_flag) {
vgmstream->loop_start_sample =
((uint16_t)read_16bitLE(0x06,streamFile)-0x8000)*0x400*28/16;
vgmstream->loop_end_sample=vgmstream->num_samples;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x800;

63
src/meta/xbox_wvs.c Normal file
View File

@ -0,0 +1,63 @@
#include "meta.h"
#include "../util.h"
/* WVS
WVS (found in Metal Arms - Glitch in the System)
*/
VGMSTREAM * init_vgmstream_xbox_wvs(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
int loop_flag=0;
int channel_count;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("wvs",filename_extension(filename))) goto fail;
/* Loop seems to be set if offset(0x0A) == 0x472C */
loop_flag = (read_16bitLE(0x0A,streamFile)==0x472C);
/* Always stereo files */
channel_count=read_16bitLE(0x0E,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
/* allways 2 channels @ 44100 Hz */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_XBOX;
vgmstream->num_samples = read_32bitLE(0,streamFile) / 36 * 64 / vgmstream->channels;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size=36;
vgmstream->meta_type = meta_XBOX_WAVM;
if(loop_flag) {
vgmstream->loop_start_sample=0;
vgmstream->loop_end_sample=vgmstream->num_samples;
}
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
vgmstream->ch[i].offset = 0x20;
if (!vgmstream->ch[i].streamfile) goto fail;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -112,6 +112,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_swd,
init_vgmstream_ngc_vjdsp,
init_vgmstream_ngc_biodsp,
init_vgmstream_xbox_wvs,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))

View File

@ -171,6 +171,7 @@ char * extension_list[] = {
"swd\0SWD Audio File (*.SWD)\0",
"vjdsp\0VJDSP Audio File (*.VJDSP)\0",
"biodsp\0BIODSP Audio File (*.BIODSP)\0",
"wvs\0WVS Audio File (*.WVS)\0",
};
void about(HWND hwndParent) {