add support for .tra

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@879 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2010-11-14 16:05:58 +00:00
parent e6116cfd76
commit 3ea0cd0cae
6 changed files with 86 additions and 5 deletions

View File

@ -121,6 +121,10 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_dsp_bdsp_blocked:
dsp_bdsp_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_mtaf_blocked:
mtaf_block_update(vgmstream->next_block_offset,vgmstream);
case layout_tra_blocked:
tra_block_update(vgmstream->next_block_offset,vgmstream);
default:
break;
}

View File

@ -46,6 +46,10 @@ void filp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ivaud_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void mtaf_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
void render_vgmstream_nolayout(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);

View File

@ -521,10 +521,16 @@ VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_xvag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_se_scd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_baf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngc_nst_dsp(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngc_nst_dsp(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_baf(STREAMFILE* streamFile);
@ -537,9 +543,12 @@ VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sgh_sgb(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sghb(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngca(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_xbox_tra(STREAMFILE* streamFile);
//VGMSTREAM * init_vgmstream_ngca(STREAMFILE* streamFile);
#endif

View File

@ -59,3 +59,54 @@ fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
VGMSTREAM * init_vgmstream_xbox_tra(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("tra",filename_extension(filename))) goto fail;
/* No loop on wavm */
loop_flag = 0;
/* Always stereo files */
channel_count=2;
/* 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 = 2;
vgmstream->sample_rate = 24000;
vgmstream->coding_type = coding_DVI_IMA;
vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile) - ((get_streamfile_size(streamFile)/0x204)*4));
vgmstream->layout_type = layout_tra_blocked;
vgmstream->meta_type = meta_X360_TRA;
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
if (!vgmstream->ch[i].streamfile) goto fail;
}
}
tra_block_update(0,vgmstream);
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -282,7 +282,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_dsp_dspw,
init_vgmstream_ps2_jstm,
init_vgmstream_ps3_xvag,
init_vgmstream_ps3_cps,
init_vgmstream_ps2_mtaf,
init_vgmstream_ps3_cps,
init_vgmstream_se_scd,
init_vgmstream_ngc_nst_dsp,
init_vgmstream_baf,
@ -290,8 +291,9 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_fsb_mpeg,
init_vgmstream_nub_vag,
init_vgmstream_ps3_past,
init_vgmstream_ps3_sgh_sgb,
init_vgmstream_ngca,
// init_vgmstream_ps3_sgh_sgb,
init_vgmstream_xbox_tra,
//init_vgmstream_ngca,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -733,6 +735,8 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_psx_mgav_blocked:
case layout_ps2_adm_blocked:
case layout_dsp_bdsp_blocked:
case layout_mtaf_blocked:
case layout_tra_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_interleave_byte:
@ -1766,6 +1770,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case layout_mxch_blocked:
snprintf(temp,TEMPSIZE,"MxCh blocked");
break;
case layout_mtaf_blocked:
snprintf(temp,TEMPSIZE,"MTAF blocked");
break;
case layout_ast_blocked:
snprintf(temp,TEMPSIZE,"AST blocked");
@ -2716,6 +2723,8 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_NGCA:
snprintf(temp,TEMPSIZE,"NGCA header");
break;
case meta_X360_TRA:
snprintf(temp,TEMPSIZE,"Assume Def Jam Rapstar Track by .tra extension");
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -82,6 +82,7 @@ typedef enum {
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */
coding_INT_DVI_IMA, /* Interleaved DVI */
coding_EACS_IMA,
coding_UBI_IMA,
coding_IMA, /* bare IMA, low nibble first */
coding_INT_IMA, /* */
coding_MS_IMA, /* Microsoft IMA */
@ -157,6 +158,8 @@ typedef enum {
layout_ps2_adm_blocked,
layout_dsp_bdsp_blocked,
layout_mxch_blocked,
layout_mtaf_blocked,
layout_tra_blocked,
#if 0
layout_strm_blocked, /* */
@ -496,6 +499,7 @@ typedef enum {
meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */
meta_PS3_SGH_SGB, /* Folklore (PS3) */
meta_NGCA, /* GoldenEye 007 (Wii) */
meta_X360_TRA, /* Def Jam Rapstar */
} meta_t;
typedef struct {