.tydsp added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@387 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-08-02 17:29:03 +00:00
parent 713c586e78
commit e4bd73b542
9 changed files with 107 additions and 16 deletions

View File

@ -110,7 +110,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_tec.o \ meta/ps2_tec.o \
meta/ps2_enth.o \ meta/ps2_enth.o \
meta/sdt.o \ meta/sdt.o \
meta/aix.o meta/aix.o \
meta/ngc_tydsp.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -294,6 +294,10 @@
RelativePath=".\meta\ngc_dsp_std.c" RelativePath=".\meta\ngc_dsp_std.c"
> >
</File> </File>
<File
RelativePath=".\meta\ngc_tydsp.c"
>
</File>
<File <File
RelativePath=".\meta\nwa.c" RelativePath=".\meta\nwa.c"
> >

View File

@ -86,5 +86,6 @@ libmeta_la_SOURCES += ps2_tec.c
libmeta_la_SOURCES += ps2_enth.c libmeta_la_SOURCES += ps2_enth.c
libmeta_la_SOURCES += sdt.c libmeta_la_SOURCES += sdt.c
libmeta_la_SOURCES += aix.c libmeta_la_SOURCES += aix.c
libmeta_la_SOURCES += ngc_tydsp.c
EXTRA_DIST = meta.h EXTRA_DIST = meta.h

View File

@ -185,4 +185,6 @@ VGMSTREAM * init_vgmstream_sdt(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_aix(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_aix(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_tydsp(STREAMFILE * streamFile);
#endif #endif

78
src/meta/ngc_tydsp.c Normal file
View File

@ -0,0 +1,78 @@
#include "meta.h"
#include "../util.h"
/* TYDSP (Ty - The Tasmanian Tiger) */
VGMSTREAM * init_vgmstream_ngc_tydsp(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("tydsp",filename_extension(filename))) goto fail;
/* check header */
/* if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */
/* goto fail; */
loop_flag = 1;
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitBE(0x08,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = (uint16_t)(read_16bitBE(0x6C,streamFile));
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x00,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitBE(0x00,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x04,streamFile);
vgmstream->meta_type = meta_NGC_TYDSP;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x10+i*2,streamFile);
}
if (vgmstream->channels) {
for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x3E+i*2,streamFile);
}
}
}
/* 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;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -7,7 +7,7 @@ VGMSTREAM * init_vgmstream_sdt(STREAMFILE *streamFile) {
char filename[260]; char filename[260];
off_t start_offset; off_t start_offset;
int loop_flag = 0; int loop_flag;
int channel_count; int channel_count;
/* check extension, case insensitive */ /* check extension, case insensitive */
@ -18,7 +18,7 @@ VGMSTREAM * init_vgmstream_sdt(STREAMFILE *streamFile) {
/* if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */ /* if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */
/* goto fail; */ /* goto fail; */
loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */ loop_flag = (read_32bitBE(0x04,streamFile)!=0);
channel_count = 2; channel_count = 2;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
@ -27,30 +27,32 @@ VGMSTREAM * init_vgmstream_sdt(STREAMFILE *streamFile) {
/* fill in the vital statistics */ /* fill in the vital statistics */
start_offset = 0xA0; start_offset = 0xA0;
vgmstream->channels = channel_count; vgmstream->channels = read_32bitBE(0x00,streamFile);
vgmstream->sample_rate = 48000; vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
vgmstream->coding_type = coding_NGC_DSP; vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x10,streamFile); vgmstream->num_samples = read_32bitBE(0x10,streamFile)/8*14/channel_count;
if (loop_flag) { if (loop_flag) {
vgmstream->loop_start_sample = 0; /* (read_32bitLE(0x08,streamFile)-1)*28; */ vgmstream->loop_start_sample = 0; /* (read_32bitLE(0x08,streamFile)-1)*28; */
vgmstream->loop_end_sample = read_32bitBE(0x10,streamFile); vgmstream->loop_end_sample = read_32bitBE(0x10,streamFile)/8*14/channel_count;
} }
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x8000; vgmstream->interleave_block_size = 0x8000;
vgmstream->meta_type = meta_SDT; vgmstream->meta_type = meta_SDT;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i; if (vgmstream->coding_type == coding_NGC_DSP) {
for (i=0;i<16;i++) { int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x3C+i*2,streamFile); vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x3C+i*2,streamFile);
} }
if (vgmstream->channels) { if (vgmstream->channels) {
for (i=0;i<16;i++) { for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x6A+i*2,streamFile); vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x6A+i*2,streamFile);
}
} }
} }
}
/* open the file for reading */ /* open the file for reading */
{ {
int i; int i;

View File

@ -108,6 +108,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_enth, init_vgmstream_ps2_enth,
init_vgmstream_sdt, init_vgmstream_sdt,
init_vgmstream_aix, init_vgmstream_aix,
init_vgmstream_ngc_tydsp,
}; };
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))

View File

@ -208,7 +208,8 @@ typedef enum {
meta_PS2_VAS, /* Pro Baseball Spirits 5 */ meta_PS2_VAS, /* Pro Baseball Spirits 5 */
meta_PS2_TEC, /* TECMO badflagged stream */ meta_PS2_TEC, /* TECMO badflagged stream */
meta_PS2_ENTH, /* Enthusia */ meta_PS2_ENTH, /* Enthusia */
meta_SDT, /* Enthusia */ meta_SDT, /* Baldur's Gate - Dark Alliance */
meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */
meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -167,6 +167,7 @@ char * extension_list[] = {
"enth\0ENTH Audio File (*.ENTH)\0", "enth\0ENTH Audio File (*.ENTH)\0",
"sdt\0SDT Audio File (*.SDT)\0", "sdt\0SDT Audio File (*.SDT)\0",
"aix\0AIX Audio File (*.AIX)\0", "aix\0AIX Audio File (*.AIX)\0",
"tydsp\0TYDSP Audio File (*.TYDSP)\0",
}; };
void about(HWND hwndParent) { void about(HWND hwndParent) {