Remove usage of atrac9_parse_config

This commit is contained in:
bnnm 2018-08-25 18:03:58 +02:00
parent a734e9c5cb
commit 3765831dbe
3 changed files with 16 additions and 15 deletions

View File

@ -207,6 +207,7 @@ fail:
return 0; return 0;
} }
#if 0 //not needed (for now)
int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size) { int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size) {
static const int sample_rate_table[16] = { static const int sample_rate_table[16] = {
11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000,
@ -237,5 +238,5 @@ int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_c
fail: fail:
return 0; return 0;
} }
#endif
#endif #endif

View File

@ -244,7 +244,7 @@ void reset_atrac9(VGMSTREAM *vgmstream);
void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample); void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample);
void free_atrac9(atrac9_codec_data *data); void free_atrac9(atrac9_codec_data *data);
size_t atrac9_bytes_to_samples(size_t bytes, atrac9_codec_data *data); size_t atrac9_bytes_to_samples(size_t bytes, atrac9_codec_data *data);
int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size); //int atrac9_parse_config(uint32_t atrac9_config, int *out_sample_rate, int *out_channels, size_t *out_frame_size);
#endif #endif
#ifdef VGM_USE_CELT #ifdef VGM_USE_CELT

View File

@ -229,22 +229,22 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) {
extradata_size = 0x08 + read_32bit(start_offset+0x04,streamFile); /* 0x14 for AT9 */ extradata_size = 0x08 + read_32bit(start_offset+0x04,streamFile); /* 0x14 for AT9 */
switch(type) { switch(type) {
#ifdef VGM_USE_ATRAC9 case 0x02: /* ATRAC9 mono */
case 0x02: /* ATRAC9 mono? */ case 0x05: /* ATRAC9 stereo */
case 0x05: /* ATRAC9 stereo? */
if (read_32bit(start_offset+0x08,streamFile) + 0x08 != extradata_size) /* repeat? */ if (read_32bit(start_offset+0x08,streamFile) + 0x08 != extradata_size) /* repeat? */
goto fail; goto fail;
sample_rate = 48000; /* seems ok */
channel_count = (type == 0x02) ? 1 : 2;
atrac9_info = (uint32_t)read_32bitBE(start_offset+0x0c,streamFile); atrac9_info = (uint32_t)read_32bitBE(start_offset+0x0c,streamFile);
/* 0x10: null? */ /* 0x10: null? */
loop_length = read_32bit(start_offset+0x14,streamFile); loop_length = read_32bit(start_offset+0x14,streamFile);
loop_start = read_32bit(start_offset+0x18,streamFile); loop_start = read_32bit(start_offset+0x18,streamFile);
loop_end = loop_start + loop_length; /* loop_start is -1 if not set */ loop_end = loop_start + loop_length; /* loop_start is -1 if not set */
/* get from AT9 config just in case, but probably: sr=48000 / codec 0x02=1ch, 0x05=2ch */
atrac9_parse_config(atrac9_info, &sample_rate, &channel_count, NULL);
codec = ATRAC9; codec = ATRAC9;
break; break;
#endif
default: default:
VGM_LOG("BNK: unknown type %x\n", type); VGM_LOG("BNK: unknown type %x\n", type);
goto fail; goto fail;
@ -259,32 +259,32 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) {
/* 0x0c: null? */ /* 0x0c: null? */
switch(type) { switch(type) {
#ifdef VGM_USE_ATRAC9 case 0x02: /* ATRAC9 mono */
case 0x02: /* ATRAC9 mono? */ case 0x05: /* ATRAC9 stereo */
case 0x05: /* ATRAC9 stereo? */
if (read_32bit(start_offset+0x10,streamFile) + 0x10 != extradata_size) /* repeat? */ if (read_32bit(start_offset+0x10,streamFile) + 0x10 != extradata_size) /* repeat? */
goto fail; goto fail;
sample_rate = 48000; /* seems ok */
channel_count = (type == 0x02) ? 1 : 2;
atrac9_info = (uint32_t)read_32bitBE(start_offset+0x14,streamFile); atrac9_info = (uint32_t)read_32bitBE(start_offset+0x14,streamFile);
/* 0x18: null? */ /* 0x18: null? */
/* 0x1c: channels? */ /* 0x1c: channels? */
/* 0x20: null? */ /* 0x20: null? */
interleave = 0x02;
loop_length = read_32bit(start_offset+0x24,streamFile); loop_length = read_32bit(start_offset+0x24,streamFile);
loop_start = read_32bit(start_offset+0x28,streamFile); loop_start = read_32bit(start_offset+0x28,streamFile);
loop_end = loop_start + loop_length; /* loop_start is -1 if not set */ loop_end = loop_start + loop_length; /* loop_start is -1 if not set */
/* get from AT9 config just in case, but probably: sr=48000 / codec 0x02=1ch, 0x05=2ch */
atrac9_parse_config(atrac9_info, &sample_rate, &channel_count, NULL);
codec = ATRAC9; codec = ATRAC9;
break; break;
#endif
case 0x01: /* PCM16LE mono? (NekoBuro/Polara sfx) */ case 0x01: /* PCM16LE mono? (NekoBuro/Polara sfx) */
case 0x04: /* PCM16LE stereo? (NekoBuro/Polara sfx) */ case 0x04: /* PCM16LE stereo? (NekoBuro/Polara sfx) */
sample_rate = 48000; /* seems ok */ sample_rate = 48000; /* seems ok */
/* 0x10: null? */ /* 0x10: null? */
channel_count = read_32bit(start_offset+0x14,streamFile); channel_count = read_32bit(start_offset+0x14,streamFile);
interleave = 0x02; interleave = 0x02;
loop_start = read_32bit(start_offset+0x18,streamFile); loop_start = read_32bit(start_offset+0x18,streamFile);
loop_length = read_32bit(start_offset+0x1c,streamFile); loop_length = read_32bit(start_offset+0x1c,streamFile);
loop_end = loop_start + loop_length; /* loop_start is -1 if not set */ loop_end = loop_start + loop_length; /* loop_start is -1 if not set */