mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
naomi/naomi2 .adpcm added
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@645 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
1ff07bce05
commit
7fd12dcc3d
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="libvgmstream"
|
||||
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
|
||||
RootNamespace="libvgmstream"
|
||||
@ -366,6 +366,10 @@
|
||||
RelativePath=".\meta\musx.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\naomi_adpcm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\naomi_spsd.c"
|
||||
>
|
||||
@ -578,10 +582,6 @@
|
||||
RelativePath=".\meta\ps2_rxw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_snd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_seg.c"
|
||||
>
|
||||
@ -594,6 +594,10 @@
|
||||
RelativePath=".\meta\ps2_sl3.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_snd.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_sps.c"
|
||||
>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
68
src/meta/naomi_adpcm.c
Normal file
68
src/meta/naomi_adpcm.c
Normal file
@ -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;i<channel_count;i++) {
|
||||
vgmstream->ch[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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user