fixed xa issues, adding .INT support

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@104 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-05-11 21:27:10 +00:00
parent 2b523d8b82
commit 2a9616842f
9 changed files with 82 additions and 8 deletions

View File

@ -5,8 +5,8 @@
void xa_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
uint8_t currentChannel=0;
uint8_t subAudio=0;
int8_t currentChannel=0;
int8_t subAudio=0;
if(vgmstream->samples_into_block!=0)
// don't change this variable in the init process

View File

@ -246,6 +246,10 @@
RelativePath=".\meta\ps2_ads.c"
>
</File>
<File
RelativePath=".\meta\ps2_int.c"
>
</File>
<File
RelativePath=".\meta\ps2_npsf.c"
>

View File

@ -39,4 +39,6 @@ VGMSTREAM * init_vgmstream_cdxa(const char * const filename);
VGMSTREAM * init_vgmstream_ps2_rxw(const char * const filename);
VGMSTREAM * init_vgmstream_ps2_int(const char * const filename);
#endif

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

@ -0,0 +1,63 @@
#include "meta.h"
#include "../util.h"
/* INT
PS2 INT format is a RAW 48khz PCM file without header
The only fact about those file, is that the raw is interleaved
The interleave value is allways 0x200
known extensions : INT
2008-05-11 - Fastelbja : First version ...
*/
VGMSTREAM * init_vgmstream_ps2_int(const char * const filename) {
VGMSTREAM * vgmstream = NULL;
STREAMFILE * infile = NULL;
int i;
/* check extension, case insensitive */
if (strcasecmp("int",filename_extension(filename))) goto fail;
/* try to open the file for header reading */
infile = open_streamfile(filename);
if (!infile) goto fail;
/* No check to do as they are raw pcm */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(2,0);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = 2;
vgmstream->sample_rate = 48000;
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = get_streamfile_size(infile)/4;
vgmstream->interleave_block_size = 0x200;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_RAW;
close_streamfile(infile); infile=NULL;
/* open the file for reading by each channel */
{
for (i=0;i<2;i++) {
vgmstream->ch[i].streamfile = open_streamfile_buffer(filename,0x8000);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=0;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (infile) close_streamfile(infile);
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -19,7 +19,7 @@ VGMSTREAM * init_vgmstream_ps2_rxw(const char * const filename) {
infile = open_streamfile(filename);
if (!infile) goto fail;
/* check NPSF Header */
/* check RXWS/FORM Header */
if (!((read_32bitBE(0x00,infile) == 0x52585753) &&
(read_32bitBE(0x10,infile) == 0x464F524D)))
goto fail;
@ -38,7 +38,6 @@ VGMSTREAM * init_vgmstream_ps2_rxw(const char * const filename) {
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x2E,infile);
/* Check for Compression Scheme */
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x38,infile)*28/16)/2;

View File

@ -93,8 +93,8 @@ off_t init_xa_channel(int channel,VGMSTREAM* vgmstream) {
off_t block_offset=0x44;
uint8_t currentChannel;
uint8_t subAudio;
int8_t currentChannel;
int8_t subAudio;
vgmstream->xa_channel=channel;

View File

@ -15,7 +15,7 @@
* List of functions that will recognize files. These should correspond pretty
* directly to the metadata types
*/
#define INIT_VGMSTREAM_FCNS 18
#define INIT_VGMSTREAM_FCNS 19
VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = {
init_vgmstream_adx,
init_vgmstream_brstm,
@ -35,6 +35,7 @@ VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = {
init_vgmstream_rwsd,
init_vgmstream_cdxa,
init_vgmstream_ps2_rxw,
init_vgmstream_ps2_int,
};
@ -589,6 +590,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_PS2_RXW:
snprintf(temp,TEMPSIZE,"RXWS File (Arc The Lad)");
break;
case meta_PS2_RAW:
snprintf(temp,TEMPSIZE,"RAW Interleaved PCM");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -77,6 +77,7 @@ typedef enum {
meta_PS2_SShd, /* .ADS with SShd header */
meta_PS2_NPSF, /* Namco Production Sound File */
meta_PS2_RXW, /* Sony Arc The Lad Sound File */
meta_PS2_RAW, /* RAW Interleaved Format */
meta_PSX_XA, /* CD-XA with RIFF header */

View File

@ -45,7 +45,7 @@ int fade_samples = 0;
#define EXTENSION_LIST_SIZE 1024
char working_extension_list[EXTENSION_LIST_SIZE] = {0};
#define EXTENSION_COUNT 17
#define EXTENSION_COUNT 18
char * extension_list[EXTENSION_COUNT] = {
"adx\0ADX Audio File (*.ADX)\0",
"afc\0AFC Audio File (*.AFC)\0",
@ -64,6 +64,7 @@ char * extension_list[EXTENSION_COUNT] = {
"rwsd\0RWSD Audio File (*.RWSD)\0",
"xa\0PSX CD-XA File (*.XA)\0",
"rxw\0PS2 RXWS File (*.RXW)\0",
"int\0PS2 RAW Interleaved PCM (*.INT)\0",
};
/* stubs, we don't do anything fancy yet */