diff --git a/src/coding/atrac9_decoder.c b/src/coding/atrac9_decoder.c index a5ef1846..16f11e46 100644 --- a/src/coding/atrac9_decoder.c +++ b/src/coding/atrac9_decoder.c @@ -207,6 +207,7 @@ fail: 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) { static const int sample_rate_table[16] = { 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: return 0; } - +#endif #endif diff --git a/src/coding/coding.h b/src/coding/coding.h index 11e62042..9614acb4 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -244,7 +244,7 @@ void reset_atrac9(VGMSTREAM *vgmstream); void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample); void free_atrac9(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 #ifdef VGM_USE_CELT diff --git a/src/meta/bnk_sony.c b/src/meta/bnk_sony.c index 387a9bd5..f6c7a595 100644 --- a/src/meta/bnk_sony.c +++ b/src/meta/bnk_sony.c @@ -229,22 +229,22 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) { extradata_size = 0x08 + read_32bit(start_offset+0x04,streamFile); /* 0x14 for AT9 */ switch(type) { -#ifdef VGM_USE_ATRAC9 - case 0x02: /* ATRAC9 mono? */ - case 0x05: /* ATRAC9 stereo? */ + case 0x02: /* ATRAC9 mono */ + case 0x05: /* ATRAC9 stereo */ if (read_32bit(start_offset+0x08,streamFile) + 0x08 != extradata_size) /* repeat? */ goto fail; + sample_rate = 48000; /* seems ok */ + channel_count = (type == 0x02) ? 1 : 2; + atrac9_info = (uint32_t)read_32bitBE(start_offset+0x0c,streamFile); /* 0x10: null? */ loop_length = read_32bit(start_offset+0x14,streamFile); loop_start = read_32bit(start_offset+0x18,streamFile); 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; break; -#endif + default: VGM_LOG("BNK: unknown type %x\n", type); goto fail; @@ -259,32 +259,32 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) { /* 0x0c: null? */ switch(type) { -#ifdef VGM_USE_ATRAC9 - case 0x02: /* ATRAC9 mono? */ - case 0x05: /* ATRAC9 stereo? */ + case 0x02: /* ATRAC9 mono */ + case 0x05: /* ATRAC9 stereo */ if (read_32bit(start_offset+0x10,streamFile) + 0x10 != extradata_size) /* repeat? */ goto fail; + sample_rate = 48000; /* seems ok */ + channel_count = (type == 0x02) ? 1 : 2; + atrac9_info = (uint32_t)read_32bitBE(start_offset+0x14,streamFile); /* 0x18: null? */ /* 0x1c: channels? */ /* 0x20: null? */ - interleave = 0x02; loop_length = read_32bit(start_offset+0x24,streamFile); loop_start = read_32bit(start_offset+0x28,streamFile); 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; break; -#endif + case 0x01: /* PCM16LE mono? (NekoBuro/Polara sfx) */ case 0x04: /* PCM16LE stereo? (NekoBuro/Polara sfx) */ sample_rate = 48000; /* seems ok */ /* 0x10: null? */ channel_count = read_32bit(start_offset+0x14,streamFile); interleave = 0x02; + loop_start = read_32bit(start_offset+0x18,streamFile); loop_length = read_32bit(start_offset+0x1c,streamFile); loop_end = loop_start + loop_length; /* loop_start is -1 if not set */