mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
RAW PCM support added
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@148 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
99ac7a1610
commit
b4810e8491
@ -278,6 +278,10 @@
|
||||
RelativePath=".\meta\psx_cdxa.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\raw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\rs03.c"
|
||||
>
|
||||
|
@ -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
|
||||
|
60
src/meta/raw.c
Normal file
60
src/meta/raw.c
Normal file
@ -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;
|
||||
}
|
@ -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");
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ typedef enum {
|
||||
|
||||
meta_PSX_XA, /* CD-XA with RIFF header */
|
||||
|
||||
meta_RAW, /* RAW PCM file */
|
||||
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user