added meta ims from matrix

convert coding_xbox from interleave to none

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@403 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-08-10 20:08:03 +00:00
parent 524ca7f924
commit a32c10afca
16 changed files with 114 additions and 11 deletions

View File

@ -111,6 +111,10 @@ void decode_xbox_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
outbuf[sample_count]=(short)(hist1);
}
// Only increment offset on complete frame
if(offset-stream->offset==(32*channelspacing)+(4*channel)+channelspacing+1) // ??
stream->offset+=36*channelspacing;
stream->adpcm_history1_32=hist1;
stream->adpcm_step_index=step_index;
}

View File

@ -78,6 +78,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
break;
case layout_ws_aud_blocked:
ws_aud_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_matx_blocked:
matx_block_update(vgmstream->next_block_offset,vgmstream);
break;
default:
break;

18
src/layout/ims_block.c Normal file
View File

@ -0,0 +1,18 @@
#include "layout.h"
#include "../vgmstream.h"
/* set up for the block at the given offset */
void matx_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
vgmstream->current_block_offset = block_offset;
vgmstream->current_block_size = read_32bitLE(
vgmstream->current_block_offset,
vgmstream->ch[0].streamfile);
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size + 8;
vgmstream->current_block_size/=vgmstream->channels;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = vgmstream->current_block_offset + 8;
}
}

View File

@ -24,6 +24,8 @@ void str_snds_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ws_aud_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void matx_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

@ -536,6 +536,10 @@
RelativePath=".\meta\ws_aud.c"
>
</File>
<File
RelativePath=".\meta\xbox_ims.c"
>
</File>
<File
RelativePath=".\meta\xbox_stma.c"
>
@ -692,6 +696,10 @@
RelativePath=".\layout\halpst_blocked.c"
>
</File>
<File
RelativePath=".\layout\ims_block.c"
>
</File>
<File
RelativePath=".\layout\interleave.c"
>

View File

@ -83,8 +83,7 @@ VGMSTREAM * init_vgmstream_fsb(STREAMFILE *streamFile) {
case 0x41004800: /* XBOX (FlatOut, Rainbow Six - Lockdown) */
case 0x01004804: /* XBOX (Cold Fear) <- maybe IMA??? */
vgmstream->coding_type = coding_XBOX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 36;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)*64/36/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x40,streamFile);

View File

@ -141,8 +141,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
}
break;
case coding_XBOX:
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 36;
vgmstream->layout_type = layout_none;
break;
case coding_NGC_DTK:

View File

@ -199,4 +199,6 @@ VGMSTREAM * init_vgmstream_xbox_wvs(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_xbox_matx(STREAMFILE *streamFile);
#endif

View File

@ -84,7 +84,6 @@ VGMSTREAM * init_vgmstream_rsd(STREAMFILE *streamFile) {
case 0x58414450: /* RSD2XADP */
start_offset = 0x40;
coding_type = coding_XBOX;
vgmstream->interleave_block_size = 0x24;
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)*64/36/channel_count;
@ -124,6 +123,7 @@ VGMSTREAM * init_vgmstream_rsd(STREAMFILE *streamFile) {
if (vgmstream->coding_type == coding_XBOX) {
vgmstream->layout_type=layout_none;
vgmstream->ch[i].channel_start_offset=start_offset;
} else {
vgmstream->ch[i].channel_start_offset=

60
src/meta/xbox_ims.c Normal file
View File

@ -0,0 +1,60 @@
#include "meta.h"
#include "../util.h"
/* matx
MATX (found in Matrix)
*/
VGMSTREAM * init_vgmstream_xbox_matx(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("matx",filename_extension(filename))) goto fail;
loop_flag = 0;
channel_count=read_16bitLE(0x4,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_16bitLE(0x06,streamFile) & 0xffff;
vgmstream->coding_type = coding_XBOX;
vgmstream->layout_type = layout_matx_blocked;
vgmstream->meta_type = meta_XBOX_MATX;
/* 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;
}
}
/* Calc num_samples */
matx_block_update(0,vgmstream);
vgmstream->num_samples=0;
do {
vgmstream->num_samples += vgmstream->current_block_size/36*64;
matx_block_update(vgmstream->next_block_offset,vgmstream);
} while (vgmstream->next_block_offset<get_streamfile_size(streamFile));
matx_block_update(0,vgmstream);
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -38,8 +38,7 @@ VGMSTREAM * init_vgmstream_xbox_wavm(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_XBOX;
vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile) / 36 * 64 / vgmstream->channels);
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size=36;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_XBOX_WAVM;

View File

@ -40,8 +40,7 @@ VGMSTREAM * init_vgmstream_xbox_wvs(STREAMFILE *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->layout_type = layout_none;
vgmstream->meta_type = meta_XBOX_WVS;
if(loop_flag) {

View File

@ -60,8 +60,7 @@ VGMSTREAM * init_vgmstream_xbox_xwav(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_XBOX;
vgmstream->num_samples = read_32bitLE(start_offset,streamFile) / 36 * 64 / vgmstream->channels;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size=36;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_XBOX_RIFF;

View File

@ -113,6 +113,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_vjdsp,
init_vgmstream_xbox_wvs,
init_vgmstream_xbox_stma,
init_vgmstream_xbox_matx,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -460,6 +461,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_wsi_blocked:
case layout_str_snds_blocked:
case layout_ws_aud_blocked:
case layout_matx_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
case layout_interleave_byte:
@ -1215,6 +1217,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case layout_ws_aud_blocked:
snprintf(temp,TEMPSIZE,"Westwood Studios .aud blocked");
break;
case layout_matx_blocked:
snprintf(temp,TEMPSIZE,"Matrix .matx blocked");
break;
#ifdef VGM_USE_MPEG
case layout_fake_mpeg:
snprintf(temp,TEMPSIZE,"MPEG Audio stream with incorrect frame headers");
@ -1596,6 +1601,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_XBOX_STMA:
snprintf(temp,TEMPSIZE,"Midnight Club 2 STMA Header");
break;
case meta_XBOX_MATX:
snprintf(temp,TEMPSIZE,"assumed Matrix file by .matx extension");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -109,6 +109,7 @@ typedef enum {
layout_wsi_blocked,
layout_str_snds_blocked,
layout_ws_aud_blocked,
layout_matx_blocked,
#if 0
layout_strm_blocked, /* */
#endif
@ -226,6 +227,7 @@ typedef enum {
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
meta_XBOX_WVS, /* XBOX WVS */
meta_XBOX_STMA, /* XBOX STMA */
meta_XBOX_MATX, /* XBOX MATX */
meta_EAXA_R2, /* EA XA Release 2 */
meta_EAXA_R3, /* EA XA Release 3 */

View File

@ -172,6 +172,7 @@ char * extension_list[] = {
"vjdsp\0VJDSP Audio File (*.VJDSP)\0",
"wvs\0WVS Audio File (*.WVS)\0",
"stma\0STMA Audio File (*.STMA)\0",
"matx\0MATX Audio File (*.MATX)\0",
};
void about(HWND hwndParent) {