From 842c064b3b7cb518160bb1e3dabc406384557d9f Mon Sep 17 00:00:00 2001 From: manakoat Date: Wed, 23 Apr 2014 21:36:06 -0700 Subject: [PATCH] FSB5, added ADPCM and PCM16 coding, 4 of 15 formats supported now --- src/meta/fsb5.c | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/src/meta/fsb5.c b/src/meta/fsb5.c index 44d1514f..0d2214e8 100644 --- a/src/meta/fsb5.c +++ b/src/meta/fsb5.c @@ -120,7 +120,19 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) { case 0x02: /* FMOD_SOUND_FORMAT_PCM16 */ { - goto fail; + + NumSamples = read_32bitLE(SampleHeaderStart+0x04,streamFile)/4; + + if (ChannelCount == 1) + { + vgmstream->layout_type = layout_none; + } else { + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x02; + } + + + vgmstream->coding_type = coding_PCM16LE; } break; @@ -171,7 +183,11 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) { case 0x07: /* FMOD_SOUND_FORMAT_IMAADPCM */ { - goto fail; + + NumSamples = read_32bitLE(SampleHeaderStart+0x04,streamFile)/4; + vgmstream->layout_type = layout_none; + vgmstream->coding_type = coding_XBOX; + } break; @@ -257,14 +273,24 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) { /* open the file for reading */ { - int i; - STREAMFILE * file; - file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); - if (!file) goto fail; - for (i=0;ich[i].streamfile = file; - vgmstream->ch[i].channel_start_offset=vgmstream->ch[i].offset=StartOffset+vgmstream->interleave_block_size*i; - } + int i; + STREAMFILE * file; + file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); + if (!file) goto fail; + for (i=0;ich[i].streamfile = file; + + + if (vgmstream->coding_type == coding_XBOX) { + /* xbox interleaving is a little odd */ + vgmstream->ch[i].channel_start_offset=StartOffset; + } else { + vgmstream->ch[i].channel_start_offset= + StartOffset+vgmstream->interleave_block_size*i; + } + vgmstream->ch[i].offset = vgmstream->ch[i].channel_start_offset; + + } } return vgmstream;