This commit is contained in:
bnnm 2021-04-03 18:11:28 +02:00
parent 98b1c18951
commit f65c3284c7
7 changed files with 363 additions and 364 deletions

View File

@ -1,107 +1,107 @@
#include "layout.h"
#include "../coding/coding.h"
#include "../vgmstream.h"
/* set up for the block at the given offset */
void block_update_ea_1snh(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i;
uint32_t block_id;
size_t block_size = 0, block_header = 0, audio_size = 0;
int32_t (*read_32bit)(off_t,STREAMFILE*) = vgmstream->codec_endian ? read_32bitBE : read_32bitLE;
/* EOF reads: signal we have nothing and let the layout fail */
if (block_offset >= get_streamfile_size(streamFile)) {
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset;
vgmstream->current_block_samples = -1;
return;
}
block_id = read_32bitBE(block_offset + 0x00, streamFile);
/* BE in SAT, but one file may have both BE and LE chunks [FIFA 98 (SAT): movie LE, audio BE] */
if (guess_endianness32bit(block_offset + 0x04, streamFile))
block_size = read_32bitBE(block_offset + 0x04, streamFile);
else
block_size = read_32bitLE(block_offset + 0x04, streamFile);
block_header = 0;
if (block_id == 0x31534E68 || block_id == 0x53454144) { /* "1SNh" "SEAD" audio header */
int is_sead = (block_id == 0x53454144);
int is_eacs = read_32bitBE(block_offset + 0x08, streamFile) == 0x45414353;
int is_zero = read_32bitBE(block_offset + 0x08, streamFile) == 0x00;
block_header = (is_eacs || is_zero) ? 0x28 : (is_sead ? 0x14 : 0x2c);
if (block_header >= block_size) /* sometimes has audio data after header */
block_header = 0;
} else if (block_id == 0x31534E64 || block_id == 0x534E4443) { /* "1SNd" "SNDC" audio data */
block_header = 0x08;
} else if (block_id == 0x00000000 || block_id == 0xFFFFFFFF || block_id == 0x31534E65) { /* EOF or "1SNe" */
vgmstream->current_block_samples = -1;
return;
}
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
if (block_header == 0) {
/* no audio data, skip this block */
vgmstream->current_block_samples = 0;
return;
}
audio_size = block_size - block_header;
/* set new channel offsets and block sizes */
switch(vgmstream->coding_type) {
case coding_PCM8_int:
case coding_ULAW_int:
vgmstream->current_block_samples = pcm_bytes_to_samples(audio_size, vgmstream->channels, 8);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + i;
}
break;
case coding_PCM16_int:
vgmstream->current_block_samples = pcm_bytes_to_samples(audio_size, vgmstream->channels, 16);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + (i*2);
}
break;
case coding_PSX:
vgmstream->current_block_samples = ps_bytes_to_samples(audio_size, vgmstream->channels);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + i*(audio_size/vgmstream->channels);
}
break;
case coding_DVI_IMA:
if (vgmstream->codec_config == 1) { /* ADPCM hist */
vgmstream->current_block_samples = read_32bit(block_offset + block_header, streamFile);
for(i = 0; i < vgmstream->channels; i++) {
off_t adpcm_offset = block_offset + block_header + 0x04;
vgmstream->ch[i].adpcm_step_index = read_32bit(adpcm_offset + i*0x04 + 0x00*vgmstream->channels, streamFile);
vgmstream->ch[i].adpcm_history1_32 = read_32bit(adpcm_offset + i*0x04 + 0x04*vgmstream->channels, streamFile);
vgmstream->ch[i].offset = adpcm_offset + 0x08*vgmstream->channels;
}
//VGM_ASSERT(vgmstream->current_block_samples != (block_size - block_header - 0x04 - 0x08*vgmstream->channels) * 2 / vgmstream->channels,
// "EA 1SHN blocked: different expected vs block num samples at %lx\n", block_offset);
}
else {
vgmstream->current_block_samples = ima_bytes_to_samples(audio_size, vgmstream->channels);
for(i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + block_header;
}
}
break;
default:
break;
}
}
#include "layout.h"
#include "../coding/coding.h"
#include "../vgmstream.h"
/* set up for the block at the given offset */
void block_update_ea_1snh(off_t block_offset, VGMSTREAM* vgmstream) {
STREAMFILE* sf = vgmstream->ch[0].streamfile;
int i;
uint32_t block_id;
size_t block_size = 0, block_header = 0, audio_size = 0;
int32_t (*read_32bit)(off_t,STREAMFILE*) = vgmstream->codec_endian ? read_32bitBE : read_32bitLE;
/* EOF reads: signal we have nothing and let the layout fail */
if (block_offset >= get_streamfile_size(sf)) {
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset;
vgmstream->current_block_samples = -1;
return;
}
block_id = read_32bitBE(block_offset + 0x00, sf);
/* BE in SAT, but one file may have both BE and LE chunks [FIFA 98 (SAT): movie LE, audio BE] */
if (guess_endianness32bit(block_offset + 0x04, sf))
block_size = read_32bitBE(block_offset + 0x04, sf);
else
block_size = read_32bitLE(block_offset + 0x04, sf);
block_header = 0;
if (block_id == 0x31534E68 || block_id == 0x53454144) { /* "1SNh" "SEAD" audio header */
int is_sead = (block_id == 0x53454144);
int is_eacs = read_32bitBE(block_offset + 0x08, sf) == 0x45414353;
int is_zero = read_32bitBE(block_offset + 0x08, sf) == 0x00;
block_header = (is_eacs || is_zero) ? 0x28 : (is_sead ? 0x14 : 0x2c);
if (block_header >= block_size) /* sometimes has audio data after header */
block_header = 0;
} else if (block_id == 0x31534E64 || block_id == 0x534E4443) { /* "1SNd" "SNDC" audio data */
block_header = 0x08;
} else if (block_id == 0x00000000 || block_id == 0xFFFFFFFF || block_id == 0x31534E65) { /* EOF or "1SNe" */
vgmstream->current_block_samples = -1;
return;
}
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
if (block_header == 0) {
/* no audio data, skip this block */
vgmstream->current_block_samples = 0;
return;
}
audio_size = block_size - block_header;
/* set new channel offsets and block sizes */
switch(vgmstream->coding_type) {
case coding_PCM8_int:
case coding_ULAW_int:
vgmstream->current_block_samples = pcm_bytes_to_samples(audio_size, vgmstream->channels, 8);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + i;
}
break;
case coding_PCM16_int:
vgmstream->current_block_samples = pcm_bytes_to_samples(audio_size, vgmstream->channels, 16);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + (i*2);
}
break;
case coding_PSX:
vgmstream->current_block_samples = ps_bytes_to_samples(audio_size, vgmstream->channels);
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + block_header + i*(audio_size/vgmstream->channels);
}
break;
case coding_DVI_IMA:
if (vgmstream->codec_config == 1) { /* ADPCM hist */
vgmstream->current_block_samples = read_32bit(block_offset + block_header, sf);
for(i = 0; i < vgmstream->channels; i++) {
off_t adpcm_offset = block_offset + block_header + 0x04;
vgmstream->ch[i].adpcm_step_index = read_32bit(adpcm_offset + i*0x04 + 0x00*vgmstream->channels, sf);
vgmstream->ch[i].adpcm_history1_32 = read_32bit(adpcm_offset + i*0x04 + 0x04*vgmstream->channels, sf);
vgmstream->ch[i].offset = adpcm_offset + 0x08*vgmstream->channels;
}
//VGM_ASSERT(vgmstream->current_block_samples != (block_size - block_header - 0x04 - 0x08*vgmstream->channels) * 2 / vgmstream->channels,
// "EA 1SHN blocked: different expected vs block num samples at %lx\n", block_offset);
}
else {
vgmstream->current_block_samples = ima_bytes_to_samples(audio_size, vgmstream->channels);
for(i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + block_header;
}
}
break;
default:
break;
}
}

View File

@ -1,70 +1,70 @@
#include "layout.h"
#include "../coding/coding.h"
#include "../vgmstream.h"
/* EA SNS/SPS blocks */
void block_update_ea_sns(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
uint32_t block_id, block_size, block_samples;
off_t channel_start;
size_t channel_interleave;
int i;
/* EOF reads: signal we have nothing and let the layout fail */
if (block_offset >= get_streamfile_size(streamFile)) {
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset;
vgmstream->current_block_samples = -1;
return;
}
/* always BE */
block_size = read_32bitBE(block_offset + 0x00,streamFile);
/* At 0x00(1): block flag
* - in SNS: 0x00=normal block, 0x80=last block (not mandatory)
* - in SPS: 0x48=header, 0x44=normal block, 0x45=last block (empty) */
block_id = (block_size & 0xFF000000) >> 24;
block_size &= 0x00FFFFFF;
if (block_id == 0x00 || block_id == 0x80 || block_id == 0x44) {
block_samples = read_32bitBE(block_offset + 0x04, streamFile);
} else {
block_samples = 0;
}
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
vgmstream->current_block_samples = block_samples;
/* no need to setup offsets (plus could read over filesize near EOF) */
if (block_samples == 0)
return;
switch (vgmstream->coding_type) {
case coding_NGC_DSP:
/* 0x04: unknown (0x00/02), 0x08: some size?, 0x34: null? */
channel_start = read_32bitBE(block_offset + 0x08 + 0x00, streamFile);
channel_interleave = read_32bitBE(block_offset + 0x08 + 0x0c, streamFile);
/* guessed as all known EA DSP only have one block with subheader (maybe changes coefs every block?) */
if (channel_start >= 0x40) {
dsp_read_coefs_be(vgmstream, streamFile, block_offset + 0x08 + 0x10, 0x28);
dsp_read_hist_be(vgmstream, streamFile, block_offset + 0x08 + 0x30, 0x28);//todo guessed and doesn't fix clicks in full loops
}
break;
default:
channel_start = 0x00;
channel_interleave = 0x00;
break;
}
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + 0x08 + channel_start + i * channel_interleave;
/* also fix first offset (for EALayer3) */
if (block_offset == vgmstream->ch[i].channel_start_offset) {
vgmstream->ch[i].channel_start_offset = vgmstream->ch[i].offset;
}
}
}
#include "layout.h"
#include "../coding/coding.h"
#include "../vgmstream.h"
/* EA SNS/SPS blocks */
void block_update_ea_sns(off_t block_offset, VGMSTREAM* vgmstream) {
STREAMFILE* sf = vgmstream->ch[0].streamfile;
uint32_t block_id, block_size, block_samples;
off_t channel_start;
size_t channel_interleave;
int i;
/* EOF reads: signal we have nothing and let the layout fail */
if (block_offset >= get_streamfile_size(sf)) {
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset;
vgmstream->current_block_samples = -1;
return;
}
/* always BE */
block_size = read_32bitBE(block_offset + 0x00,sf);
/* At 0x00(1): block flag
* - in SNS: 0x00=normal block, 0x80=last block (not mandatory)
* - in SPS: 0x48=header, 0x44=normal block, 0x45=last block (empty) */
block_id = (block_size & 0xFF000000) >> 24;
block_size &= 0x00FFFFFF;
if (block_id == 0x00 || block_id == 0x80 || block_id == 0x44) {
block_samples = read_32bitBE(block_offset + 0x04, sf);
} else {
block_samples = 0;
}
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
vgmstream->current_block_samples = block_samples;
/* no need to setup offsets (plus could read over filesize near EOF) */
if (block_samples == 0)
return;
switch (vgmstream->coding_type) {
case coding_NGC_DSP:
/* 0x04: unknown (0x00/02), 0x08: some size?, 0x34: null? */
channel_start = read_32bitBE(block_offset + 0x08 + 0x00, sf);
channel_interleave = read_32bitBE(block_offset + 0x08 + 0x0c, sf);
/* guessed as all known EA DSP only have one block with subheader (maybe changes coefs every block?) */
if (channel_start >= 0x40) {
dsp_read_coefs_be(vgmstream, sf, block_offset + 0x08 + 0x10, 0x28);
dsp_read_hist_be(vgmstream, sf, block_offset + 0x08 + 0x30, 0x28);//todo guessed and doesn't fix clicks in full loops
}
break;
default:
channel_start = 0x00;
channel_interleave = 0x00;
break;
}
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + 0x08 + channel_start + i * channel_interleave;
/* also fix first offset (for EALayer3) */
if (block_offset == vgmstream->ch[i].channel_start_offset) {
vgmstream->ch[i].channel_start_offset = vgmstream->ch[i].offset;
}
}
}

View File

@ -1,30 +1,30 @@
#include "layout.h"
#include "../coding/coding.h"
/* EA style blocks, one block per channel when stereo */
void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i;
size_t block_size, channel_size = 0, interleave = 0;
uint32_t block_id;
block_id = read_32bitBE(block_offset+0x00, streamFile);
block_size = read_32bitBE(block_offset+0x04, streamFile);
/* accept "Ad10/Ad11" audio block/footer */
if (block_id == 0x41643130 || block_id == 0x41643131) {
channel_size = block_size - 0x08; /* one block per channel */
interleave = block_size;
block_size = block_size*vgmstream->channels;
}
/* rest could be "MDEC" video blocks with 0 size/samples */
vgmstream->current_block_size = channel_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = (block_offset + 0x08) + interleave*i;
}
}
#include "layout.h"
#include "../coding/coding.h"
/* EA style blocks, one block per channel when stereo */
void block_update_ea_wve_ad10(off_t block_offset, VGMSTREAM* vgmstream) {
STREAMFILE* sf = vgmstream->ch[0].streamfile;
int i;
size_t block_size, channel_size = 0, interleave = 0;
uint32_t block_id;
block_id = read_32bitBE(block_offset+0x00, sf);
block_size = read_32bitBE(block_offset+0x04, sf);
/* accept "Ad10/Ad11" audio block/footer */
if (block_id == 0x41643130 || block_id == 0x41643131) {
channel_size = block_size - 0x08; /* one block per channel */
interleave = block_size;
block_size = block_size*vgmstream->channels;
}
/* rest could be "MDEC" video blocks with 0 size/samples */
vgmstream->current_block_size = channel_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = (block_offset + 0x08) + interleave*i;
}
}

View File

@ -1,29 +1,29 @@
#include "layout.h"
#include "../coding/coding.h"
/* EA style blocks */
void block_update_ea_wve_au00(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i;
size_t block_size, channel_size = 0;
uint32_t block_id;
block_id = read_32bitBE(block_offset+0x00, streamFile);
block_size = read_32bitBE(block_offset+0x04, streamFile);
/* accept "au00/au01" audio block/footer */
if (block_id == 0x61753030 || block_id == 0x61753031) {
/* adjusted to frame boundaries as blocks have padding */
channel_size = ((block_size - 0x10) / vgmstream->interleave_block_size * vgmstream->interleave_block_size) / vgmstream->channels;
}
/* rest could be "MDEC" video blocks with 0 size/samples */
vgmstream->current_block_size = channel_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = (block_offset + 0x10) + channel_size*i;
}
}
#include "layout.h"
#include "../coding/coding.h"
/* EA style blocks */
void block_update_ea_wve_au00(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* sf = vgmstream->ch[0].streamfile;
int i;
size_t block_size, channel_size = 0;
uint32_t block_id;
block_id = read_32bitBE(block_offset+0x00, sf);
block_size = read_32bitBE(block_offset+0x04, sf);
/* accept "au00/au01" audio block/footer */
if (block_id == 0x61753030 || block_id == 0x61753031) {
/* adjusted to frame boundaries as blocks have padding */
channel_size = ((block_size - 0x10) / vgmstream->interleave_block_size * vgmstream->interleave_block_size) / vgmstream->channels;
}
/* rest could be "MDEC" video blocks with 0 size/samples */
vgmstream->current_block_size = channel_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = (block_offset + 0x10) + channel_size*i;
}
}

View File

@ -1,83 +1,83 @@
#include "layout.h"
#include "../coding/coding.h"
/* H4M video blocks with audio frames, based on h4m_audio_decode */
void block_update_h4m(off_t block_offset, VGMSTREAM * vgmstream) {
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
int i;
size_t block_size, block_samples;
/* use full_block_size as counter (a bit hacky but whatevs) */
if (vgmstream->full_block_size <= 0) {
/* new full block */
/* 0x00: last_full_block_size */
uint32_t full_block_size = read_32bitBE(block_offset+0x04, streamFile);
/* 0x08: vid_frame_count */
/* 0x0c: aud_frame_count */
/* 0x10: block_header_unk (0x01000000, except 0 in a couple of Bomberman Jetters files) */
vgmstream->full_block_size = full_block_size; /* not including 0x14 block header */
block_size = 0x14; /* skip header and point to first frame in full block */
block_samples = 0; /* signal new block_update_h4m */
}
else {
/* new audio or video frames in the current full block */
uint16_t frame_type = read_16bitBE(block_offset+0x00, streamFile);
uint16_t frame_format = read_16bitBE(block_offset+0x02, streamFile);
uint32_t frame_size = read_32bitBE(block_offset+0x04, streamFile); /* not including 0x08 frame header */
if (frame_type == 0x00) {
/* HVQM4_AUDIO (there are more checks with frame_format but not too relevant for vgmstream) */
uint32_t frame_samples = read_32bitBE(block_offset+0x08, streamFile);
size_t block_skip;
if (vgmstream->codec_config & 0x80) {
frame_samples /= 2; /* ??? */
}
block_skip = 0x08 + 0x04;
block_size = 0x08 + frame_size;
block_samples = frame_samples;
/* skip data from other audio tracks */
if (vgmstream->num_streams > 1 && vgmstream->stream_index > 1) {
uint32_t audio_bytes = frame_size - 0x04;
block_skip += (audio_bytes / vgmstream->num_streams) * (vgmstream->stream_index-1);
}
VGM_ASSERT(frame_format == 1, "H4M: unknown frame_format %x at %x\n", frame_format, (uint32_t)block_offset);
/* pass current mode to the decoder */
vgmstream->codec_config = (frame_format << 8) | (vgmstream->codec_config & 0xFF);
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + block_skip;
}
}
else {
block_size = 0x08 + frame_size;
block_samples = 0; /* signal new block_update_h4m */
}
vgmstream->full_block_size -= block_size;
}
/* EOF check, there is some footer/garbage at the end */
if (block_offset == get_streamfile_size(streamFile)
|| block_offset + block_size > get_streamfile_size(streamFile)) {
//block_samples = -1; /* signal end block */
vgmstream->full_block_size = 0;
vgmstream->current_block_samples = 0;
vgmstream->current_block_offset = get_streamfile_size(streamFile);
vgmstream->next_block_offset = get_streamfile_size(streamFile);
return;
}
vgmstream->current_block_samples = block_samples;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
}
#include "layout.h"
#include "../coding/coding.h"
/* H4M video blocks with audio frames, based on h4m_audio_decode */
void block_update_h4m(off_t block_offset, VGMSTREAM* vgmstream) {
STREAMFILE* sf = vgmstream->ch[0].streamfile;
int i;
size_t block_size, block_samples;
/* use full_block_size as counter (a bit hacky but whatevs) */
if (vgmstream->full_block_size <= 0) {
/* new full block */
/* 0x00: last_full_block_size */
uint32_t full_block_size = read_32bitBE(block_offset+0x04, sf);
/* 0x08: vid_frame_count */
/* 0x0c: aud_frame_count */
/* 0x10: block_header_unk (0x01000000, except 0 in a couple of Bomberman Jetters files) */
vgmstream->full_block_size = full_block_size; /* not including 0x14 block header */
block_size = 0x14; /* skip header and point to first frame in full block */
block_samples = 0; /* signal new block_update_h4m */
}
else {
/* new audio or video frames in the current full block */
uint16_t frame_type = read_16bitBE(block_offset+0x00, sf);
uint16_t frame_format = read_16bitBE(block_offset+0x02, sf);
uint32_t frame_size = read_32bitBE(block_offset+0x04, sf); /* not including 0x08 frame header */
if (frame_type == 0x00) {
/* HVQM4_AUDIO (there are more checks with frame_format but not too relevant for vgmstream) */
uint32_t frame_samples = read_32bitBE(block_offset+0x08, sf);
size_t block_skip;
if (vgmstream->codec_config & 0x80) {
frame_samples /= 2; /* ??? */
}
block_skip = 0x08 + 0x04;
block_size = 0x08 + frame_size;
block_samples = frame_samples;
/* skip data from other audio tracks */
if (vgmstream->num_streams > 1 && vgmstream->stream_index > 1) {
uint32_t audio_bytes = frame_size - 0x04;
block_skip += (audio_bytes / vgmstream->num_streams) * (vgmstream->stream_index-1);
}
VGM_ASSERT(frame_format == 1, "H4M: unknown frame_format %x at %x\n", frame_format, (uint32_t)block_offset);
/* pass current mode to the decoder */
vgmstream->codec_config = (frame_format << 8) | (vgmstream->codec_config & 0xFF);
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + block_skip;
}
}
else {
block_size = 0x08 + frame_size;
block_samples = 0; /* signal new block_update_h4m */
}
vgmstream->full_block_size -= block_size;
}
/* EOF check, there is some footer/garbage at the end */
if (block_offset == get_streamfile_size(sf)
|| block_offset + block_size > get_streamfile_size(sf)) {
//block_samples = -1; /* signal end block */
vgmstream->full_block_size = 0;
vgmstream->current_block_samples = 0;
vgmstream->current_block_offset = get_streamfile_size(sf);
vgmstream->next_block_offset = get_streamfile_size(sf);
return;
}
vgmstream->current_block_samples = block_samples;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
}

View File

@ -1,24 +1,24 @@
#include "layout.h"
#include "../vgmstream.h"
/* a simple headerless block with special adpcm history handling */
void block_update_hwas(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
size_t block_size;
/* no header */
block_size = vgmstream->full_block_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset
+ block_size;
vgmstream->current_block_size = block_size;
/* reset ADPCM history every block (no header with hist or anything) */
/* probably not 100% exact but good enough to get something decently playable (otherwise there are wild volume swings) */
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].adpcm_history1_32 = 0;
vgmstream->ch[i].adpcm_step_index = 0;
vgmstream->ch[i].offset = block_offset;
}
}
#include "layout.h"
#include "../vgmstream.h"
/* a simple headerless block with special adpcm history handling */
void block_update_hwas(off_t block_offset, VGMSTREAM* vgmstream) {
int i;
size_t block_size;
/* no header */
block_size = vgmstream->full_block_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset
+ block_size;
vgmstream->current_block_size = block_size;
/* reset ADPCM history every block (no header with hist or anything) */
/* probably not 100% exact but good enough to get something decently playable (otherwise there are wild volume swings) */
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].adpcm_history1_32 = 0;
vgmstream->ch[i].adpcm_step_index = 0;
vgmstream->ch[i].offset = block_offset;
}
}

View File

@ -1,21 +1,20 @@
#include "layout.h"
#include "../vgmstream.h"
/* a simple headerless block with padding; configured in the main header */
void block_update_rws(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
size_t block_size;
size_t interleave;
/* no header; size is configured in the main header */
block_size = vgmstream->full_block_size;
interleave = vgmstream->interleave_block_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset
+ block_size;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = block_offset + interleave*i;
}
}
#include "layout.h"
#include "../vgmstream.h"
/* a simple headerless block with padding; configured in the main header */
void block_update_rws(off_t block_offset, VGMSTREAM* vgmstream) {
int i;
size_t block_size;
size_t interleave;
/* no header; size is configured in the main header */
block_size = vgmstream->full_block_size;
interleave = vgmstream->interleave_block_size;
vgmstream->current_block_offset = block_offset;
vgmstream->next_block_offset = block_offset + block_size;
for (i = 0; i < vgmstream->channels; i++) {
vgmstream->ch[i].offset = block_offset + interleave * i;
}
}