missing stuff in pcm.c added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@740 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-02-08 20:14:57 +00:00
parent 78b6aeb17e
commit 7eef6e0b5b
4 changed files with 92 additions and 21 deletions

View File

@ -187,6 +187,8 @@ VGMSTREAM * init_vgmstream_mus_acm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_pcm_scd(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_pcm_scd(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_pcm_ps2(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_rkv(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ps2_rkv(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_psw(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ps2_psw(STREAMFILE * streamFile);

View File

@ -20,7 +20,7 @@ VGMSTREAM * init_vgmstream_pcm_scd(STREAMFILE *streamFile) {
goto fail; goto fail;
loop_flag = (read_32bitLE(0x02,streamFile)!=0); loop_flag = (read_32bitLE(0x02,streamFile)!=0);
channel_count = 1; channel_count = 2;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
@ -29,31 +29,30 @@ VGMSTREAM * init_vgmstream_pcm_scd(STREAMFILE *streamFile) {
/* fill in the vital statistics */ /* fill in the vital statistics */
start_offset = 0x200; start_offset = 0x200;
vgmstream->channels = channel_count; vgmstream->channels = channel_count;
vgmstream->sample_rate = 32000; vgmstream->sample_rate = 16000;
vgmstream->coding_type = coding_PCM8_SB_int; vgmstream->coding_type = coding_PCM8_SB_int;
vgmstream->num_samples = read_32bitBE(0x06,streamFile)*2; vgmstream->num_samples = read_32bitBE(0x06,streamFile)*2;
if(loop_flag) { if(loop_flag) {
vgmstream->loop_start_sample = read_32bitBE(0x02,streamFile)*0x800; vgmstream->loop_start_sample = read_32bitBE(0x02,streamFile)*0x400;
vgmstream->loop_end_sample = read_32bitBE(0x06,streamFile)*2; vgmstream->loop_end_sample = read_32bitBE(0x06,streamFile);
} }
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2; vgmstream->interleave_block_size = 0x1;
vgmstream->meta_type = meta_PCM_SCD; vgmstream->meta_type = meta_PCM_SCD;
/* open the file for reading */ /* open the file for reading */
{ {
int i; int i;
STREAMFILE * file; STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail; if (!file) goto fail;
for (i=0;i<channel_count;i++) { for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file; vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+ vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i; vgmstream->interleave_block_size*i;
}
} }
}
return vgmstream; return vgmstream;
@ -62,3 +61,68 @@ fail:
if (vgmstream) close_vgmstream(vgmstream); if (vgmstream) close_vgmstream(vgmstream);
return NULL; return NULL;
} }
/* PCM - Custom header from Konami, which contains only loop infos...
found in: Ephemeral Fantasia [Reiselied]
Yu-Gi-Oh! The Duelists of the Roses [Yu-Gi-Oh! Shin Duel Monsters II]
*/
VGMSTREAM * init_vgmstream_pcm_ps2(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("pcm",filename_extension(filename))) goto fail;
// if ((read_32bitLE(0x00,streamFile)+0x800) != (get_streamfile_size(streamFile)))
// goto fail;
if ((read_32bitLE(0x00,streamFile)) != (read_32bitLE(0x04,streamFile)*4))
goto fail;
loop_flag = (read_32bitLE(0x08,streamFile) != 0x0);
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 22050;
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x0,streamFile)/2/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
vgmstream->meta_type = meta_PCM_PS2;
/* 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

@ -109,6 +109,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_dxh, init_vgmstream_ps2_dxh,
init_vgmstream_ps2_psh, init_vgmstream_ps2_psh,
init_vgmstream_pcm_scd, init_vgmstream_pcm_scd,
init_vgmstream_pcm_ps2,
init_vgmstream_ps2_rkv, init_vgmstream_ps2_rkv,
init_vgmstream_ps2_psw, init_vgmstream_ps2_psw,
init_vgmstream_ps2_vas, init_vgmstream_ps2_vas,
@ -2047,7 +2048,10 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"RIFX WAVE header with sample looping info"); snprintf(temp,TEMPSIZE,"RIFX WAVE header with sample looping info");
break; break;
case meta_PCM_SCD: case meta_PCM_SCD:
snprintf(temp,TEMPSIZE,"PCM file with custom header"); snprintf(temp,TEMPSIZE,"PCM file with custom header (SCD)");
break;
case meta_PCM_PS2:
snprintf(temp,TEMPSIZE,"PCM file with custom header (PS2)");
break; break;
case meta_PS2_RKV: case meta_PS2_RKV:
snprintf(temp,TEMPSIZE,"Legacy of Kain - Blood Omen 2 RKV Header"); snprintf(temp,TEMPSIZE,"Legacy of Kain - Blood Omen 2 RKV Header");

View File

@ -264,7 +264,8 @@ typedef enum {
meta_PS2_KCES, /* Dance Dance Revolution */ meta_PS2_KCES, /* Dance Dance Revolution */
meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */ meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */
meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */ meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */
meta_PCM_SCD, /* Lunar - Eternal Blue */ meta_PCM_SCD, /* Ephemeral Fantasia */
meta_PCM_PS2, /* Lunar - Eternal Blue */
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 */ meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 */
meta_PS2_PSW, /* Rayman Raving Rabbids */ meta_PS2_PSW, /* Rayman Raving Rabbids */
meta_PS2_VAS, /* Pro Baseball Spirits 5 */ meta_PS2_VAS, /* Pro Baseball Spirits 5 */