diff --git a/Generic Header Creator 3/Projekt1.vbw b/Generic Header Creator 3/Projekt1.vbw index b7919195..2b2818fd 100644 --- a/Generic Header Creator 3/Projekt1.vbw +++ b/Generic Header Creator 3/Projekt1.vbw @@ -1,2 +1,2 @@ -Form1 = 0, 0, 601, 456, , 22, 29, 623, 485, C +Form1 = 0, 0, 601, 456, Z, 22, 29, 623, 485, C frmABOUT = 0, 0, 0, 0, C, 132, 174, 733, 630, C diff --git a/src/Makefile b/src/Makefile index 360de6f0..2dbe0a36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -195,7 +195,8 @@ META_OBJS=meta/adx_header.o \ meta/ps2_sps.o \ meta/nds_hwas.o \ meta/ngc_lps.o \ - meta/ps2_snd.o + meta/ps2_snd.o \ + meta/naomi_adpcm.o OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index b804880d..2eaf5cf8 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1,7 +1,7 @@  + + @@ -578,10 +582,6 @@ RelativePath=".\meta\ps2_rxw.c" > - - @@ -594,6 +594,10 @@ RelativePath=".\meta\ps2_sl3.c" > + + diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index fee4a511..fa44b125 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -155,5 +155,6 @@ libmeta_la_SOURCES += ps2_sps.c libmeta_la_SOURCES += nds_hwas.c libmeta_la_SOURCES += ngc_lps.c libmeta_la_SOURCES += ps2_snd.c +libmeta_la_SOURCES += naomi_adpcm.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index e603c7c0..cde8114e 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -381,4 +381,6 @@ VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE * streamFile); + #endif diff --git a/src/meta/naomi_adpcm.c b/src/meta/naomi_adpcm.c new file mode 100644 index 00000000..301a1811 --- /dev/null +++ b/src/meta/naomi_adpcm.c @@ -0,0 +1,68 @@ +#include "meta.h" +#include "../util.h" + +/* ADPCM (from NAOMI/NAOMI2 Arcade games) */ +VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + char filename[260]; + off_t start_offset; + int loop_flag = 0; + int channel_count; + int channel_1_start, channel_2_start; + + /* check extension, case insensitive */ + streamFile->get_name(streamFile,filename,sizeof(filename)); + if (strcasecmp("adpcm",filename_extension(filename))) goto fail; + +#if 0 + /* check header */ + if ((read_32bitBE(0x00,streamFile) != 0x41445043) || /* "ADPC" */ + (read_32bitBE(0x04,streamFile) != 0x41445043)) /* "M_v0" */ + goto fail; +#endif + + loop_flag = 0; + channel_count = 2; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x40; + vgmstream->channels = channel_count; + vgmstream->sample_rate = 44100; + vgmstream->coding_type = coding_AICA; + vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset); + if (loop_flag) { + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-start_offset); + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = read_32bitLE(0x10,streamFile) * 0x80; + vgmstream->meta_type = meta_NAOMI_ADPCM; + + /* 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;ich[i].streamfile = file; + + vgmstream->ch[i].channel_start_offset= + vgmstream->ch[i].offset=start_offset+ + vgmstream->interleave_block_size*i; + vgmstream->ch[i].adpcm_step_index = 0x7f; /* AICA */ + } + } + + return vgmstream; + + /* clean up anything we may have opened */ +fail: + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index a170ccee..98dde263 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -210,6 +210,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_nds_hwas, init_vgmstream_ngc_lps, init_vgmstream_ps2_snd, + init_vgmstream_naomi_adpcm, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) @@ -2169,8 +2170,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_NGC_LPS: snprintf(temp,TEMPSIZE,"Rave Master LPS Header"); break; - snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); + case meta_NAOMI_ADPCM: + snprintf(temp,TEMPSIZE,"NAOMI/NAOMI2 Arcade games ADPCM header"); break; + default: + snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); } concatn(length,desc,temp); } diff --git a/src/vgmstream.h b/src/vgmstream.h index ddeefeeb..4e275ce4 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -390,6 +390,7 @@ typedef enum { meta_PC_IVAUD, /* .ivaud GTA IV */ meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */ meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */ + meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */ } meta_t; typedef struct { diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 0d2472f5..a0b56e4d 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -82,6 +82,7 @@ char * extension_list[] = { "aax\0AAX Audio File (*.AAX)\0", "acm\0ACM Audio File (*.ACM)\0", + "adpcm\0ADPCM Audio File (*.ADPCM)\0", "aix\0AIX Audio File (*.AIX)\0", "adp\0ADP Audio File (*.ADP)\0", "ads\0PS2 ADS Audio File (*.ADS)\0",