mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
.nwa
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@301 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
dd3ed4d0ef
commit
8a528c3548
@ -103,6 +103,7 @@ File types supported by this version of vgmstream:
|
|||||||
- .svs (PS2 ADPCM)
|
- .svs (PS2 ADPCM)
|
||||||
- .wav (8/16 bit PCM)
|
- .wav (8/16 bit PCM)
|
||||||
- .pos (8/16 bit PCM)
|
- .pos (8/16 bit PCM)
|
||||||
|
- .nwa (16 bit PCM)
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
-hcs
|
-hcs
|
||||||
|
@ -69,7 +69,8 @@ META_OBJS=meta/adx_header.o \
|
|||||||
meta/ivb.o \
|
meta/ivb.o \
|
||||||
meta/svs.o \
|
meta/svs.o \
|
||||||
meta/riff.o \
|
meta/riff.o \
|
||||||
meta/pos.o
|
meta/pos.o \
|
||||||
|
meta/nwa.o
|
||||||
|
|
||||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||||
|
|
||||||
|
@ -374,6 +374,10 @@
|
|||||||
RelativePath=".\meta\pos.c"
|
RelativePath=".\meta\pos.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\meta\nwa.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
@ -4,6 +4,6 @@ AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
|
|||||||
AM_MAKEFLAGS=-f Makefile.unix
|
AM_MAKEFLAGS=-f Makefile.unix
|
||||||
|
|
||||||
libmeta_la_LDFLAGS =
|
libmeta_la_LDFLAGS =
|
||||||
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c genh.c ogg_vorbis_file.c ps2_bmdx.c aifc.c str_snds.c ws_aud.c ahx.c ivb.c svs.c riff.c pos.c
|
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c genh.c ogg_vorbis_file.c ps2_bmdx.c aifc.c str_snds.c ws_aud.c ahx.c ivb.c svs.c riff.c pos.c nwa.c
|
||||||
|
|
||||||
EXTRA_DIST = meta.h
|
EXTRA_DIST = meta.h
|
||||||
|
@ -111,4 +111,6 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE * streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_pos(STREAMFILE * streamFile);
|
VGMSTREAM * init_vgmstream_pos(STREAMFILE * streamFile);
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_nwa(STREAMFILE * streamFile);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
84
src/meta/nwa.c
Normal file
84
src/meta/nwa.c
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include "meta.h"
|
||||||
|
#include "../util.h"
|
||||||
|
|
||||||
|
/* NWA - Visual Arts streams
|
||||||
|
*
|
||||||
|
* This can apparently get a lot more complicated, I'm only handling the
|
||||||
|
* raw PCM case at the moment (until I see something else).
|
||||||
|
*
|
||||||
|
* Kazunori "jagarl" Ueno's nwatowav was helpful, and will probably be used
|
||||||
|
* to write coding support if it comes to that.
|
||||||
|
*/
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_nwa(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
char filename[260];
|
||||||
|
int i;
|
||||||
|
int channel_count;
|
||||||
|
|
||||||
|
/* check extension, case insensitive */
|
||||||
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
|
if (strcasecmp("nwa",filename_extension(filename))) goto fail;
|
||||||
|
|
||||||
|
/* check that we're using raw pcm */
|
||||||
|
if (
|
||||||
|
read_32bitLE(0x08,streamFile)!=-1 || /* compression level */
|
||||||
|
read_32bitLE(0x10,streamFile)!=0 || /* block count */
|
||||||
|
read_32bitLE(0x18,streamFile)!=0 || /* compressed data size */
|
||||||
|
read_32bitLE(0x20,streamFile)!=0 || /* block size */
|
||||||
|
read_32bitLE(0x24,streamFile)!=0 /* restsize */
|
||||||
|
) goto fail;
|
||||||
|
|
||||||
|
channel_count = read_16bitLE(0x00,streamFile);
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channel_count,0);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
/* fill in the vital statistics */
|
||||||
|
vgmstream->channels = channel_count;
|
||||||
|
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
|
||||||
|
switch (read_16bitLE(0x02,streamFile)) {
|
||||||
|
case 16:
|
||||||
|
vgmstream->coding_type = coding_PCM16LE;
|
||||||
|
vgmstream->interleave_block_size = 2;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
vgmstream->coding_type = coding_PCM8;
|
||||||
|
vgmstream->interleave_block_size = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
vgmstream->num_samples = read_32bitLE(0x1c,streamFile)/channel_count;
|
||||||
|
if (channel_count > 1) {
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
} else {
|
||||||
|
vgmstream->layout_type = layout_none;
|
||||||
|
}
|
||||||
|
vgmstream->meta_type = meta_NWA;
|
||||||
|
|
||||||
|
/* open the file for reading by each channel */
|
||||||
|
{
|
||||||
|
STREAMFILE *chstreamfile;
|
||||||
|
|
||||||
|
/* have both channels use the same buffer, as interleave is so small */
|
||||||
|
chstreamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
|
if (!chstreamfile) goto fail;
|
||||||
|
|
||||||
|
for (i=0;i<2;i++) {
|
||||||
|
vgmstream->ch[i].streamfile = chstreamfile;
|
||||||
|
|
||||||
|
vgmstream->ch[i].channel_start_offset=
|
||||||
|
vgmstream->ch[i].offset=0x2c+(off_t)(i*vgmstream->interleave_block_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
/* clean up anything we may have opened */
|
||||||
|
fail:
|
||||||
|
if (vgmstream) close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -71,6 +71,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
|||||||
init_vgmstream_svs,
|
init_vgmstream_svs,
|
||||||
init_vgmstream_riff,
|
init_vgmstream_riff,
|
||||||
init_vgmstream_pos,
|
init_vgmstream_pos,
|
||||||
|
init_vgmstream_nwa,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||||
@ -1114,6 +1115,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
case meta_RIFF_WAVE_POS:
|
case meta_RIFF_WAVE_POS:
|
||||||
snprintf(temp,TEMPSIZE,"RIFF WAVE header and .pos for looping");
|
snprintf(temp,TEMPSIZE,"RIFF WAVE header and .pos for looping");
|
||||||
break;
|
break;
|
||||||
|
case meta_NWA:
|
||||||
|
snprintf(temp,TEMPSIZE,"Visual Art's NWA header");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,7 @@ typedef enum {
|
|||||||
#endif
|
#endif
|
||||||
meta_RIFF_WAVE, /* RIFF, for WAVs */
|
meta_RIFF_WAVE, /* RIFF, for WAVs */
|
||||||
meta_RIFF_WAVE_POS, /* .wav + .pos for looping */
|
meta_RIFF_WAVE_POS, /* .wav + .pos for looping */
|
||||||
|
meta_NWA, /* Visual Art's NWA */
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -126,6 +126,7 @@ char * extension_list[] = {
|
|||||||
"amts\0AMTS Audio File (*.AMTS)\0",
|
"amts\0AMTS Audio File (*.AMTS)\0",
|
||||||
"svs\0SVS Audio File (*.SVS)\0",
|
"svs\0SVS Audio File (*.SVS)\0",
|
||||||
"pos\0POS Audio File (*.POS)\0",
|
"pos\0POS Audio File (*.POS)\0",
|
||||||
|
"nwa\0NWA Audio File (*.NWA)\0",
|
||||||
};
|
};
|
||||||
|
|
||||||
void about(HWND hwndParent) {
|
void about(HWND hwndParent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user