mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
Use IMA_int with mono files to clarify then IMA stereo is used
Both IMA and IMA_int work the same then channels = 1, so this is just to signal when IMA stereo (nibble interleave) is actually used (ie. rarely)
This commit is contained in:
parent
8363e26b88
commit
1c042b7784
@ -173,7 +173,7 @@ VGMSTREAM * init_vgmstream_aifc(STREAMFILE *streamFile) {
|
||||
interleave = 1;
|
||||
break;
|
||||
case 0x41445034: /* ADP4 */
|
||||
coding_type = coding_DVI_IMA;
|
||||
coding_type = coding_DVI_IMA_int;
|
||||
/* don't know how stereo DVI is laid out */
|
||||
if (channel_count != 1) break;
|
||||
break;
|
||||
|
@ -27,7 +27,7 @@ VGMSTREAM * init_vgmstream_dc_kcey(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile);
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x0C,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_DVI_IMA;
|
||||
vgmstream->coding_type = coding_DVI_IMA; /* stereo/mono, high nibble first */
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_DC_KCEY;
|
||||
|
||||
|
@ -69,7 +69,7 @@ VGMSTREAM * init_vgmstream_ea_1snh(STREAMFILE *streamFile) {
|
||||
|
||||
case EA_CODEC_IMA:
|
||||
if (ea.bits!=2) goto fail;
|
||||
vgmstream->coding_type = coding_DVI_IMA; /* high nibble first */
|
||||
vgmstream->coding_type = coding_DVI_IMA; /* stereo/mono, high nibble first */
|
||||
break;
|
||||
|
||||
case EA_CODEC_PSX:
|
||||
|
@ -66,7 +66,7 @@ VGMSTREAM * init_vgmstream_ea_schl_fixed(STREAMFILE *streamFile) {
|
||||
break;
|
||||
|
||||
case EA_CODEC_IMA:
|
||||
vgmstream->coding_type = coding_DVI_IMA;
|
||||
vgmstream->coding_type = coding_DVI_IMA; /* stereo/mono, high nibble first */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1,59 +1,42 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* U-Sing (Wii) .myspd */
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* .MYSPF - from U-Sing (Wii) */
|
||||
VGMSTREAM * init_vgmstream_myspd(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
int channel_count;
|
||||
int loop_flag = 0;
|
||||
int loop_flag = 0, channel_count;
|
||||
off_t start_offset;
|
||||
size_t channel_size;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("myspd",filename_extension(filename))) goto fail;
|
||||
if (!check_extensions(streamFile,"myspd"))
|
||||
goto fail;
|
||||
|
||||
channel_count = 2;
|
||||
start_offset = 0x20;
|
||||
channel_size = read_32bitBE(0x00,streamFile);
|
||||
|
||||
/* check size */
|
||||
if ((read_32bitBE(0x0,streamFile)*channel_count+start_offset) != get_streamfile_size(streamFile))
|
||||
if ((channel_size * channel_count + start_offset) != get_streamfile_size(streamFile))
|
||||
goto fail;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->num_samples = read_32bitBE(0x0,streamFile) * 2;
|
||||
vgmstream->sample_rate = read_32bitBE(0x4,streamFile);
|
||||
vgmstream->num_samples = ima_bytes_to_samples(channel_size*channel_count, channel_count);
|
||||
vgmstream->sample_rate = read_32bitBE(0x04,streamFile);
|
||||
|
||||
vgmstream->coding_type = coding_IMA;
|
||||
vgmstream->meta_type = meta_MYSPD;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->coding_type = coding_IMA_int;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = channel_size;
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[0].streamfile = file;
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[0].offset=start_offset;
|
||||
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[1].streamfile = file;
|
||||
|
||||
vgmstream->ch[0].channel_start_offset=
|
||||
vgmstream->ch[1].offset=start_offset + read_32bitBE(0x0,streamFile);
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
|
@ -8,7 +8,7 @@ VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile) {
|
||||
off_t start_offset;
|
||||
int channel_count, loop_flag = 0;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
/* check extension, case insensitive (made-up extension) */
|
||||
if (!check_extensions(streamFile,"hwas"))
|
||||
goto fail;
|
||||
|
||||
@ -33,7 +33,7 @@ VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile) {
|
||||
|
||||
vgmstream->meta_type = meta_NDS_HWAS;
|
||||
|
||||
vgmstream->coding_type = coding_IMA;
|
||||
vgmstream->coding_type = coding_IMA_int;
|
||||
vgmstream->layout_type = layout_hwas_blocked;
|
||||
vgmstream->full_block_size = read_32bitLE(0x04,streamFile); /* usually 0x2000, 0x4000 or 0x8000 */
|
||||
|
||||
|
@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_nds_rrds(STREAMFILE *streamFile) {
|
||||
int loop_flag;
|
||||
off_t start_offset;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
/* check extension, case insensitive (made-up extension) */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("rrds",filename_extension(filename))) goto fail;
|
||||
|
||||
@ -37,7 +37,7 @@ VGMSTREAM * init_vgmstream_nds_rrds(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_IMA;
|
||||
vgmstream->coding_type = coding_IMA_int;
|
||||
vgmstream->meta_type = meta_NDS_RRDS;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
|
@ -30,7 +30,7 @@ VGMSTREAM * init_vgmstream_pc_adp_bos(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_DVI_IMA;
|
||||
vgmstream->coding_type = coding_DVI_IMA_int;
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->meta_type = meta_BOS_ADP;
|
||||
|
||||
|
@ -55,7 +55,7 @@ VGMSTREAM * init_vgmstream_ws_aud(STREAMFILE *streamFile) {
|
||||
if (bytes_per_sample != 1) goto fail;
|
||||
break;
|
||||
case 99: /* IMA ADPCM */
|
||||
coding_type = coding_IMA;
|
||||
coding_type = coding_IMA_int;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
|
Loading…
Reference in New Issue
Block a user