2008-05-13 13:47:51 +02:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../util.h"
|
2008-05-11 23:27:10 +02:00
|
|
|
|
|
|
|
/* 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 ...
|
|
|
|
*/
|
|
|
|
|
2008-05-20 17:18:38 +02:00
|
|
|
VGMSTREAM * init_vgmstream_ps2_int(STREAMFILE *streamFile) {
|
2008-05-13 13:47:51 +02:00
|
|
|
VGMSTREAM * vgmstream = NULL;
|
2008-05-20 17:18:38 +02:00
|
|
|
char filename[260];
|
2008-05-24 22:22:54 +02:00
|
|
|
int i,channel_count;
|
2008-05-13 13:47:51 +02:00
|
|
|
|
|
|
|
/* check extension, case insensitive */
|
2008-05-20 17:18:38 +02:00
|
|
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
2008-05-24 22:22:54 +02:00
|
|
|
if (strcasecmp("int",filename_extension(filename)) &&
|
|
|
|
strcasecmp("wp2",filename_extension(filename))) goto fail;
|
2008-05-13 13:47:51 +02:00
|
|
|
|
2008-05-24 22:22:54 +02:00
|
|
|
if(!strcasecmp("int",filename_extension(filename)))
|
|
|
|
channel_count = 2;
|
|
|
|
else
|
|
|
|
channel_count = 4;
|
2008-05-13 13:47:51 +02:00
|
|
|
|
|
|
|
/* build the VGMSTREAM */
|
2008-05-24 22:22:54 +02:00
|
|
|
vgmstream = allocate_vgmstream(channel_count,0);
|
2008-05-13 13:47:51 +02:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
/* fill in the vital statistics */
|
2008-05-24 22:22:54 +02:00
|
|
|
vgmstream->channels=channel_count;
|
2008-05-13 13:47:51 +02:00
|
|
|
vgmstream->sample_rate = 48000;
|
|
|
|
vgmstream->coding_type = coding_PCM16LE;
|
2008-05-24 22:22:54 +02:00
|
|
|
vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile)/(vgmstream->channels*2));
|
2008-05-13 13:47:51 +02:00
|
|
|
vgmstream->interleave_block_size = 0x200;
|
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->meta_type = meta_PS2_RAW;
|
|
|
|
|
|
|
|
/* open the file for reading by each channel */
|
|
|
|
{
|
2008-05-24 22:22:54 +02:00
|
|
|
for (i=0;i<vgmstream->channels;i++) {
|
2008-05-20 17:18:38 +02:00
|
|
|
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
|
2008-05-13 13:47:51 +02:00
|
|
|
|
|
|
|
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 (vgmstream) close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
|
|
|
}
|