Cleanup and logs

This commit is contained in:
bnnm 2021-09-04 20:31:11 +02:00
parent 0b82366d3d
commit a4fe6a9352
5 changed files with 382 additions and 344 deletions

View File

@ -322,7 +322,7 @@ ffmpeg_codec_data* init_ffmpeg_header_offset_subsong(STREAMFILE* sf, uint8_t* he
goto fail; goto fail;
if (size == 0 || start + size > get_streamfile_size(sf)) { if (size == 0 || start + size > get_streamfile_size(sf)) {
VGM_LOG("FFMPEG: wrong start+size found: %x + %x > %x \n", (uint32_t)start, (uint32_t)size, get_streamfile_size(sf)); vgm_logi(size != 0, "FFMPEG: wrong start+size found: %x + %x > %x \n", (uint32_t)start, (uint32_t)size, get_streamfile_size(sf));
size = get_streamfile_size(sf) - start; size = get_streamfile_size(sf) - start;
} }

View File

@ -2,31 +2,32 @@
#include "../coding/coding.h" #include "../coding/coding.h"
#include "../util.h" #include "../util.h"
static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_total_streams, size_t *out_stream_size, int * out_channel_count, int * out_sample_rate, int * out_num_samples); static int bink_get_info(STREAMFILE* sf, int target_subsong, int* p_total_subsongs, size_t* p_stream_size, int* p_channels, int* p_sample_rate, int* p_num_samples);
/* BINK 1/2 - RAD Game Tools movies (audio/video format) */ /* BINK 1/2 - RAD Game Tools movies (audio/video format) */
VGMSTREAM * init_vgmstream_bik(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_bik(STREAMFILE* sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
int channel_count = 0, loop_flag = 0, sample_rate = 0, num_samples = 0; int channels = 0, loop_flag = 0, sample_rate = 0, num_samples = 0;
int total_subsongs = 0, target_subsong = streamFile->stream_index; int total_subsongs = 0, target_subsong = sf->stream_index;
size_t stream_size; size_t stream_size;
/* checks */ /* checks */
/* .bik/bik2/bk2: standard /* .bik/bik2/bk2: standard
* .bika = fake extension for demuxed audio */ * .bika: fake extension for demuxed audio */
if (!check_extensions(streamFile,"bik,bika,bik2,bk2")) if (!check_extensions(sf,"bik,bik2,bk2,bika"))
goto fail; goto fail;
/* check header "BIK" (bink 1) or "KB2" (bink 2), followed by version-char (audio is the same for both) */ /* check bink1/2 header, followed by version-char (audio is the same) */
if ((read_32bitBE(0x00,streamFile) & 0xffffff00) != 0x42494B00 && if ((read_32bitBE(0x00,sf) & 0xffffff00) != get_id32be("BIK\0") &&
(read_32bitBE(0x00,streamFile) & 0xffffff00) != 0x4B423200 ) goto fail; (read_32bitBE(0x00,sf) & 0xffffff00) != get_id32be("KB2\0"))
goto fail;
/* find target stream info and samples */ /* find target stream info and samples */
if (!bink_get_info(streamFile, target_subsong, &total_subsongs, &stream_size, &channel_count, &sample_rate, &num_samples)) if (!bink_get_info(sf, target_subsong, &total_subsongs, &stream_size, &channels, &sample_rate, &num_samples))
goto fail; goto fail;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag); vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
@ -39,8 +40,7 @@ VGMSTREAM * init_vgmstream_bik(STREAMFILE *streamFile) {
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
{ {
/* target_subsong should be passed manually */ /* target_subsong should be passed manually */
vgmstream->codec_data = init_ffmpeg_header_offset_subsong(sf, NULL,0, 0x0,0, target_subsong);
vgmstream->codec_data = init_ffmpeg_header_offset_subsong(streamFile, NULL,0, 0x0,get_streamfile_size(streamFile), target_subsong);
if (!vgmstream->codec_data) goto fail; if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg; vgmstream->coding_type = coding_FFmpeg;
} }
@ -60,28 +60,35 @@ fail:
* as they are not in the main header. The header for BINK1 and 2 is the same. * as they are not in the main header. The header for BINK1 and 2 is the same.
* (a ~3 min movie needs ~6000-7000 frames = fseeks, should be fast enough) * (a ~3 min movie needs ~6000-7000 frames = fseeks, should be fast enough)
*/ */
static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_total_subsongs, size_t * out_stream_size, int * out_channel_count, int * out_sample_rate, int * out_num_samples) { static int bink_get_info(STREAMFILE* sf, int target_subsong, int* p_total_subsongs, size_t* p_stream_size, int* p_channels, int* p_sample_rate, int* p_num_samples) {
uint32_t *offsets = NULL; uint32_t* offsets = NULL;
uint32_t num_frames, num_samples_b = 0; uint32_t num_frames, num_samples_b = 0;
off_t cur_offset; off_t cur_offset;
int i, j, sample_rate, channel_count; int i, j, sample_rate, channels;
int total_subsongs; int total_subsongs;
size_t stream_size = 0; size_t stream_size = 0;
size_t filesize = get_streamfile_size(streamFile); size_t filesize = get_streamfile_size(sf);
uint32_t signature = (read_32bitBE(0x00,streamFile) & 0xffffff00); uint32_t signature = (read_32bitBE(0x00,sf) & 0xffffff00);
uint8_t revision = (read_32bitBE(0x00,streamFile) & 0xFF); uint8_t revision = (read_32bitBE(0x00,sf) & 0xFF);
if (read_32bitLE(0x04,streamFile)+ 0x08 != filesize)
if (read_32bitLE(0x04,sf) + 0x08 != filesize)
goto fail; goto fail;
num_frames = (uint32_t)read_32bitLE(0x08,streamFile); num_frames = (uint32_t)read_32bitLE(0x08,sf);
if (num_frames == 0 || num_frames > 0x100000) goto fail; /* something must be off (avoids big allocs below) */ if (num_frames == 0 || num_frames > 0x100000) goto fail; /* something must be off (avoids big allocs below) */
/* multichannel/multilanguage audio is usually N streams of stereo/mono, no way to know channel layout */ /* multichannel/multilanguage audio is usually N streams of stereo/mono, no way to know channel layout */
total_subsongs = read_32bitLE(0x28,streamFile); total_subsongs = read_32bitLE(0x28,sf);
if (total_subsongs < 1) {
vgm_logi("BIK: no audio in movie (ignore)\n");
goto fail;
}
if (target_subsong == 0) target_subsong = 1; if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1 || total_subsongs > 255) goto fail; if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs > 255) goto fail;
/* find stream info and position in offset table */ /* find stream info and position in offset table */
cur_offset = 0x2c; cur_offset = 0x2c;
@ -89,8 +96,8 @@ static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_t
(signature == 0x4B423200 && (revision == 0x69 || revision == 0x6a || revision == 0x6b))) /* i,j,k */ (signature == 0x4B423200 && (revision == 0x69 || revision == 0x6a || revision == 0x6b))) /* i,j,k */
cur_offset += 0x04; /* unknown v2 header field */ cur_offset += 0x04; /* unknown v2 header field */
cur_offset += 0x04*total_subsongs; /* skip streams max packet bytes */ cur_offset += 0x04*total_subsongs; /* skip streams max packet bytes */
sample_rate = (uint16_t)read_16bitLE(cur_offset+0x04*(target_subsong-1)+0x00,streamFile); sample_rate = (uint16_t)read_16bitLE(cur_offset+0x04*(target_subsong-1)+0x00,sf);
channel_count = (uint16_t)read_16bitLE(cur_offset+0x04*(target_subsong-1)+0x02,streamFile) & 0x2000 ? 2 : 1; /* stereo flag */ channels = (uint16_t)read_16bitLE(cur_offset+0x04*(target_subsong-1)+0x02,sf) & 0x2000 ? 2 : 1; /* stereo flag */
cur_offset += 0x04*total_subsongs; /* skip streams info */ cur_offset += 0x04*total_subsongs; /* skip streams info */
cur_offset += 0x04*total_subsongs; /* skip streams ids */ cur_offset += 0x04*total_subsongs; /* skip streams ids */
@ -100,13 +107,13 @@ static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_t
if (!offsets) goto fail; if (!offsets) goto fail;
for (i=0; i < num_frames; i++) { for (i=0; i < num_frames; i++) {
offsets[i] = read_32bitLE(cur_offset,streamFile) & 0xFFFFFFFE; /* mask first bit (= keyframe) */ offsets[i] = read_32bitLE(cur_offset,sf) & 0xFFFFFFFE; /* mask first bit (= keyframe) */
cur_offset += 0x4; cur_offset += 0x4;
if (offsets[i] > filesize) goto fail; if (offsets[i] > filesize) goto fail;
} }
/* after the last index is the file size, validate just in case */ /* after the last index is the file size, validate just in case */
if (read_32bitLE(cur_offset,streamFile) != filesize) goto fail; if (read_32bitLE(cur_offset,sf) != filesize) goto fail;
/* read each frame header and sum all samples /* read each frame header and sum all samples
* a frame has N audio packets with a header (one per stream) + video packet */ * a frame has N audio packets with a header (one per stream) + video packet */
@ -115,12 +122,12 @@ static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_t
/* read audio packet headers per stream */ /* read audio packet headers per stream */
for (j=0; j < total_subsongs; j++) { for (j=0; j < total_subsongs; j++) {
uint32_t ap_size = read_32bitLE(cur_offset+0x00,streamFile); /* not counting this int */ uint32_t ap_size = read_32bitLE(cur_offset+0x00,sf); /* not counting this int */
if (j == target_subsong-1) { if (j == target_subsong-1) {
stream_size += 0x04 + ap_size; stream_size += 0x04 + ap_size;
if (ap_size > 0) if (ap_size > 0)
num_samples_b += read_32bitLE(cur_offset+0x04,streamFile); /* decoded samples in bytes */ num_samples_b += read_32bitLE(cur_offset+0x04,sf); /* decoded samples in bytes */
break; /* next frame */ break; /* next frame */
} }
else { /* next stream packet or frame */ else { /* next stream packet or frame */
@ -132,12 +139,12 @@ static int bink_get_info(STREAMFILE *streamFile, int target_subsong, int * out_t
free(offsets); free(offsets);
if (out_total_subsongs) *out_total_subsongs = total_subsongs; if (p_total_subsongs) *p_total_subsongs = total_subsongs;
if (out_stream_size) *out_stream_size = stream_size; if (p_stream_size) *p_stream_size = stream_size;
if (out_sample_rate) *out_sample_rate = sample_rate; if (p_sample_rate) *p_sample_rate = sample_rate;
if (out_channel_count) *out_channel_count = channel_count; if (p_channels) *p_channels = channels;
//todo returns a few more samples (~48) than binkconv.exe? //todo returns a few more samples (~48) than binkconv.exe?
if (out_num_samples) *out_num_samples = num_samples_b / (2 * channel_count); if (p_num_samples) *p_num_samples = num_samples_b / (2 * channels);
return 1; return 1;

View File

@ -1,5 +1,6 @@
#include "meta.h" #include "meta.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include "../util/chunks.h"
/* BKHD - Wwise soundbank container */ /* BKHD - Wwise soundbank container */
@ -19,9 +20,9 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
if (!check_extensions(sf,"bnk")) if (!check_extensions(sf,"bnk"))
goto fail; goto fail;
if (read_u32be(0x00, sf) == 0x414B424B) /* "AKBK" [Shadowrun (X360)] */ if (is_id32be(0x00, sf, "AKBK")) /* [Shadowrun (X360)] */
base_offset = 0x0c; base_offset = 0x0c;
if (read_u32be(base_offset + 0x00, sf) != 0x424B4844) /* "BKHD" */ if (!is_id32be(base_offset + 0x00, sf, "BKHD"))
goto fail; goto fail;
big_endian = guess_endianness32bit(base_offset + 0x04, sf); big_endian = guess_endianness32bit(base_offset + 0x04, sf);
read_u32 = big_endian ? read_u32be : read_u32le; read_u32 = big_endian ? read_u32be : read_u32le;
@ -77,16 +78,41 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
subfile_size = read_u32(offset + 0x14, sf); subfile_size = read_u32(offset + 0x14, sf);
} }
else { else {
off_t didx_offset, data_offset, offset; enum {
size_t didx_size; CHUNK_DIDX = 0x44494458, /* "DIDX" */
if (!find_chunk(sf, 0x44494458, 0x00,0, &didx_offset, &didx_size, big_endian, 0)) /* "DIDX" */ CHUNK_DATA = 0x44415441, /* "DATA" */
goto fail; };
if (!find_chunk(sf, 0x44415441, 0x00,0, &data_offset, NULL, big_endian, 0)) /* "DATA" */ off_t didx_offset = 0, data_offset = 0, didx_size = 0, offset;
chunk_t rc = {0};
rc.be_size = big_endian;
rc.current = 0x00;
while (next_chunk(&rc, sf)) {
switch(rc.type) {
case CHUNK_DIDX:
didx_offset = rc.offset;
didx_size = rc.size;
break;
case CHUNK_DATA:
data_offset = rc.offset;
break;
default:
break;
}
}
if (!didx_offset || !data_offset)
goto fail; goto fail;
total_subsongs = didx_size / 0x0c; total_subsongs = didx_size / 0x0c;
if (total_subsongs < 1) {
vgm_logi("BKHD: bank has no subsongs (ignore)\n");
goto fail;
}
if (target_subsong == 0) target_subsong = 1; if (target_subsong == 0) target_subsong = 1;
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail; if (target_subsong > total_subsongs) goto fail;
offset = didx_offset + (target_subsong - 1) * 0x0c; offset = didx_offset + (target_subsong - 1) * 0x0c;
subfile_id = read_u32(offset + 0x00, sf); subfile_id = read_u32(offset + 0x00, sf);

View File

@ -2,46 +2,47 @@
#include "../coding/coding.h" #include "../coding/coding.h"
#include "../util.h" #include "../util.h"
static int smacker_get_info(STREAMFILE *streamFile, int target_subsong, int * out_total_streams, size_t *out_stream_size, int * out_channel_count, int * out_sample_rate, int * out_num_samples); static int smacker_get_info(STREAMFILE* sf, int target_subsong, int* p_total_subsongs, size_t* p_stream_size, int* p_channels, int* p_sample_rate, int* p_num_samples);
/* SMK - RAD Game Tools Smacker movies (audio/video format) */ /* SMK - RAD Game Tools older Smacker movies (audio/video format) */
VGMSTREAM * init_vgmstream_smk(STREAMFILE *streamFile) { VGMSTREAM* init_vgmstream_smk(STREAMFILE *sf) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM* vgmstream = NULL;
int channel_count = 0, loop_flag = 0, sample_rate = 0, num_samples = 0; int channels = 0, loop_flag = 0, sample_rate = 0, num_samples = 0;
int total_subsongs = 0, target_subsong = streamFile->stream_index; int total_subsongs = 0, target_subsong = sf->stream_index;
size_t stream_size; size_t stream_size;
/* checks */ /* checks */
if (!check_extensions(streamFile,"smk")) if (!check_extensions(sf,"smk"))
goto fail; goto fail;
if (read_32bitBE(0x00,streamFile) != 0x534D4B32 && /* "SMK2" */ if (!is_id32be(0x00,sf, "SMK2") &&
read_32bitBE(0x00,streamFile) != 0x534D4B34) /* "SMK4" */ !is_id32be(0x00,sf, "SMK4"))
goto fail; goto fail;
/* find target stream info */ /* find target stream info */
if (!smacker_get_info(streamFile, target_subsong, &total_subsongs, &stream_size, &channel_count, &sample_rate, &num_samples)) if (!smacker_get_info(sf, target_subsong, &total_subsongs, &stream_size, &channels, &sample_rate, &num_samples))
goto fail; goto fail;
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag); vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
vgmstream->layout_type = layout_none; vgmstream->meta_type = meta_SMACKER;
vgmstream->sample_rate = sample_rate; vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = num_samples; vgmstream->num_samples = num_samples;
vgmstream->num_streams = total_subsongs; vgmstream->num_streams = total_subsongs;
vgmstream->stream_size = stream_size; vgmstream->stream_size = stream_size;
vgmstream->meta_type = meta_SMACKER;
{ {
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
/* target_subsong should be passed manually */ /* target_subsong should be passed manually */
vgmstream->codec_data = init_ffmpeg_header_offset_subsong(streamFile, NULL,0, 0x0,get_streamfile_size(streamFile), target_subsong); vgmstream->codec_data = init_ffmpeg_header_offset_subsong(sf, NULL,0, 0x00, 0, target_subsong);
if (!vgmstream->codec_data) goto fail; if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg; vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
#else #else
goto fail; goto fail;
#endif #endif
@ -68,11 +69,11 @@ typedef enum {
//todo test multilang streams and codecs other than SMACKAUD //todo test multilang streams and codecs other than SMACKAUD
/* Gets stream info, and number of samples in a file by reading frames /* Gets stream info, and number of samples in a file by reading frames
* info: https://wiki.multimedia.cx/index.php/Smacker */ * info: https://wiki.multimedia.cx/index.php/Smacker */
static int smacker_get_info(STREAMFILE *sf, int target_subsong, int * out_total_subsongs, size_t * out_stream_size, int * out_channel_count, int * out_sample_rate, int * out_num_samples) { static int smacker_get_info(STREAMFILE* sf, int target_subsong, int* out_total_subsongs, size_t* p_stream_size, int* p_channels, int* p_sample_rate, int* p_num_samples) {
STREAMFILE *sf_index = NULL; STREAMFILE* sf_index = NULL;
uint32_t flags, total_frames, trees_sizes; uint32_t flags, total_frames, trees_sizes;
off_t size_offset, type_offset, data_offset; off_t size_offset, type_offset, data_offset;
int i, j, sample_rate = 0, channel_count = 0, num_samples = 0; int i, j, sample_rate = 0, channels = 0, num_samples = 0;
int total_subsongs, target_stream = 0; int total_subsongs, target_stream = 0;
size_t stream_size = 0; size_t stream_size = 0;
uint8_t stream_flags = 0; uint8_t stream_flags = 0;
@ -109,13 +110,17 @@ static int smacker_get_info(STREAMFILE *sf, int target_subsong, int * out_total_
if (target_subsong == total_subsongs) { if (target_subsong == total_subsongs) {
target_stream = i; target_stream = i;
sample_rate = audio_rate & 0x00FFFFFF; sample_rate = audio_rate & 0x00FFFFFF;
channel_count = (audio_flags & SMK_AUDIO_STEREO) ? 2 : 1; channels = (audio_flags & SMK_AUDIO_STEREO) ? 2 : 1;
stream_flags = audio_flags; stream_flags = audio_flags;
} }
} }
} }
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail; if (total_subsongs < 1) {
if (sample_rate == 0 || channel_count == 0) goto fail; vgm_logi("SMK: no audio in movie (ignore)\n");
goto fail;
}
if (target_subsong < 0 || target_subsong > total_subsongs) goto fail;
if (sample_rate == 0 || channels == 0) goto fail;
/* read size and type tables into buffer */ /* read size and type tables into buffer */
sf_index = reopen_streamfile(sf, total_frames*0x04 + total_frames*0x01); sf_index = reopen_streamfile(sf, total_frames*0x04 + total_frames*0x01);
@ -125,7 +130,7 @@ static int smacker_get_info(STREAMFILE *sf, int target_subsong, int * out_total_
size_offset = 0x68; size_offset = 0x68;
type_offset = size_offset + total_frames*0x04; type_offset = size_offset + total_frames*0x04;
data_offset = type_offset + total_frames*0x01 + trees_sizes; data_offset = type_offset + total_frames*0x01 + trees_sizes;
for (i=0; i < total_frames; i++) { for (i = 0; i < total_frames; i++) {
uint32_t frame_size = read_u32le(size_offset,sf_index) & 0xFFFFFFFC; /* last 2 bits are keyframe flags */ uint32_t frame_size = read_u32le(size_offset,sf_index) & 0xFFFFFFFC; /* last 2 bits are keyframe flags */
uint8_t frame_type = read_u8 (type_offset,sf_index); /* 0: has palette, 1..7: has stream N) */ uint8_t frame_type = read_u8 (type_offset,sf_index); /* 0: has palette, 1..7: has stream N) */
off_t offset = data_offset; off_t offset = data_offset;
@ -151,13 +156,13 @@ static int smacker_get_info(STREAMFILE *sf, int target_subsong, int * out_total_
/* resulting PCM bytes to samples */ /* resulting PCM bytes to samples */
if (stream_flags & SMK_AUDIO_PACKED) { /* Smacker and maybe Bink codecs */ if (stream_flags & SMK_AUDIO_PACKED) { /* Smacker and maybe Bink codecs */
uint32_t unpacked_size = read_u32le(offset+0x04,sf); uint32_t unpacked_size = read_u32le(offset+0x04,sf);
num_samples += unpacked_size / (0x02 * channel_count); num_samples += unpacked_size / (0x02 * channels);
} }
else if (stream_flags & SMK_AUDIO_16BITS) { /* PCM16 */ else if (stream_flags & SMK_AUDIO_16BITS) { /* PCM16 */
num_samples += (audio_size - 0x04) / (0x02 * channel_count); num_samples += (audio_size - 0x04) / (0x02 * channels);
} }
else { /* PCM8 */ else { /* PCM8 */
num_samples += (audio_size - 0x04) / (0x01 * channel_count); num_samples += (audio_size - 0x04) / (0x01 * channels);
} }
} }
@ -173,10 +178,10 @@ static int smacker_get_info(STREAMFILE *sf, int target_subsong, int * out_total_
} }
if (out_total_subsongs) *out_total_subsongs = total_subsongs; if (out_total_subsongs) *out_total_subsongs = total_subsongs;
if (out_stream_size) *out_stream_size = stream_size; if (p_stream_size) *p_stream_size = stream_size;
if (out_sample_rate) *out_sample_rate = sample_rate; if (p_sample_rate) *p_sample_rate = sample_rate;
if (out_channel_count) *out_channel_count = channel_count; if (p_channels) *p_channels = channels;
if (out_num_samples) *out_num_samples = num_samples; if (p_num_samples) *p_num_samples = num_samples;
close_streamfile(sf_index); close_streamfile(sf_index);
return 1; return 1;

View File

@ -518,7 +518,7 @@ static void seek_force_loop(VGMSTREAM* vgmstream, int loop_count) {
return; return;
/* pretend decoder reached loop end so state is set to loop start */ /* pretend decoder reached loop end so state is set to loop start */
vgmstream->loop_count = loop_count - 1; /* seeking to first loop musy become ++ > 0 */ vgmstream->loop_count = loop_count - 1; /* seeking to first loop must become ++ > 0 */
vgmstream->current_sample = vgmstream->loop_end_sample; vgmstream->current_sample = vgmstream->loop_end_sample;
vgmstream_do_loop(vgmstream); vgmstream_do_loop(vgmstream);
} }