From 6fb390ea084a0806d86bd74a5034b52f032df0f4 Mon Sep 17 00:00:00 2001 From: fastelbja Date: Sat, 24 May 2008 20:22:54 +0000 Subject: [PATCH] add support for WP2 (4 channels INT File) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@197 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/meta/ps2_int.c | 18 +++++++++++------- winamp/in_vgmstream.c | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/meta/ps2_int.c b/src/meta/ps2_int.c index 3c29a353..c0b4f263 100644 --- a/src/meta/ps2_int.c +++ b/src/meta/ps2_int.c @@ -15,30 +15,34 @@ VGMSTREAM * init_vgmstream_ps2_int(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; - int i; + int i,channel_count; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("int",filename_extension(filename))) goto fail; + if (strcasecmp("int",filename_extension(filename)) && + strcasecmp("wp2",filename_extension(filename))) goto fail; - /* No check to do as they are raw pcm */ + if(!strcasecmp("int",filename_extension(filename))) + channel_count = 2; + else + channel_count = 4; /* build the VGMSTREAM */ - vgmstream = allocate_vgmstream(2,0); + vgmstream = allocate_vgmstream(channel_count,0); if (!vgmstream) goto fail; /* fill in the vital statistics */ - vgmstream->channels = 2; + vgmstream->channels=channel_count; vgmstream->sample_rate = 48000; vgmstream->coding_type = coding_PCM16LE; - vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile)/4); + vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile)/(vgmstream->channels*2)); vgmstream->interleave_block_size = 0x200; vgmstream->layout_type = layout_interleave; vgmstream->meta_type = meta_PS2_RAW; /* open the file for reading by each channel */ { - for (i=0;i<2;i++) { + for (i=0;ichannels;i++) { vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000); if (!vgmstream->ch[i].streamfile) goto fail; diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 70e801ce..0a0d6adf 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -107,7 +107,8 @@ char * extension_list[] = { "ild\0ILD Audio File (*.ILD)\0", "pnb\0PNB Audio File (*.PNB)\0", "wavm\0WAVM Audio File (*.WAVM)\0", - "xwav\0XWAV Audio File (*.XWAV)\0" + "xwav\0XWAV Audio File (*.XWAV)\0", + "wp2\0WP2 Audio File (*.WP2)\0" }; void about(HWND hwndParent) {