Set dual stereo as a meta flag rather than a static list

Mainly for cleanup/style
This commit is contained in:
bnnm 2018-08-23 18:00:34 +02:00
parent 9ad2f578e6
commit ad4478ac2c
17 changed files with 31 additions and 32 deletions

View File

@ -43,6 +43,7 @@ VGMSTREAM * init_vgmstream_agsc(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_DSP_AGSC;
vgmstream->allow_dual_stereo = 1;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i]=read_16bitBE(header_offset+0xf6+i*2,streamFile);

View File

@ -82,6 +82,7 @@ VGMSTREAM * init_vgmstream_eb_sfx(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_EB_SFX;
vgmstream->allow_dual_stereo = 1;
/* open the file for reading */
{

View File

@ -325,6 +325,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
vgmstream->coding_type = coding;
vgmstream->meta_type = meta_GENH;
vgmstream->allow_dual_stereo = 1;
if ( !vgmstream_open_stream(vgmstream,streamFile,genh.start_offset) )

View File

@ -37,6 +37,7 @@ VGMSTREAM * init_vgmstream_kraw(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_KRAW;
vgmstream->allow_dual_stereo = 1;
/* open the file for reading */
{

View File

@ -348,6 +348,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_std(STREAMFILE *streamFile) {
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->meta_type = meta_DSP_STD;
vgmstream->allow_dual_stereo = 1; /* very common in .dsp */
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none;

View File

@ -39,6 +39,7 @@ VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE *streamFile) {
vgmstream->num_samples = read_32bitBE(0x20,streamFile);
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_DSP_YGO;
vgmstream->allow_dual_stereo = 1;
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitBE(0x30,streamFile)*14/16);
vgmstream->loop_end_sample = (read_32bitBE(0x34,streamFile)*14/16);

View File

@ -37,6 +37,7 @@ VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_NGC_LPS;
vgmstream->allow_dual_stereo = 1;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;

View File

@ -34,6 +34,7 @@ VGMSTREAM * init_vgmstream_ngca(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_NGCA;
vgmstream->allow_dual_stereo = 1;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;

View File

@ -32,6 +32,7 @@ VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_NUB_VAG;
vgmstream->allow_dual_stereo = 1;
start_offset = 0xC0;

View File

@ -8,11 +8,11 @@ VGMSTREAM * init_vgmstream_ps2_smpl(STREAMFILE *streamFile) {
int loop_flag, channel_count;
size_t channel_size;
/* check extension (.v0: left channel, .v1: right channel, .smpl: header id) */
/* checks*/
/* .v0: left channel, .v1: right channel
* .smpl: header id */
if ( !check_extensions(streamFile,"v0,v1,smpl") )
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x534D504C) /* "SMPL" */
goto fail;
@ -31,13 +31,12 @@ VGMSTREAM * init_vgmstream_ps2_smpl(STREAMFILE *streamFile) {
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->meta_type = meta_PS2_SMPL;
vgmstream->allow_dual_stereo = 1;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_none;
/* always, but can be null or used as special string */
read_string(vgmstream->stream_name,0x10+1, 0x20,streamFile);
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;

View File

@ -276,6 +276,7 @@ VGMSTREAM * init_vgmstream_ps_headerless(STREAMFILE *streamFile) {
}
vgmstream->meta_type = meta_PS_HEADERLESS;
vgmstream->allow_dual_stereo = 1;
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;

View File

@ -280,10 +280,13 @@ VGMSTREAM * init_vgmstream_rwsd(STREAMFILE *streamFile) {
vgmstream->meta_type = meta_RWAR;
else if (rwav)
{
if (big_endian)
if (big_endian) {
vgmstream->meta_type = meta_RWAV;
else
}
else {
vgmstream->meta_type = meta_CWAV;
vgmstream->allow_dual_stereo = 1; /* LEGO 3DS games */
}
}
else
vgmstream->meta_type = meta_RWSD;

View File

@ -71,6 +71,7 @@ VGMSTREAM * init_vgmstream_spt_spd(STREAMFILE *streamFile) {
}
vgmstream->meta_type = meta_SPT_SPD;
vgmstream->allow_dual_stereo = 1;
/* open the file for reading */
{

View File

@ -384,6 +384,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
vgmstream->coding_type = coding;
vgmstream->meta_type = meta_TXTH;
vgmstream->allow_dual_stereo = 1;
if ( !vgmstream_open_stream(vgmstream,streamFile,txth.start_offset) )

View File

@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_vag(STREAMFILE *streamFile) {
int channel_count = 0, loop_flag, sample_rate;
uint32_t vag_id, version;
int32_t loop_start_sample = 0, loop_end_sample = 0;
//int allow_dual_stereo = 0;
int allow_dual_stereo = 0;
/* checks */
@ -195,7 +195,7 @@ VGMSTREAM * init_vgmstream_vag(STREAMFILE *streamFile) {
channel_count = 1;
loop_flag = ps_find_loop_offsets_full(streamFile, start_offset, channel_size*channel_count, channel_count, interleave, &loop_start_sample, &loop_end_sample);
//allow_dual_stereo = 1; /* often found with external L/R files */
allow_dual_stereo = 1; /* often found with external L/R files */
}
break;
@ -209,6 +209,8 @@ VGMSTREAM * init_vgmstream_vag(STREAMFILE *streamFile) {
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_type;
vgmstream->allow_dual_stereo = allow_dual_stereo;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = ps_bytes_to_samples(channel_size,1);
vgmstream->loop_start_sample = loop_start_sample;

View File

@ -474,23 +474,7 @@ static VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile) {
}
/* test if candidate for dual stereo */
if (vgmstream->channels == 1 && (
(vgmstream->meta_type == meta_DSP_STD) ||
(vgmstream->meta_type == meta_PS2_VAGp) ||
(vgmstream->meta_type == meta_GENH) ||
(vgmstream->meta_type == meta_TXTH) ||
(vgmstream->meta_type == meta_KRAW) ||
(vgmstream->meta_type == meta_PS_HEADERLESS) ||
(vgmstream->meta_type == meta_NGC_LPS) ||
(vgmstream->meta_type == meta_DSP_YGO) ||
(vgmstream->meta_type == meta_DSP_AGSC) ||
(vgmstream->meta_type == meta_PS2_SMPL) ||
(vgmstream->meta_type == meta_NGCA) ||
(vgmstream->meta_type == meta_NUB_VAG) ||
(vgmstream->meta_type == meta_SPT_SPD) ||
(vgmstream->meta_type == meta_EB_SFX) ||
(vgmstream->meta_type == meta_CWAV)
)) {
if (vgmstream->channels == 1 && vgmstream->allow_dual_stereo == 1) {
try_dual_file_stereo(vgmstream, streamFile, init_vgmstream_functions[i]);
}

View File

@ -757,10 +757,11 @@ typedef struct {
int num_streams; /* for multi-stream formats (0=not set/one stream, 1=one stream) */
int stream_index; /* selected stream (also 1-based) */
char stream_name[STREAM_NAME_SIZE]; /* name of the current stream (info), if the file stores it and it's filled */
size_t stream_size; /* info to properly calculate bitrate */
size_t stream_size; /* info to properly calculate bitrate in case of subsongs */
uint32_t channel_mask; /* to silence crossfading subsongs/layers */
int channel_mappings_on; /* channel mappings are active */
int channel_mappings[32]; /* swap channel "i" with "[i]" */
int allow_dual_stereo; /* search for dual stereo (file_L.ext + file_R.ext = single stereo file) */
/* looping */
int loop_flag; /* is this stream looped? */
@ -804,7 +805,7 @@ typedef struct {
int32_t ws_output_size; /* WS ADPCM: output bytes for this block */
void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream (for AAX/AIX/SCD) */
void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream (for custom layouts) */
/* Data the codec needs for the whole stream. This is for codecs too
* different from vgmstream's structure to be reasonably shoehorned into
@ -812,9 +813,7 @@ typedef struct {
* Note also that support must be added for resetting, looping and
* closing for every codec that uses this, as it will not be handled. */
void * codec_data;
/* Same, for special layouts.
* Reusing the above pointer causes bugs when it's using special layout + codec
* (vgmstream may try to free/loop/etc codec_data). */
/* Same, for special layouts. layout_data + codec_data may exist at the same time. */
void * layout_data;
} VGMSTREAM;