cleanup: remove tabs

This commit is contained in:
bnnm 2021-09-04 22:19:36 +02:00
parent 333b7097c9
commit abb9acaf4f
19 changed files with 93 additions and 97 deletions

View File

@ -6,15 +6,13 @@
/* Based on Valery V. Anisimovsky's WS-AUD.txt */ /* Based on Valery V. Anisimovsky's WS-AUD.txt */
static char WSTable2bit[4]={-2,-1,0,1}; static char WSTable2bit[4] = { -2,-1,0,1 };
static char WSTable4bit[16]={-9,-8,-6,-5,-4,-3,-2,-1, static char WSTable4bit[16] = { -9,-8,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5 ,6, 8 };
0, 1, 2, 3, 4, 5 ,6, 8};
/* We pass in the VGMSTREAM here, unlike in other codings, because /* We pass in the VGMSTREAM here, unlike in other codings, because
the decoder has to know about the block structure. */ the decoder has to know about the block structure. */
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample,
int32_t samples_to_do) { int32_t samples_to_do) {
VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]); VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]);
int16_t hist = stream->adpcm_history1_16; int16_t hist = stream->adpcm_history1_16;
off_t offset = stream->offset; off_t offset = stream->offset;

View File

@ -2,49 +2,47 @@
#include "../coding/coding.h" #include "../coding/coding.h"
#include "../util.h" #include "../util.h"
/* .ADX - from Xenoblade 3D */ /* .ADX - from Xenoblade 3D (3DS) */
/* Xenoblade Chronicles 3D uses an adx extension as with VGMSTREAM* init_vgmstream_dsp_adx(STREAMFILE *sf) {
* the Wii version, but it's actually DSP ADPCM. */ VGMSTREAM* vgmstream = NULL;
VGMSTREAM * init_vgmstream_dsp_adx(STREAMFILE *streamFile) { int loop_flag, channels;
VGMSTREAM * vgmstream = NULL;
int loop_flag, channel_count;
int channel_header_spacing = 0x34; int channel_header_spacing = 0x34;
/* check extension, case insensitive */ /* checks */
if (!check_extensions(streamFile,"adx")) goto fail; if (!check_extensions(sf,"adx"))
goto fail;
/* check header */ if (read_u32be(0x00,sf) != 0x02000000)
if (read_32bitBE(0,streamFile)!=0x02000000) goto fail; goto fail;
channel_count = read_32bitLE(0, streamFile); channels = read_32bitLE(0, sf);
loop_flag = read_16bitLE(0x6e, streamFile); loop_flag = read_16bitLE(0x6e, sf);
if (channel_count > 2 || channel_count < 0) goto fail; if (channels > 2 || channels < 0) goto fail;
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->coding_type = coding_NGC_DSP; vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_XB3D_ADX; vgmstream->meta_type = meta_XB3D_ADX;
vgmstream->sample_rate = read_32bitLE(0x70,streamFile); vgmstream->sample_rate = read_32bitLE(0x70,sf);
vgmstream->num_samples = read_32bitLE(0x74, streamFile); vgmstream->num_samples = read_32bitLE(0x74, sf);
vgmstream->loop_start_sample = read_32bitLE(0x78, streamFile); vgmstream->loop_start_sample = read_32bitLE(0x78, sf);
vgmstream->loop_end_sample = read_32bitLE(0x7c, streamFile); vgmstream->loop_end_sample = read_32bitLE(0x7c, sf);
dsp_read_coefs_le(vgmstream,streamFile, 0x4, channel_header_spacing);
dsp_read_coefs_le(vgmstream,sf, 0x4, channel_header_spacing);
/* semi-interleave: manually open streams at offset */ /* semi-interleave: manually open streams at offset */
{ {
char filename[PATH_LIMIT]; char filename[PATH_LIMIT];
int i; int i;
streamFile->get_name(streamFile,filename,sizeof(filename)); sf->get_name(sf,filename,sizeof(filename));
for (i = 0; i<channel_count; i++) { for (i = 0; i<channels; i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename, STREAMFILE_DEFAULT_BUFFER_SIZE); vgmstream->ch[i].streamfile = sf->open(sf, filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
vgmstream->ch[i].channel_start_offset = vgmstream->ch[i].channel_start_offset =
vgmstream->ch[i].offset = read_32bitLE(0x34+i*channel_header_spacing, streamFile); vgmstream->ch[i].offset = read_32bitLE(0x34+i*channel_header_spacing, sf);
if (!vgmstream->ch[i].streamfile) goto fail; if (!vgmstream->ch[i].streamfile) goto fail;
} }
} }

View File

@ -26,8 +26,8 @@ typedef struct {
off_t stream_offset; off_t stream_offset;
} xvag_header; } xvag_header;
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header * xvag, off_t chunk_offset); static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header* xvag, off_t chunk_offset);
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header * xvag, off_t chunk_offset, off_t start_offset); static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header* xvag, off_t chunk_offset, off_t start_offset);
/* XVAG - Sony's Scream Tool/Stream Creator format (God of War III, Ratchet & Clank Future, The Last of Us, Uncharted) */ /* XVAG - Sony's Scream Tool/Stream Creator format (God of War III, Ratchet & Clank Future, The Last of Us, Uncharted) */
VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) { VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
@ -42,7 +42,7 @@ VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
/* checks */ /* checks */
/* .xvag: standard /* .xvag: standard
* (extensionless): The Last Of Us (PS3) speech files */ * (extensionless): The Last of Us (PS3) speech files */
if (!check_extensions(sf,"xvag,")) if (!check_extensions(sf,"xvag,"))
goto fail; goto fail;
if (!is_id32be(0x00,sf, "XVAG")) if (!is_id32be(0x00,sf, "XVAG"))
@ -254,7 +254,7 @@ fail:
} }
#ifdef VGM_USE_ATRAC9 #ifdef VGM_USE_ATRAC9
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header * xvag, off_t chunk_offset) { static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header* xvag, off_t chunk_offset) {
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE; int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;
atrac9_config cfg = {0}; atrac9_config cfg = {0};
@ -278,7 +278,7 @@ fail:
} }
#endif #endif
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header * xvag, off_t chunk_offset, off_t start_offset) { static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header* xvag, off_t chunk_offset, off_t start_offset) {
layered_layout_data* data = NULL; layered_layout_data* data = NULL;
STREAMFILE* temp_sf = NULL; STREAMFILE* temp_sf = NULL;
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE; int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;