mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
adding interleaved dvi format (SOTN)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@335 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
0a0387bf91
commit
40b3a1e136
@ -178,7 +178,6 @@ void decode_eacs_ima(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing,
|
||||
int delta;
|
||||
|
||||
sample_byte = read_8bit(stream->offset+i,stream->streamfile);
|
||||
/* old-style DVI takes high nibble first */
|
||||
sample_nibble = (sample_byte >> (vgmstream->get_high_nibble?0:4))&0xf;
|
||||
|
||||
sample_decoded = hist1;
|
||||
|
@ -418,6 +418,10 @@
|
||||
RelativePath=".\meta\rwx.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\sat_dvi.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\str_snds.c"
|
||||
>
|
||||
|
@ -147,4 +147,5 @@ VGMSTREAM * init_vgmstream_ikm(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_sfs(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_dvi(STREAMFILE * streamFile);
|
||||
#endif
|
||||
|
73
src/meta/sat_dvi.c
Normal file
73
src/meta/sat_dvi.c
Normal file
@ -0,0 +1,73 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* DVI */
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* XA30 (found in Driver - Parallel Lines) */
|
||||
VGMSTREAM * init_vgmstream_dvi(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("dvi",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x4456492E) /* "DVI." */
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_32bitBE(0x0C,streamFile)!=0xFFFFFFFF);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = channel_count;
|
||||
start_offset = read_32bitBE(0x04,streamFile);
|
||||
vgmstream->sample_rate = 44100;
|
||||
vgmstream->coding_type = coding_INT_DVI_IMA;
|
||||
|
||||
vgmstream->num_samples = read_32bitBE(0x08,streamFile);
|
||||
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x0C,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x08,streamFile);
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 4;
|
||||
vgmstream->meta_type = meta_DVI;
|
||||
vgmstream->get_high_nibble=1;
|
||||
|
||||
|
||||
/* 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+(i*vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].adpcm_history1_32=0;
|
||||
vgmstream->ch[i].adpcm_step_index=0;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -89,6 +89,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_filp,
|
||||
init_vgmstream_ikm,
|
||||
init_vgmstream_sfs,
|
||||
init_vgmstream_dvi,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -379,6 +380,8 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
||||
case coding_EACS_IMA:
|
||||
case coding_IMA:
|
||||
return 1;
|
||||
case coding_INT_DVI_IMA:
|
||||
return 2;
|
||||
case coding_NGC_AFC:
|
||||
return 16;
|
||||
case coding_PSX:
|
||||
@ -449,6 +452,8 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
||||
return 1; // the frame is variant in size
|
||||
case coding_WS:
|
||||
return vgmstream->current_block_size;
|
||||
case coding_INT_DVI_IMA:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -623,6 +628,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
}
|
||||
break;
|
||||
case coding_DVI_IMA:
|
||||
case coding_INT_DVI_IMA:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_dvi_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
@ -889,6 +895,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case coding_DVI_IMA:
|
||||
snprintf(temp,TEMPSIZE,"Intel DVI 4-bit IMA ADPCM");
|
||||
break;
|
||||
case coding_INT_DVI_IMA:
|
||||
snprintf(temp,TEMPSIZE,"Interleaved Intel DVI 4-bit IMA ADPCM");
|
||||
break;
|
||||
case coding_EACS_IMA:
|
||||
snprintf(temp,TEMPSIZE,"EACS 4-bit IMA ADPCM");
|
||||
@ -1112,6 +1121,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_DSP_GCM:
|
||||
snprintf(temp,TEMPSIZE,"Double DSP header stereo by .gcm extension");
|
||||
break;
|
||||
case meta_DSP_IDSP:
|
||||
snprintf(temp,TEMPSIZE,"GCM file with IDSP Header");
|
||||
break;
|
||||
case meta_RSTM_SPM:
|
||||
snprintf(temp,TEMPSIZE,"Nintendo RSTM header and .brstmspm extension");
|
||||
@ -1251,6 +1263,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_EACS_PSX:
|
||||
snprintf(temp,TEMPSIZE,"EACS Header (PSX)");
|
||||
break;
|
||||
case meta_EACS_SAT:
|
||||
snprintf(temp,TEMPSIZE,"EACS Header (SATURN)");
|
||||
break;
|
||||
case meta_RSD:
|
||||
snprintf(temp,TEMPSIZE,"RSD4 or RSD6 Header");
|
||||
@ -1287,6 +1302,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_SFS:
|
||||
snprintf(temp,TEMPSIZE,"Baroque SFS Header");
|
||||
break;
|
||||
case meta_DVI:
|
||||
snprintf(temp,TEMPSIZE,"DVI Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -56,6 +56,7 @@ typedef enum {
|
||||
with smaple-level interleave handled by the
|
||||
decoder */
|
||||
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */
|
||||
coding_INT_DVI_IMA, /* Interlaved DVI */
|
||||
coding_EACS_IMA,
|
||||
coding_IMA, /* bare IMA, low nibble first */
|
||||
coding_WS, /* Westwood Studios' custom VBR ADPCM */
|
||||
@ -125,6 +126,7 @@ typedef enum {
|
||||
meta_DSP_SADB, /* .sad */
|
||||
meta_DSP_WSI, /* .wsi */
|
||||
meta_DSP_AMTS, /* .amts */
|
||||
meta_DSP_IDSP, /* .gcm with IDSP header */
|
||||
|
||||
/* Nintendo */
|
||||
meta_STRM, /* STRM */
|
||||
@ -219,6 +221,7 @@ typedef enum {
|
||||
meta_NWA, /* Visual Art's NWA */
|
||||
meta_NWA_NWAINFOINI, /* NWA w/ NWAINFO.INI for looping */
|
||||
meta_NWA_GAMEEXEINI, /* NWA w/ Gameexe.ini for looping */
|
||||
meta_DVI, /* DVI Interleaved */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -145,6 +145,7 @@ char * extension_list[] = {
|
||||
"filp\0FILP Audio File (*.FILP)\0",
|
||||
"ikm\0IKM Audio File (*.IKM)\0",
|
||||
"sfs\0SFS Audio File (*.SFS)\0",
|
||||
"dvi\0DVI Audio File (*.DVI)\0",
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
Reference in New Issue
Block a user