diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 41db8131..2a28b475 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -278,6 +278,10 @@ RelativePath=".\meta\psx_cdxa.c" > + + diff --git a/src/meta/meta.h b/src/meta/meta.h index 86b1dc90..198d1845 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -55,4 +55,6 @@ VGMSTREAM * init_vgmstream_ps2_mib(const char * const filename); VGMSTREAM * init_vgmstream_ps2_mic(const char * const filename); +VGMSTREAM * init_vgmstream_raw(const char * const filename); + #endif diff --git a/src/meta/raw.c b/src/meta/raw.c new file mode 100644 index 00000000..4c50c4b6 --- /dev/null +++ b/src/meta/raw.c @@ -0,0 +1,60 @@ +#include "meta.h" +#include "../util.h" + +/* RAW + + RAW format is native 44khz PCM file + Nothing more :P ... + + 2008-05-17 - Fastelbja : First version ... +*/ + +VGMSTREAM * init_vgmstream_raw(const char * const filename) { + VGMSTREAM * vgmstream = NULL; + STREAMFILE * infile = NULL; + int i; + + /* check extension, case insensitive */ + if (strcasecmp("raw",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 = 44100; + vgmstream->coding_type = coding_PCM16LE; + vgmstream->num_samples = (int32_t)(get_streamfile_size(infile)/2); + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 2; + vgmstream->meta_type = meta_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,0x1000); + + 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; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 7719637b..da9c136b 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -15,7 +15,7 @@ * List of functions that will recognize files. These should correspond pretty * directly to the metadata types */ -#define INIT_VGMSTREAM_FCNS 26 +#define INIT_VGMSTREAM_FCNS 27 VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = { init_vgmstream_adx, /* 0 */ init_vgmstream_brstm, /* 1 */ @@ -43,6 +43,7 @@ VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(const char * const) = { init_vgmstream_ngc_mpdsp, /* 23 */ init_vgmstream_ps2_mic, /* 24 */ init_vgmstream_ngc_dsp_std_int, /* 25 */ + init_vgmstream_raw, /* 26 */ }; @@ -634,6 +635,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_RSTM_SPM: snprintf(temp,TEMPSIZE,"Nintendo RSTM header and .brstmspm extension"); break; + case meta_RAW: + snprintf(temp,TEMPSIZE,"assumed RAW PCM file by .raw extension"); + break; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); } diff --git a/src/vgmstream.h b/src/vgmstream.h index 07b36ddc..166ed8b5 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -91,6 +91,8 @@ typedef enum { meta_PSX_XA, /* CD-XA with RIFF header */ + meta_RAW, /* RAW PCM file */ + } meta_t; typedef struct { diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 7391f5ae..69c95458 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -68,7 +68,7 @@ int fade_samples = 0; #define EXTENSION_LIST_SIZE 1024 char working_extension_list[EXTENSION_LIST_SIZE] = {0}; -#define EXTENSION_COUNT 26 +#define EXTENSION_COUNT 27 char * extension_list[EXTENSION_COUNT] = { "adx\0ADX Audio File (*.ADX)\0", "afc\0AFC Audio File (*.AFC)\0", @@ -96,6 +96,7 @@ char * extension_list[EXTENSION_COUNT] = { "mic\0PS2 MIC Audio File (*.MIC)\0", "gcm\0GCM Audio File (*.GCM)\0", "mss\0MSS Audio File (*.MSS)\0", + "raw\0RAW Audio File (*.RAW)\0", }; void about(HWND hwndParent) {