mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 16:30:54 +01:00
Use standard buffer size for all metas
There is not no real about having small-ish buffers, simplifies buffer tuning, and avoids having gigantic buffers on bad reads.
This commit is contained in:
parent
a5656eaa2f
commit
f6417c5430
@ -46,7 +46,7 @@ VGMSTREAM * init_vgmstream_afc(STREAMFILE *streamFile) {
|
||||
int i;
|
||||
|
||||
/* both channels use same buffer, as interleave is so small */
|
||||
chstreamfile = streamFile->open(streamFile,filename,9*channel_count*0x100);
|
||||
chstreamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!chstreamfile) goto fail;
|
||||
|
||||
for (i=0;i<channel_count;i++) {
|
||||
|
@ -108,8 +108,7 @@ VGMSTREAM * init_vgmstream_aix(STREAMFILE *streamFile) {
|
||||
}
|
||||
}
|
||||
|
||||
/*streamFileAIX = streamFile->open(streamFile,filename,sample_rate*0.0375*2/32*18segment_count);*/
|
||||
streamFileAIX = streamFile->open(streamFile,filename,sample_rate*0.1*segment_count);
|
||||
streamFileAIX = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!streamFileAIX) goto fail;
|
||||
|
||||
data = malloc(sizeof(aix_codec_data));
|
||||
|
@ -12,7 +12,6 @@ VGMSTREAM * init_vgmstream_ast(STREAMFILE *streamFile) {
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
|
||||
size_t max_block;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
@ -33,7 +32,7 @@ VGMSTREAM * init_vgmstream_ast(STREAMFILE *streamFile) {
|
||||
codec_number = read_16bitBE(8,streamFile);
|
||||
loop_flag = read_16bitBE(0xe,streamFile);
|
||||
channel_count = read_16bitBE(0xc,streamFile);
|
||||
max_block = read_32bitBE(0x20,streamFile);
|
||||
/*max_block = read_32bitBE(0x20,streamFile);*/
|
||||
|
||||
switch (codec_number) {
|
||||
case 0:
|
||||
@ -66,14 +65,7 @@ VGMSTREAM * init_vgmstream_ast(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
|
||||
(i==0?
|
||||
max_block+0x20-4: /* first buffer a bit bigger to
|
||||
read block header without
|
||||
inefficiency */
|
||||
max_block
|
||||
)
|
||||
);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ VGMSTREAM * init_vgmstream_cstr(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<2;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,interleave);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -98,7 +98,7 @@ VGMSTREAM * init_vgmstream_dc_dcsw_dcs(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
|
@ -42,7 +42,7 @@ VGMSTREAM * init_vgmstream_dsp_bdsp(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
|
@ -148,7 +148,7 @@ VGMSTREAM * init_vgmstream_eb_sf0(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -43,7 +43,7 @@ VGMSTREAM * init_vgmstream_gcsw(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -14,8 +14,6 @@ VGMSTREAM * init_vgmstream_halpst(STREAMFILE *streamFile) {
|
||||
int32_t samples_l,samples_r;
|
||||
int32_t start_sample = 0;
|
||||
|
||||
size_t max_block;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("hps",filename_extension(filename))) goto fail;
|
||||
@ -27,7 +25,7 @@ VGMSTREAM * init_vgmstream_halpst(STREAMFILE *streamFile) {
|
||||
|
||||
/* details */
|
||||
channel_count = read_32bitBE(0xc,streamFile);
|
||||
max_block = read_32bitBE(0x10,streamFile)/channel_count;
|
||||
/*max_block = read_32bitBE(0x10,streamFile)/channel_count;*/
|
||||
|
||||
if (channel_count > 2) {
|
||||
/* align the header length needed for the extra channels */
|
||||
@ -106,14 +104,7 @@ VGMSTREAM * init_vgmstream_halpst(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
|
||||
(i==0?
|
||||
max_block+0x20: /* first buffer a bit bigger to
|
||||
read block header without
|
||||
inefficiency */
|
||||
max_block
|
||||
)
|
||||
);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ VGMSTREAM * init_vgmstream_ngc_sck_dsp(STREAMFILE *streamFile) {
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
/* Not sure, i'll put a fake value here for now */
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFileDSP,filenameDSP,0x8000);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFileDSP,filenameDSP,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
vgmstream->ch[i].offset = 0;
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
@ -74,8 +74,7 @@ VGMSTREAM * init_vgmstream_pc_smp(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,
|
||||
channel_count*interleave*2);
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
|
||||
for (i=0;i<channel_count;i++) {
|
||||
|
@ -73,7 +73,7 @@ VGMSTREAM * init_vgmstream_ps2_gbts(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -50,7 +50,7 @@ VGMSTREAM * init_vgmstream_ps2_ild(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -56,7 +56,7 @@ VGMSTREAM * init_vgmstream_ps2_mic(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -79,7 +79,7 @@ VGMSTREAM * init_vgmstream_ps2_mtaf(STREAMFILE *streamFile) {
|
||||
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
for (i = 0; i < channel_count; i++) {
|
||||
STREAMFILE * file = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
STREAMFILE * file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
vgmstream->ch[i].channel_start_offset = vgmstream->ch[i].offset = start_offset + vgmstream->interleave_block_size*2*(i/2);
|
||||
|
@ -51,7 +51,7 @@ VGMSTREAM * init_vgmstream_ps2_p2bt(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -47,7 +47,7 @@ VGMSTREAM * init_vgmstream_ps2_pnb(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -82,7 +82,7 @@ VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE *streamFile)
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -57,7 +57,7 @@ VGMSTREAM * init_vgmstream_psx_gms(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -365,8 +365,7 @@ VGMSTREAM * init_vgmstream_rwsd(STREAMFILE *streamFile) {
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,
|
||||
0x1000);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
||||
|
@ -76,7 +76,7 @@ VGMSTREAM * init_vgmstream_spt_spd(STREAMFILE *streamFile) {
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
/* Not sure, i'll put a fake value here for now */
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
vgmstream->ch[i].offset = 0;
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ VGMSTREAM * init_vgmstream_stx(STREAMFILE *streamFile) {
|
||||
int i;
|
||||
|
||||
/* both channels use same buffer, as interleave is so small */
|
||||
chstreamfile = streamFile->open(streamFile,filename,9*channel_count*0x100);
|
||||
chstreamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!chstreamfile) goto fail;
|
||||
|
||||
for (i=0;i<channel_count;i++) {
|
||||
|
@ -49,7 +49,7 @@ VGMSTREAM * init_vgmstream_vs(STREAMFILE *streamFile) {
|
||||
/* open the file for reading */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x2000);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ VGMSTREAM * init_vgmstream_wii_mus(STREAMFILE *streamFile) {
|
||||
vgmstream->ch[1].adpcm_history1_16 = channel[1].initial_hist1;
|
||||
vgmstream->ch[1].adpcm_history2_16 = channel[1].initial_hist2;
|
||||
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,interleave);
|
||||
vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[0].streamfile) goto fail;
|
||||
vgmstream->ch[1].streamfile = streamFile->open(streamFile,filename,interleave);
|
||||
vgmstream->ch[1].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[1].streamfile) goto fail;
|
||||
|
||||
/* open the file for reading */
|
||||
|
@ -71,7 +71,7 @@ VGMSTREAM * init_vgmstream_wii_sts(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
vgmstream->ch[i].offset = 0x50+(i*(start_offset+0x26-0x50));
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
|
@ -45,7 +45,7 @@ VGMSTREAM * init_vgmstream_x360_tra(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ VGMSTREAM * init_vgmstream_xbox_matx(STREAMFILE *streamFile) {
|
||||
/* open the file for reading by each channel */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user