Updated VGMStream to r1050-499-g3624cb06.

CQTexperiment
Christopher Snowhill 2017-05-16 16:22:47 -07:00
parent 0217d5dee2
commit 473990139d
50 changed files with 1995 additions and 1297 deletions

View File

@ -54,7 +54,6 @@
836F6F2818BDC2190095E648 /* ima_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DEA18BDC2180095E648 /* ima_decoder.c */; };
836F6F2918BDC2190095E648 /* l5_555_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DEB18BDC2180095E648 /* l5_555_decoder.c */; };
836F6F2A18BDC2190095E648 /* lsf_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DEC18BDC2180095E648 /* lsf_decoder.c */; };
836F6F2B18BDC2190095E648 /* Makefile.unix.am in Resources */ = {isa = PBXBuildFile; fileRef = 836F6DED18BDC2180095E648 /* Makefile.unix.am */; };
836F6F2C18BDC2190095E648 /* mp4_aac_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DEE18BDC2180095E648 /* mp4_aac_decoder.c */; };
836F6F2D18BDC2190095E648 /* mpeg_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DEF18BDC2180095E648 /* mpeg_decoder.c */; };
836F6F2E18BDC2190095E648 /* msadpcm_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6DF018BDC2180095E648 /* msadpcm_decoder.c */; };
@ -89,7 +88,6 @@
836F6F4B18BDC2190095E648 /* interleave_byte.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E0E18BDC2180095E648 /* interleave_byte.c */; };
836F6F4C18BDC2190095E648 /* ivaud_layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E0F18BDC2180095E648 /* ivaud_layout.c */; };
836F6F4D18BDC2190095E648 /* layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 836F6E1018BDC2180095E648 /* layout.h */; };
836F6F4E18BDC2190095E648 /* Makefile.unix.am in Resources */ = {isa = PBXBuildFile; fileRef = 836F6E1118BDC2180095E648 /* Makefile.unix.am */; };
836F6F4F18BDC2190095E648 /* mus_acm_layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E1218BDC2180095E648 /* mus_acm_layout.c */; };
836F6F5018BDC2190095E648 /* mxch_blocked.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E1318BDC2180095E648 /* mxch_blocked.c */; };
836F6F5118BDC2190095E648 /* nolayout.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E1418BDC2180095E648 /* nolayout.c */; };
@ -155,7 +153,6 @@
836F6F9418BDC2190095E648 /* ivb.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5818BDC2180095E648 /* ivb.c */; };
836F6F9518BDC2190095E648 /* kraw.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5918BDC2180095E648 /* kraw.c */; };
836F6F9618BDC2190095E648 /* lsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5A18BDC2180095E648 /* lsf.c */; };
836F6F9718BDC2190095E648 /* Makefile.unix.am in Resources */ = {isa = PBXBuildFile; fileRef = 836F6E5B18BDC2180095E648 /* Makefile.unix.am */; };
836F6F9818BDC2190095E648 /* mattel_hyperscan.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */; };
836F6F9918BDC2190095E648 /* maxis_xa.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E5D18BDC2180095E648 /* maxis_xa.c */; };
836F6F9A18BDC2190095E648 /* meta.h in Headers */ = {isa = PBXBuildFile; fileRef = 836F6E5E18BDC2180095E648 /* meta.h */; };
@ -189,7 +186,6 @@
836F6FB618BDC2190095E648 /* ngc_sck_dsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7A18BDC2180095E648 /* ngc_sck_dsp.c */; };
836F6FB718BDC2190095E648 /* ngc_ssm.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7B18BDC2180095E648 /* ngc_ssm.c */; };
836F6FB818BDC2190095E648 /* ngc_tydsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7C18BDC2180095E648 /* ngc_tydsp.c */; };
836F6FB918BDC2190095E648 /* ngc_waa_wac_wad_wam.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7D18BDC2180095E648 /* ngc_waa_wac_wad_wam.c */; };
836F6FBA18BDC2190095E648 /* ngc_ymf.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7E18BDC2180095E648 /* ngc_ymf.c */; };
836F6FBB18BDC2190095E648 /* ngca.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E7F18BDC2180095E648 /* ngca.c */; };
836F6FBD18BDC2190095E648 /* nwa.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6E8118BDC2180095E648 /* nwa.c */; };
@ -238,7 +234,6 @@
836F6FE818BDC2190095E648 /* ps2_mic.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EAC18BDC2180095E648 /* ps2_mic.c */; };
836F6FE918BDC2190095E648 /* ps2_mihb.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EAD18BDC2180095E648 /* ps2_mihb.c */; };
836F6FEA18BDC2190095E648 /* ps2_msa.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EAE18BDC2180095E648 /* ps2_msa.c */; };
836F6FEB18BDC2190095E648 /* ps2_mss.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EAF18BDC2180095E648 /* ps2_mss.c */; };
836F6FEC18BDC2190095E648 /* ps2_mtaf.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB018BDC2180095E648 /* ps2_mtaf.c */; };
836F6FED18BDC2190095E648 /* ps2_npsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB118BDC2180095E648 /* ps2_npsf.c */; };
836F6FEE18BDC2190095E648 /* ps2_p2bt.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB218BDC2180095E648 /* ps2_p2bt.c */; };
@ -248,7 +243,6 @@
836F6FF218BDC2190095E648 /* ps2_rnd.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB618BDC2180095E648 /* ps2_rnd.c */; };
836F6FF318BDC2190095E648 /* ps2_rstm.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB718BDC2180095E648 /* ps2_rstm.c */; };
836F6FF418BDC2190095E648 /* ps2_rws.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB818BDC2180095E648 /* ps2_rws.c */; };
836F6FF518BDC2190095E648 /* ps2_rxw.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EB918BDC2180095E648 /* ps2_rxw.c */; };
836F6FF618BDC2190095E648 /* ps2_sfs.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EBA18BDC2180095E648 /* ps2_sfs.c */; };
836F6FF718BDC2190095E648 /* ps2_sl3.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EBB18BDC2180095E648 /* ps2_sl3.c */; };
836F6FF818BDC2190095E648 /* ps2_smpl.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6EBC18BDC2180095E648 /* ps2_smpl.c */; };
@ -347,6 +341,14 @@
836F705718BDC2190095E648 /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = 836F6F1B18BDC2190095E648 /* util.h */; };
836F705818BDC2190095E648 /* vgmstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 836F6F1C18BDC2190095E648 /* vgmstream.c */; };
836F705918BDC2190095E648 /* vgmstream.h in Headers */ = {isa = PBXBuildFile; fileRef = 836F6F1D18BDC2190095E648 /* vgmstream.h */; settings = {ATTRIBUTES = (Public, ); }; };
83709E051ECBC1A4005C03D3 /* gtd.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709DFF1ECBC1A4005C03D3 /* gtd.c */; };
83709E061ECBC1A4005C03D3 /* mc3.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E001ECBC1A4005C03D3 /* mc3.c */; };
83709E071ECBC1A4005C03D3 /* mss.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E011ECBC1A4005C03D3 /* mss.c */; };
83709E081ECBC1A4005C03D3 /* ps2_rxws.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E021ECBC1A4005C03D3 /* ps2_rxws.c */; };
83709E091ECBC1A4005C03D3 /* ta_aac.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E031ECBC1A4005C03D3 /* ta_aac.c */; };
83709E0A1ECBC1A4005C03D3 /* waa_wac_wad_wam.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E041ECBC1A4005C03D3 /* waa_wac_wad_wam.c */; };
83709E0D1ECBC1C3005C03D3 /* mc3_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E0B1ECBC1C3005C03D3 /* mc3_decoder.c */; };
83709E0E1ECBC1C3005C03D3 /* psv_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 83709E0C1ECBC1C3005C03D3 /* psv_decoder.c */; };
838BDB641D3AF08C0022CA6F /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB611D3AF08C0022CA6F /* libavcodec.a */; };
838BDB651D3AF08C0022CA6F /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB621D3AF08C0022CA6F /* libavformat.a */; };
838BDB661D3AF08C0022CA6F /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 838BDB631D3AF08C0022CA6F /* libavutil.a */; };
@ -530,7 +532,6 @@
836F6DEA18BDC2180095E648 /* ima_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ima_decoder.c; sourceTree = "<group>"; };
836F6DEB18BDC2180095E648 /* l5_555_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = l5_555_decoder.c; sourceTree = "<group>"; };
836F6DEC18BDC2180095E648 /* lsf_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsf_decoder.c; sourceTree = "<group>"; };
836F6DED18BDC2180095E648 /* Makefile.unix.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.unix.am; sourceTree = "<group>"; };
836F6DEE18BDC2180095E648 /* mp4_aac_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mp4_aac_decoder.c; sourceTree = "<group>"; };
836F6DEF18BDC2180095E648 /* mpeg_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg_decoder.c; sourceTree = "<group>"; };
836F6DF018BDC2180095E648 /* msadpcm_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msadpcm_decoder.c; sourceTree = "<group>"; };
@ -565,7 +566,6 @@
836F6E0E18BDC2180095E648 /* interleave_byte.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = interleave_byte.c; sourceTree = "<group>"; };
836F6E0F18BDC2180095E648 /* ivaud_layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ivaud_layout.c; sourceTree = "<group>"; };
836F6E1018BDC2180095E648 /* layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout.h; sourceTree = "<group>"; };
836F6E1118BDC2180095E648 /* Makefile.unix.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.unix.am; sourceTree = "<group>"; };
836F6E1218BDC2180095E648 /* mus_acm_layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mus_acm_layout.c; sourceTree = "<group>"; };
836F6E1318BDC2180095E648 /* mxch_blocked.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mxch_blocked.c; sourceTree = "<group>"; };
836F6E1418BDC2180095E648 /* nolayout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nolayout.c; sourceTree = "<group>"; };
@ -631,7 +631,6 @@
836F6E5818BDC2180095E648 /* ivb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ivb.c; sourceTree = "<group>"; };
836F6E5918BDC2180095E648 /* kraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kraw.c; sourceTree = "<group>"; };
836F6E5A18BDC2180095E648 /* lsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsf.c; sourceTree = "<group>"; };
836F6E5B18BDC2180095E648 /* Makefile.unix.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.unix.am; sourceTree = "<group>"; };
836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mattel_hyperscan.c; sourceTree = "<group>"; };
836F6E5D18BDC2180095E648 /* maxis_xa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = maxis_xa.c; sourceTree = "<group>"; };
836F6E5E18BDC2180095E648 /* meta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = meta.h; sourceTree = "<group>"; };
@ -665,7 +664,6 @@
836F6E7A18BDC2180095E648 /* ngc_sck_dsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngc_sck_dsp.c; sourceTree = "<group>"; };
836F6E7B18BDC2180095E648 /* ngc_ssm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngc_ssm.c; sourceTree = "<group>"; };
836F6E7C18BDC2180095E648 /* ngc_tydsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngc_tydsp.c; sourceTree = "<group>"; };
836F6E7D18BDC2180095E648 /* ngc_waa_wac_wad_wam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngc_waa_wac_wad_wam.c; sourceTree = "<group>"; };
836F6E7E18BDC2180095E648 /* ngc_ymf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngc_ymf.c; sourceTree = "<group>"; };
836F6E7F18BDC2180095E648 /* ngca.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ngca.c; sourceTree = "<group>"; };
836F6E8118BDC2180095E648 /* nwa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nwa.c; sourceTree = "<group>"; };
@ -714,7 +712,6 @@
836F6EAC18BDC2180095E648 /* ps2_mic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_mic.c; sourceTree = "<group>"; };
836F6EAD18BDC2180095E648 /* ps2_mihb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_mihb.c; sourceTree = "<group>"; };
836F6EAE18BDC2180095E648 /* ps2_msa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_msa.c; sourceTree = "<group>"; };
836F6EAF18BDC2180095E648 /* ps2_mss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_mss.c; sourceTree = "<group>"; };
836F6EB018BDC2180095E648 /* ps2_mtaf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_mtaf.c; sourceTree = "<group>"; };
836F6EB118BDC2180095E648 /* ps2_npsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_npsf.c; sourceTree = "<group>"; };
836F6EB218BDC2180095E648 /* ps2_p2bt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_p2bt.c; sourceTree = "<group>"; };
@ -724,7 +721,6 @@
836F6EB618BDC2180095E648 /* ps2_rnd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_rnd.c; sourceTree = "<group>"; };
836F6EB718BDC2180095E648 /* ps2_rstm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_rstm.c; sourceTree = "<group>"; };
836F6EB818BDC2180095E648 /* ps2_rws.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_rws.c; sourceTree = "<group>"; };
836F6EB918BDC2180095E648 /* ps2_rxw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_rxw.c; sourceTree = "<group>"; };
836F6EBA18BDC2180095E648 /* ps2_sfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_sfs.c; sourceTree = "<group>"; };
836F6EBB18BDC2180095E648 /* ps2_sl3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_sl3.c; sourceTree = "<group>"; };
836F6EBC18BDC2180095E648 /* ps2_smpl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_smpl.c; sourceTree = "<group>"; };
@ -823,6 +819,14 @@
836F6F1B18BDC2190095E648 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
836F6F1C18BDC2190095E648 /* vgmstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vgmstream.c; sourceTree = "<group>"; };
836F6F1D18BDC2190095E648 /* vgmstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vgmstream.h; sourceTree = "<group>"; };
83709DFF1ECBC1A4005C03D3 /* gtd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gtd.c; sourceTree = "<group>"; };
83709E001ECBC1A4005C03D3 /* mc3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mc3.c; sourceTree = "<group>"; };
83709E011ECBC1A4005C03D3 /* mss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mss.c; sourceTree = "<group>"; };
83709E021ECBC1A4005C03D3 /* ps2_rxws.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ps2_rxws.c; sourceTree = "<group>"; };
83709E031ECBC1A4005C03D3 /* ta_aac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ta_aac.c; sourceTree = "<group>"; };
83709E041ECBC1A4005C03D3 /* waa_wac_wad_wam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = waa_wac_wad_wam.c; sourceTree = "<group>"; };
83709E0B1ECBC1C3005C03D3 /* mc3_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mc3_decoder.c; sourceTree = "<group>"; };
83709E0C1ECBC1C3005C03D3 /* psv_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psv_decoder.c; sourceTree = "<group>"; };
838BDB611D3AF08C0022CA6F /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = ../../ThirdParty/ffmpeg/lib/libavcodec.a; sourceTree = "<group>"; };
838BDB621D3AF08C0022CA6F /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = ../../ThirdParty/ffmpeg/lib/libavformat.a; sourceTree = "<group>"; };
838BDB631D3AF08C0022CA6F /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = ../../ThirdParty/ffmpeg/lib/libavutil.a; sourceTree = "<group>"; };
@ -994,6 +998,8 @@
836F6DDF18BDC2180095E648 /* coding */ = {
isa = PBXGroup;
children = (
83709E0B1ECBC1C3005C03D3 /* mc3_decoder.c */,
83709E0C1ECBC1C3005C03D3 /* psv_decoder.c */,
831BA6221EAC61CB00CF89B0 /* coding_utils.c */,
831BA6231EAC61CB00CF89B0 /* ogl_vorbis_decoder.c */,
831BA6241EAC61CB00CF89B0 /* wwise_vorbis_data.h */,
@ -1018,7 +1024,6 @@
836F6DEA18BDC2180095E648 /* ima_decoder.c */,
836F6DEB18BDC2180095E648 /* l5_555_decoder.c */,
836F6DEC18BDC2180095E648 /* lsf_decoder.c */,
836F6DED18BDC2180095E648 /* Makefile.unix.am */,
836F6DEE18BDC2180095E648 /* mp4_aac_decoder.c */,
836F6DEF18BDC2180095E648 /* mpeg_decoder.c */,
836F6DF018BDC2180095E648 /* msadpcm_decoder.c */,
@ -1060,7 +1065,6 @@
836F6E0E18BDC2180095E648 /* interleave_byte.c */,
836F6E0F18BDC2180095E648 /* ivaud_layout.c */,
836F6E1018BDC2180095E648 /* layout.h */,
836F6E1118BDC2180095E648 /* Makefile.unix.am */,
836F6E1218BDC2180095E648 /* mus_acm_layout.c */,
836F6E1318BDC2180095E648 /* mxch_blocked.c */,
836F6E1418BDC2180095E648 /* nolayout.c */,
@ -1084,6 +1088,12 @@
836F6E2718BDC2180095E648 /* meta */ = {
isa = PBXGroup;
children = (
83709DFF1ECBC1A4005C03D3 /* gtd.c */,
83709E001ECBC1A4005C03D3 /* mc3.c */,
83709E011ECBC1A4005C03D3 /* mss.c */,
83709E021ECBC1A4005C03D3 /* ps2_rxws.c */,
83709E031ECBC1A4005C03D3 /* ta_aac.c */,
83709E041ECBC1A4005C03D3 /* waa_wac_wad_wam.c */,
831BA60E1EAC61A500CF89B0 /* adx.c */,
831BA60F1EAC61A500CF89B0 /* ogl.c */,
831BA6101EAC61A500CF89B0 /* ps2_vds_vdm.c */,
@ -1158,7 +1168,6 @@
836F6E5818BDC2180095E648 /* ivb.c */,
836F6E5918BDC2180095E648 /* kraw.c */,
836F6E5A18BDC2180095E648 /* lsf.c */,
836F6E5B18BDC2180095E648 /* Makefile.unix.am */,
836F6E5C18BDC2180095E648 /* mattel_hyperscan.c */,
836F6E5D18BDC2180095E648 /* maxis_xa.c */,
836F6E5E18BDC2180095E648 /* meta.h */,
@ -1192,7 +1201,6 @@
836F6E7A18BDC2180095E648 /* ngc_sck_dsp.c */,
836F6E7B18BDC2180095E648 /* ngc_ssm.c */,
836F6E7C18BDC2180095E648 /* ngc_tydsp.c */,
836F6E7D18BDC2180095E648 /* ngc_waa_wac_wad_wam.c */,
836F6E7E18BDC2180095E648 /* ngc_ymf.c */,
836F6E7F18BDC2180095E648 /* ngca.c */,
836F6E8118BDC2180095E648 /* nwa.c */,
@ -1241,7 +1249,6 @@
836F6EAC18BDC2180095E648 /* ps2_mic.c */,
836F6EAD18BDC2180095E648 /* ps2_mihb.c */,
836F6EAE18BDC2180095E648 /* ps2_msa.c */,
836F6EAF18BDC2180095E648 /* ps2_mss.c */,
836F6EB018BDC2180095E648 /* ps2_mtaf.c */,
836F6EB118BDC2180095E648 /* ps2_npsf.c */,
836F6EB218BDC2180095E648 /* ps2_p2bt.c */,
@ -1251,7 +1258,6 @@
836F6EB618BDC2180095E648 /* ps2_rnd.c */,
836F6EB718BDC2180095E648 /* ps2_rstm.c */,
836F6EB818BDC2180095E648 /* ps2_rws.c */,
836F6EB918BDC2180095E648 /* ps2_rxw.c */,
836F6EBA18BDC2180095E648 /* ps2_sfs.c */,
836F6EBB18BDC2180095E648 /* ps2_sl3.c */,
836F6EBC18BDC2180095E648 /* ps2_smpl.c */,
@ -1535,10 +1541,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
836F6F9718BDC2190095E648 /* Makefile.unix.am in Resources */,
836F6B4718BDB8880095E648 /* InfoPlist.strings in Resources */,
836F6F4E18BDC2190095E648 /* Makefile.unix.am in Resources */,
836F6F2B18BDC2190095E648 /* Makefile.unix.am in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1617,11 +1620,13 @@
836F6F7818BDC2190095E648 /* Cstr.c in Sources */,
836F6F1E18BDC2190095E648 /* acm_decoder.c in Sources */,
836F6FD818BDC2190095E648 /* ps2_gbts.c in Sources */,
83709E0A1ECBC1A4005C03D3 /* waa_wac_wad_wam.c in Sources */,
836F6F2418BDC2190095E648 /* eaxa_decoder.c in Sources */,
836F6F7A18BDC2190095E648 /* dc_dcsw_dcs.c in Sources */,
836F6F5318BDC2190095E648 /* ps2_iab_blocked.c in Sources */,
831BA61A1EAC61A500CF89B0 /* ps2_vds_vdm.c in Sources */,
836F6FF218BDC2190095E648 /* ps2_rnd.c in Sources */,
83709E0D1ECBC1C3005C03D3 /* mc3_decoder.c in Sources */,
836F6FA818BDC2190095E648 /* nds_swav.c in Sources */,
836F6F3F18BDC2190095E648 /* ast_blocked.c in Sources */,
836F6F5018BDC2190095E648 /* mxch_blocked.c in Sources */,
@ -1650,6 +1655,7 @@
836F700F18BDC2190095E648 /* ps2_xa30.c in Sources */,
836F6F6F18BDC2190095E648 /* akb.c in Sources */,
836F6F7F18BDC2190095E648 /* dmsg_segh.c in Sources */,
83709E071ECBC1A4005C03D3 /* mss.c in Sources */,
836F6F8F18BDC2190095E648 /* his.c in Sources */,
836F6FE218BDC2190095E648 /* ps2_kces.c in Sources */,
836F6FEF18BDC2190095E648 /* ps2_pnb.c in Sources */,
@ -1707,6 +1713,7 @@
836F6F9818BDC2190095E648 /* mattel_hyperscan.c in Sources */,
83BAFB6C19F45EB3005DAB60 /* bfstm.c in Sources */,
836F704418BDC2190095E648 /* ws_aud.c in Sources */,
83709E081ECBC1A4005C03D3 /* ps2_rxws.c in Sources */,
836F6F6D18BDC2190095E648 /* aifc.c in Sources */,
836F702218BDC2190095E648 /* rsd.c in Sources */,
836F6FC618BDC2190095E648 /* pcm.c in Sources */,
@ -1736,7 +1743,6 @@
836F6FC018BDC2190095E648 /* p3d.c in Sources */,
836F6FC718BDC2190095E648 /* pona.c in Sources */,
836F6FE618BDC2190095E648 /* ps2_mcg.c in Sources */,
836F6FB918BDC2190095E648 /* ngc_waa_wac_wad_wam.c in Sources */,
836F6F5118BDC2190095E648 /* nolayout.c in Sources */,
836F702918BDC2190095E648 /* sat_sap.c in Sources */,
836F6F3718BDC2190095E648 /* pcm_decoder.c in Sources */,
@ -1750,7 +1756,9 @@
836F6F7C18BDC2190095E648 /* dc_kcey.c in Sources */,
836F6FED18BDC2190095E648 /* ps2_npsf.c in Sources */,
836F6F9E18BDC2190095E648 /* mus_acm.c in Sources */,
83709E0E1ECBC1C3005C03D3 /* psv_decoder.c in Sources */,
831BA6191EAC61A500CF89B0 /* ogl.c in Sources */,
83709E061ECBC1A4005C03D3 /* mc3.c in Sources */,
831BA61F1EAC61A500CF89B0 /* x360_cxs.c in Sources */,
836F6FCD18BDC2190095E648 /* ps2_ass.c in Sources */,
836F6FFE18BDC2190095E648 /* ps2_str.c in Sources */,
@ -1767,7 +1775,6 @@
834D3A6E19F47C98001C54F6 /* g1l.c in Sources */,
836F6FC318BDC2190095E648 /* pc_smp.c in Sources */,
836F6FCE18BDC2190095E648 /* ps2_ast.c in Sources */,
836F6FEB18BDC2190095E648 /* ps2_mss.c in Sources */,
836F6F5418BDC2190095E648 /* ps2_strlr_blocked.c in Sources */,
836F703D18BDC2190095E648 /* wii_mus.c in Sources */,
836F700D18BDC2190095E648 /* ps2_wmus.c in Sources */,
@ -1794,12 +1801,14 @@
836F6FF618BDC2190095E648 /* ps2_sfs.c in Sources */,
836F6F9518BDC2190095E648 /* kraw.c in Sources */,
836F6FB718BDC2190095E648 /* ngc_ssm.c in Sources */,
83709E051ECBC1A4005C03D3 /* gtd.c in Sources */,
836F704A18BDC2190095E648 /* xbox_wavm.c in Sources */,
836F6F8618BDC2190095E648 /* excitebots.c in Sources */,
836F6FF418BDC2190095E648 /* ps2_rws.c in Sources */,
836F6F2518BDC2190095E648 /* g721_decoder.c in Sources */,
836F6FE818BDC2190095E648 /* ps2_mic.c in Sources */,
836F6F3C18BDC2190095E648 /* xa_decoder.c in Sources */,
83709E091ECBC1A4005C03D3 /* ta_aac.c in Sources */,
836F6F9118BDC2190095E648 /* ios_psnd.c in Sources */,
836F700618BDC2190095E648 /* ps2_vgs.c in Sources */,
836F6F2118BDC2190095E648 /* aica_decoder.c in Sources */,
@ -1830,7 +1839,6 @@
836F701D18BDC2190095E648 /* raw.c in Sources */,
836F6FDE18BDC2190095E648 /* ps2_ild.c in Sources */,
836F703E18BDC2190095E648 /* wii_ras.c in Sources */,
836F6FF518BDC2190095E648 /* ps2_rxw.c in Sources */,
836F6FEA18BDC2190095E648 /* ps2_msa.c in Sources */,
836F6F3618BDC2190095E648 /* ogg_vorbis_decoder.c in Sources */,
836F704718BDC2190095E648 /* xbox_hlwav.c in Sources */,

View File

@ -1,39 +0,0 @@
noinst_LTLIBRARIES = libcoding.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libcoding_la_LDFLAGS =
libcoding_la_SOURCES =
libcoding_la_SOURCES += adx_decoder.c
libcoding_la_SOURCES += eaxa_decoder.c
libcoding_la_SOURCES += g721_decoder.c
libcoding_la_SOURCES += ima_decoder.c
libcoding_la_SOURCES += ngc_afc_decoder.c
libcoding_la_SOURCES += ngc_dsp_decoder.c
libcoding_la_SOURCES += ngc_dtk_decoder.c
libcoding_la_SOURCES += pcm_decoder.c
libcoding_la_SOURCES += psx_decoder.c
libcoding_la_SOURCES += xa_decoder.c
libcoding_la_SOURCES += ogg_vorbis_decoder.c
libcoding_la_SOURCES += sdx2_decoder.c
libcoding_la_SOURCES += ws_decoder.c
libcoding_la_SOURCES += mpeg_decoder.c
libcoding_la_SOURCES += acm_decoder.c
libcoding_la_SOURCES += nwa_decoder.c
libcoding_la_SOURCES += aica_decoder.c
libcoding_la_SOURCES += msadpcm_decoder.c
libcoding_la_SOURCES += nds_procyon_decoder.c
libcoding_la_SOURCES += l5_555_decoder.c
libcoding_la_SOURCES += SASSC_decoder.c
libcoding_la_SOURCES += g7221_decoder.c
libcoding_la_SOURCES += lsf_decoder.c
libcoding_la_SOURCES += mtaf_decoder.c
libcoding_la_SOURCES += g719_decoder.c
libcoding_la_SOURCES += hca_decoder.c
libcoding_la_SOURCES += fsb_vorbis_decoder.c
libcoding_la_SOURCES += wwise_vorbis_decoder.c
libcoding_la_SOURCES += wwise_vorbis_utils.c
libcoding_la_SOURCES += ogl_vorbis_decoder.c
EXTRA_DIST = coding.h g72x_state.h clHCA.h

View File

@ -1,29 +1,102 @@
#include "coding.h"
#include "../util.h"
void decode_adx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
void decode_adx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes) {
int i;
int32_t sample_count;
int32_t frame_samples = (frame_bytes - 2) * 2;
int framesin = first_sample/32;
int framesin = first_sample/frame_samples;
int32_t scale = read_16bitBE(stream->offset+framesin*18,stream->streamfile) + 1;
int32_t scale = read_16bitBE(stream->offset+framesin*frame_bytes,stream->streamfile) + 1;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int coef1 = stream->adpcm_coef[0];
int coef2 = stream->adpcm_coef[1];
first_sample = first_sample%32;
first_sample = first_sample%frame_samples;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_byte = read_8bit(stream->offset+framesin*18+2+i/2,stream->streamfile);
int sample_byte = read_8bit(stream->offset+framesin*frame_bytes +2+i/2,stream->streamfile);
outbuf[sample_count] = clamp16(
(i&1?
get_low_nibble_signed(sample_byte):
get_high_nibble_signed(sample_byte)
) * scale +
((coef1 * hist1 + coef2 * hist2) >> 12)
(coef1 * hist1 >> 12) + (coef2 * hist2 >> 12)
);
hist2 = hist1;
hist1 = outbuf[sample_count];
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
}
void decode_adx_exp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes) {
int i;
int32_t sample_count;
int32_t frame_samples = (frame_bytes - 2) * 2;
int framesin = first_sample/frame_samples;
int32_t scale = read_16bitBE(stream->offset+framesin*frame_bytes,stream->streamfile);
int32_t hist1, hist2;
int coef1, coef2;
scale = 1 << (12 - scale);
hist1 = stream->adpcm_history1_32;
hist2 = stream->adpcm_history2_32;
coef1 = stream->adpcm_coef[0];
coef2 = stream->adpcm_coef[1];
first_sample = first_sample%frame_samples;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_byte = read_8bit(stream->offset+framesin*frame_bytes +2+i/2,stream->streamfile);
outbuf[sample_count] = clamp16(
(i&1?
get_low_nibble_signed(sample_byte):
get_high_nibble_signed(sample_byte)
) * scale +
(coef1 * hist1 >> 12) + (coef2 * hist2 >> 12)
);
hist2 = hist1;
hist1 = outbuf[sample_count];
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
}
void decode_adx_fixed(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes) {
int i;
int32_t sample_count;
int32_t frame_samples = (frame_bytes - 2) * 2;
int framesin = first_sample/frame_samples;
int32_t scale = (read_16bitBE(stream->offset + framesin*frame_bytes, stream->streamfile) & 0x1FFF) + 1;
int32_t predictor = read_8bit(stream->offset + framesin*frame_bytes, stream->streamfile) >> 5;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int coef1 = stream->adpcm_coef[predictor * 2];
int coef2 = stream->adpcm_coef[predictor * 2 + 1];
first_sample = first_sample%frame_samples;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_byte = read_8bit(stream->offset+framesin*frame_bytes +2+i/2,stream->streamfile);
outbuf[sample_count] = clamp16(
(i&1?
get_low_nibble_signed(sample_byte):
get_high_nibble_signed(sample_byte)
) * scale +
(coef1 * hist1 >> 12) + (coef2 * hist2 >> 12)
);
hist2 = hist1;
@ -39,29 +112,30 @@ void adx_next_key(VGMSTREAMCHANNEL * stream)
stream->adx_xor = ( stream->adx_xor * stream->adx_mult + stream->adx_add ) & 0x7fff;
}
void decode_adx_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
void decode_adx_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes) {
int i;
int32_t sample_count;
int32_t frame_samples = (frame_bytes - 2) * 2;
int framesin = first_sample/32;
int framesin = first_sample/frame_samples;
int32_t scale = ((read_16bitBE(stream->offset+framesin*18,stream->streamfile) ^ stream->adx_xor)&0x1fff) + 1;
int32_t scale = ((read_16bitBE(stream->offset+framesin*frame_bytes,stream->streamfile) ^ stream->adx_xor)&0x1fff) + 1;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int coef1 = stream->adpcm_coef[0];
int coef2 = stream->adpcm_coef[1];
first_sample = first_sample%32;
first_sample = first_sample%frame_samples;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_byte = read_8bit(stream->offset+framesin*18+2+i/2,stream->streamfile);
int sample_byte = read_8bit(stream->offset+framesin*frame_bytes +2+i/2,stream->streamfile);
outbuf[sample_count] = clamp16(
(i&1?
get_low_nibble_signed(sample_byte):
get_high_nibble_signed(sample_byte)
) * scale +
((coef1 * hist1 + coef2 * hist2) >> 12)
(coef1 * hist1 >> 12) + (coef2 * hist2 >> 12)
);
hist2 = hist1;

View File

@ -1,12 +1,10 @@
#include "../vgmstream.h"
#ifdef VGM_USE_MAIATRAC3PLUS
#include "maiatrac3plus.h"
#include "coding.h"
#include "../util.h"
void decode_at3plus(VGMSTREAM * vgmstream,
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
#ifdef VGM_USE_MAIATRAC3PLUS
#include "maiatrac3plus.h"
void decode_at3plus(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
VGMSTREAMCHANNEL *ch = &vgmstream->ch[0];
maiatrac3plus_codec_data *data = vgmstream->codec_data;
int i;
@ -37,4 +35,31 @@ void decode_at3plus(VGMSTREAM * vgmstream,
}
}
void reset_at3plus(VGMSTREAM *vgmstream) {
maiatrac3plus_codec_data *data = vgmstream->codec_data;
if (data->handle)
Atrac3plusDecoder_closeContext(data->handle);
data->handle = Atrac3plusDecoder_openContext();
data->samples_discard = 0;
}
void seek_at3plus(VGMSTREAM *vgmstream, int32_t num_sample) {
int blocks_to_skip = num_sample / 2048;
int samples_to_discard = num_sample % 2048;
maiatrac3plus_codec_data *data = (maiatrac3plus_codec_data *)(vgmstream->codec_data);
vgmstream->loop_ch[0].offset =
vgmstream->loop_ch[0].channel_start_offset +
vgmstream->interleave_block_size * blocks_to_skip;
data->samples_discard = samples_to_discard;
}
void free_at3plus(maiatrac3plus_codec_data *data) {
if (data) {
if (data->handle) Atrac3plusDecoder_closeContext(data->handle);
free(data);
}
}
#endif

View File

@ -4,8 +4,10 @@
#include "../vgmstream.h"
/* adx_decoder */
void decode_adx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_adx_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_adx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes);
void decode_adx_exp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes);
void decode_adx_fixed(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes);
void decode_adx_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes);
void adx_next_key(VGMSTREAMCHANNEL * stream);
/* g721_decoder */
@ -77,7 +79,6 @@ void decode_maxis_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspaci
/* sdx2_decoder */
void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_sdx2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* sdx2_decoder */
void decode_cbd2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_cbd2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
@ -113,79 +114,93 @@ void decode_lsf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
/* mtaf_decoder */
void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels);
/* mc3_decoder */
void decode_mc3(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
/* hca_decoder */
void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
void reset_hca(VGMSTREAM *vgmstream);
void loop_hca(VGMSTREAM *vgmstream);
void free_hca(hca_codec_data * data);
#ifdef VGM_USE_VORBIS
/* ogg_vorbis_decoder */
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
void reset_ogg_vorbis(VGMSTREAM *vgmstream);
void seek_ogg_vorbis(VGMSTREAM *vgmstream, int32_t num_sample);
void free_ogg_vorbis(ogg_vorbis_codec_data *data);
/* fsb_vorbis_decoder */
vorbis_codec_data * init_fsb_vorbis_codec_data(STREAMFILE *streamfile, off_t start_offset, int channels, int sample_rate, uint32_t setup_id);
void decode_fsb_vorbis(VGMSTREAM * vgmstream, sample * outbuf, int32_t samples_to_do, int channels);
void free_fsb_vorbis(vorbis_codec_data *data);
void reset_fsb_vorbis(VGMSTREAM *vgmstream);
void seek_fsb_vorbis(VGMSTREAM *vgmstream, int32_t num_sample);
void free_fsb_vorbis(vorbis_codec_data *data);
/* wwise_vorbis_decoder */
vorbis_codec_data * init_wwise_vorbis_codec_data(STREAMFILE *streamfile, off_t start_offset, int channels, int sample_rate, int blocksize_0_exp, int blocksize_1_exp,
wwise_setup_type setup_type, wwise_header_type header_type, wwise_packet_type packet_type, int big_endian);
void decode_wwise_vorbis(VGMSTREAM * vgmstream, sample * outbuf, int32_t samples_to_do, int channels);
void free_wwise_vorbis(vorbis_codec_data *data);
void reset_wwise_vorbis(VGMSTREAM *vgmstream);
void seek_wwise_vorbis(VGMSTREAM *vgmstream, int32_t num_sample);
void free_wwise_vorbis(vorbis_codec_data *data);
/* ogl_vorbis_decoder */
vorbis_codec_data * init_ogl_vorbis_codec_data(STREAMFILE *streamFile, off_t start_offset, off_t * data_start_offset);
void decode_ogl_vorbis(VGMSTREAM * vgmstream, sample * outbuf, int32_t samples_to_do, int channels);
void free_ogl_vorbis(vorbis_codec_data *data);
void reset_ogl_vorbis(VGMSTREAM *vgmstream);
void seek_ogl_vorbis(VGMSTREAM *vgmstream, int32_t num_sample);
void free_ogl_vorbis(vorbis_codec_data *data);
#endif
/* mpeg_decoder */
#ifdef VGM_USE_MPEG
/* mpeg_decoder */
mpeg_codec_data *init_mpeg_codec_data(STREAMFILE *streamfile, off_t start_offset, coding_t *coding_type, int channels);
mpeg_codec_data *init_mpeg_codec_data_interleaved(STREAMFILE *streamfile, off_t start_offset, coding_t *coding_type, int channels, int fixed_frame_size, int fsb_padding);
mpeg_codec_data *init_mpeg_codec_data_ahx(STREAMFILE *streamFile, off_t start_offset, int channel_count);
void decode_mpeg(VGMSTREAM * vgmstream, sample * outbuf, int32_t samples_to_do, int channels);
void decode_fake_mpeg2_l2(VGMSTREAMCHANNEL * stream, mpeg_codec_data * data, sample * outbuf, int32_t samples_to_do);
void free_mpeg(mpeg_codec_data *data);
void reset_mpeg(VGMSTREAM *vgmstream);
void seek_mpeg(VGMSTREAM *vgmstream, int32_t num_sample);
void free_mpeg(mpeg_codec_data *data);
long mpeg_bytes_to_samples(long bytes, const mpeg_codec_data *data);
void mpeg_set_error_logging(mpeg_codec_data * data, int enable);
#endif
/* g7221_decoder */
#ifdef VGM_USE_G7221
/* g7221_decoder */
void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
void reset_g7221(VGMSTREAM *vgmstream);
void free_g7221(VGMSTREAM *vgmstream);
#endif
/* g719_decoder */
#ifdef VGM_USE_G719
/* g719_decoder */
void decode_g719(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
void reset_g719(VGMSTREAM *vgmstream);
void free_g719(VGMSTREAM *vgmstream);
#endif
/* mp4_aac_decoder */
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
/* mp4_aac_decoder */
void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
void reset_mp4_aac(VGMSTREAM *vgmstream);
void seek_mp4_aac(VGMSTREAM *vgmstream, int32_t num_sample);
void free_mp4_aac(mp4_aac_codec_data * data);
#endif
/* at3_decoder */
#ifdef VGM_USE_MAIATRAC3PLUS
/* at3_decoder */
void decode_at3plus(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
void reset_at3plus(VGMSTREAM *vgmstream);
void seek_at3plus(VGMSTREAM *vgmstream, int32_t num_sample);
void free_at3plus(maiatrac3plus_codec_data *data);
#endif
/* ffmpeg_decoder */
#ifdef VGM_USE_FFMPEG
/* ffmpeg_decoder */
void decode_ffmpeg(VGMSTREAM *stream, sample * outbuf, int32_t samples_to_do, int channels);
void reset_ffmpeg(VGMSTREAM *vgmstream);
void seek_ffmpeg(VGMSTREAM *vgmstream, int32_t num_sample);

View File

@ -1,12 +1,10 @@
#include "../vgmstream.h"
#ifdef VGM_USE_G719
#include "coding.h"
#include "../util.h"
#ifdef VGM_USE_G719
#include "../stack_alloc.h"
void decode_g719(VGMSTREAM * vgmstream,
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
void decode_g719(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
g719_codec_data *data = vgmstream->codec_data;
g719_codec_data *ch_data = &data[channel];
@ -26,4 +24,30 @@ void decode_g719(VGMSTREAM * vgmstream,
}
}
void reset_g719(VGMSTREAM *vgmstream) {
g719_codec_data *data = vgmstream->codec_data;
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g719_reset(data[i].handle);
}
}
void free_g719(VGMSTREAM *vgmstream) {
g719_codec_data *data = (g719_codec_data *) vgmstream->codec_data;
if (data)
{
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g719_free(data[i].handle);
}
free(data);
}
}
#endif

View File

@ -1,11 +1,9 @@
#include "../vgmstream.h"
#ifdef VGM_USE_G7221
#include "coding.h"
#include "../util.h"
void decode_g7221(VGMSTREAM * vgmstream,
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
#ifdef VGM_USE_G7221
void decode_g7221(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
g7221_codec_data *data = vgmstream->codec_data;
g7221_codec_data *ch_data = &data[channel];
@ -24,4 +22,30 @@ void decode_g7221(VGMSTREAM * vgmstream,
}
}
void reset_g7221(VGMSTREAM *vgmstream) {
g7221_codec_data *data = vgmstream->codec_data;
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g7221_reset(data[i].handle);
}
}
void free_g7221(VGMSTREAM *vgmstream) {
g7221_codec_data *data = (g7221_codec_data *) vgmstream->codec_data;
if (data)
{
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g7221_free(data[i].handle);
}
free(data);
}
}
#endif

View File

@ -1,4 +1,4 @@
#include "../vgmstream.h"
#include "coding.h"
void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels) {
int samples_done = 0;
@ -80,3 +80,29 @@ void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, i
free( hca_data );
}
void reset_hca(VGMSTREAM *vgmstream) {
hca_codec_data *data = vgmstream->codec_data;
/*clHCA *hca = (clHCA *)(data + 1);*/
data->curblock = 0;
data->sample_ptr = clHCA_samplesPerBlock;
data->samples_discard = 0;
}
void loop_hca(VGMSTREAM *vgmstream) {
hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data);
data->curblock = data->info.loopStart;
data->sample_ptr = clHCA_samplesPerBlock;
data->samples_discard = 0;
}
void free_hca(hca_codec_data * data) {
if (data) {
clHCA *hca = (clHCA *)(data + 1);
clHCA_done(hca);
if (data->streamfile)
close_streamfile(data->streamfile);
free(data);
}
}

View File

@ -0,0 +1,183 @@
#include "coding.h"
#include "../util.h"
static const int step_table[4] = {
5, 1, -1, -3
};
static const int mc3_table[4][4][64] = {
{
{
2, 2, 3, 7, 15, 27, 45, 70, 104, 148, 202, 268, 347, 441, 551, 677,
821, 984, 1168, 1374, 1602, 1854, 2131, 2435, 2767, 3127, 3517, 3938, 4392, 4880, 5402, 5960,
6555, 7189, 7862, 8577, 9333, 10132, 10976, 11865, 12802, 13786, 14819, 15903, 17038, 18226, 19469, 20766,
22120, 23531, 25001, 26531, 28123, 29776, 31494, 33276, 35124, 37039, 39023, 41076, 43201, 45397, 47666, 50010
},
{
1, 1, 2, 5, 10, 18, 31, 48, 72, 101, 139, 184, 239, 303, 378, 465,
564, 677, 803, 944, 1101, 1274, 1465, 1674, 1902, 2150, 2418, 2707, 3019, 3355, 3714, 4097,
4507, 4942, 5405, 5896, 6416, 6966, 7546, 8157, 8801, 9477, 10188, 10933, 11714, 12530, 13384, 14276,
15207, 16177, 17188, 18240, 19334, 20471, 21652, 22877, 24148, 25464, 26828, 28240, 29700, 31210, 32770, 34382
},
{
0, 0, 1, 2, 4, 8, 14, 22, 32, 46, 63, 83, 108, 138, 172, 211,
256, 307, 365, 429, 500, 579, 666, 761, 864, 977, 1099, 1230, 1372, 1525, 1688, 1862,
2048, 2246, 2457, 2680, 2916, 3166, 3430, 3708, 4000, 4308, 4631, 4969, 5324, 5695, 6084, 6489,
6912, 7353, 7813, 8291, 8788, 9305, 9841, 10398, 10976, 11574, 12194, 12836, 13500, 14186, 14895, 15628
},
{
0, 0, 0, 0, 1, 3, 5, 8, 13, 18, 25, 33, 43, 55, 68, 84,
102, 123, 146, 171, 200, 231, 266, 304, 345, 390, 439, 492, 549, 610, 675, 745,
819, 898, 982, 1072, 1166, 1266, 1372, 1483, 1600, 1723, 1852, 1987, 2129, 2278, 2433, 2595,
2765, 2941, 3125, 3316, 3515, 3722, 3936, 4159, 4390, 4629, 4877, 5134, 5400, 5674, 5958, 6251
},
},
{
{
1, 1, 2, 4, 9, 17, 28, 44, 65, 92, 126, 167, 217, 276, 344, 423,
513, 615, 730, 858, 1001, 1159, 1332, 1522, 1729, 1954, 2198, 2461, 2745, 3050, 3376, 3725,
4097, 4493, 4914, 5360, 5833, 6332, 6860, 7416, 8001, 8616, 9262, 9939, 10649, 11391, 12168, 12978,
13825, 14707, 15626, 16582, 17576, 18610, 19683, 20797, 21952, 23149, 24389, 25673, 27000, 28373, 29791, 31256
},
{
0, 0, 1, 2, 5, 10, 17, 26, 39, 55, 75, 100, 130, 165, 206, 254,
308, 369, 438, 515, 600, 695, 799, 913, 1037, 1172, 1319, 1477, 1647, 1830, 2025, 2235,
2458, 2696, 2948, 3216, 3499, 3799, 4116, 4449, 4800, 5169, 5557, 5963, 6389, 6835, 7300, 7787,
8295, 8824, 9375, 9949, 10546, 11166, 11810, 12478, 13171, 13889, 14633, 15403, 16200, 17023, 17874, 18753
},
{
0, 0, 0, 1, 3, 6, 11, 17, 26, 37, 50, 67, 86, 110, 137, 169,
205, 246, 292, 343, 400, 463, 532, 608, 691, 781, 879, 984, 1098, 1220, 1350, 1490,
1638, 1797, 1965, 2144, 2333, 2533, 2744, 2966, 3200, 3446, 3704, 3975, 4259, 4556, 4867, 5191,
5530, 5882, 6250, 6632, 7030, 7444, 7873, 8319, 8781, 9259, 9755, 10269, 10800, 11349, 11916, 12502
},
{
0, 0, 0, 0, 0, 1, 2, 4, 6, 9, 12, 16, 21, 27, 34, 42,
51, 61, 73, 85, 100, 115, 133, 152, 172, 195, 219, 246, 274, 305, 337, 372,
409, 449, 491, 536, 583, 633, 686, 741, 800, 861, 926, 993, 1064, 1139, 1216, 1297,
1382, 1470, 1562, 1658, 1757, 1861, 1968, 2079, 2195, 2314, 2438, 2567, 2700, 2837, 2979, 3125
},
},
{
{
1, 1, 2, 5, 10, 18, 31, 48, 72, 101, 139, 184, 239, 303, 378, 465,
564, 677, 803, 944, 1101, 1274, 1465, 1674, 1902, 2150, 2418, 2707, 3019, 3355, 3714, 4097,
4507, 4942, 5405, 5896, 6416, 6966, 7546, 8157, 8801, 9477, 10188, 10933, 11714, 12530, 13384, 14276,
15207, 16177, 17188, 18240, 19334, 20471, 21652, 22877, 24148, 25464, 26828, 28240, 29700, 31210, 32770, 34382
},
{
1, 1, 1, 3, 7, 13, 22, 35, 52, 74, 101, 134, 173, 220, 275, 338,
410, 492, 584, 687, 801, 927, 1065, 1217, 1383, 1563, 1758, 1969, 2196, 2440, 2701, 2980,
3277, 3594, 3931, 4288, 4666, 5066, 5488, 5932, 6401, 6893, 7409, 7951, 8519, 9113, 9734, 10383,
11060, 11765, 12500, 13265, 14061, 14888, 15747, 16638, 17562, 18519, 19511, 20538, 21600, 22698, 23833, 25005
},
{
0, 0, 1, 2, 4, 8, 14, 22, 32, 46, 63, 83, 108, 138, 172, 211,
256, 307, 365, 429, 500, 579, 666, 761, 864, 977, 1099, 1230, 1372, 1525, 1688, 1862,
2048, 2246, 2457, 2680, 2916, 3166, 3430, 3708, 4000, 4308, 4631, 4969, 5324, 5695, 6084, 6489,
6912, 7353, 7813, 8291, 8788, 9305, 9841, 10398, 10976, 11574, 12194, 12836, 13500, 14186, 14895, 15628
},
{
0, 0, 0, 1, 2, 5, 8, 13, 19, 27, 37, 50, 65, 82, 103, 127,
154, 184, 219, 257, 300, 347, 399, 456, 518, 586, 659, 738, 823, 915, 1012, 1117,
1229, 1348, 1474, 1608, 1749, 1899, 2058, 2224, 2400, 2584, 2778, 2981, 3194, 3417, 3650, 3893,
4147, 4412, 4687, 4974, 5273, 5583, 5905, 6239, 6585, 6944, 7316, 7701, 8100, 8511, 8937, 9376
},
},
{
{
1, 1, 2, 5, 11, 20, 34, 53, 78, 111, 151, 201, 260, 331, 413, 508,
616, 738, 876, 1030, 1201, 1390, 1598, 1826, 2075, 2345, 2638, 2954, 3294, 3660, 4051, 4470,
4916, 5392, 5897, 6432, 6999, 7599, 8232, 8899, 9601, 10339, 11114, 11927, 12779, 13670, 14601, 15574,
16590, 17648, 18751, 19898, 21092, 22332, 23620, 24957, 26343, 27779, 29267, 30807, 32400, 34047, 35749, 37507
},
{
1, 1, 1, 3, 6, 11, 19, 31, 45, 64, 88, 117, 152, 193, 241, 296,
359, 430, 511, 601, 701, 811, 932, 1065, 1210, 1368, 1538, 1723, 1921, 2135, 2363, 2607,
2868, 3145, 3440, 3752, 4083, 4433, 4802, 5191, 5600, 6031, 6483, 6957, 7454, 7974, 8517, 9085,
9677, 10295, 10938, 11607, 12303, 13027, 13778, 14558, 15366, 16204, 17072, 17971, 18900, 19861, 20854, 21879
},
{
0, 0, 0, 1, 2, 5, 8, 13, 19, 27, 37, 50, 65, 82, 103, 127,
154, 184, 219, 257, 300, 347, 399, 456, 518, 586, 659, 738, 823, 915, 1012, 1117,
1229, 1348, 1474, 1608, 1749, 1899, 2058, 2224, 2400, 2584, 2778, 2981, 3194, 3417, 3650, 3893,
4147, 4412, 4687, 4974, 5273, 5583, 5905, 6239, 6585, 6944, 7316, 7701, 8100, 8511, 8937, 9376
},
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
},
}
};
/* MC3 3-bit ADPCM (Paradigm Entertainment games).
*
* Layout: blocks with 32b header + 32b ch1, 32b ch2, 32b ch1...
* Each 32b is a sub-block with 10 samples (3b x10) sharing a 'mode' of sorts.
* More than one block is rarely used though.
*
* Tables and original algorithm by daemon1
*/
void decode_mc3(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
int i, sample_count = 0;
int32_t hist = stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index;
/* internal interleave */
int block_samples = (vgmstream->interleave_block_size - 4) / 4 / vgmstream->channels * 10;
first_sample = first_sample % block_samples;
/* block header */
if (first_sample == 0) {
uint32_t header = (uint32_t)read_32bitLE(stream->offset, stream->streamfile);
header = (header >> channel*16); /* lower 16=ch1, upper 16b=ch2 */
step_index = header & 0x3f; /* 6b */
hist = header & 0xffc0; /* 16b sans 6b */
if (hist > 0x7fff) hist -= 0x10000; /* sign extend */
}
/* block samples */
for (i = first_sample; i < first_sample + samples_to_do; i++) {
uint32_t subblock, mode, samples, index, sign, diff;
/* header + ch shift + sub-block number (ex. ch0 i=10: sub-block 1, ch0 i=23: sub-block 2) */
off_t subblock_offset = stream->offset + 4 + 4*channel + (i/10)*(4*vgmstream->channels);
int sample_shift = (i%10)*3;
/* expand 3b */
subblock = (uint32_t)read_32bitLE(subblock_offset, stream->streamfile);
mode = (subblock >> 30) & 0x3; /* upper 2b */
samples = (subblock) & 0x3FFFFFFF; /* lower 3b*10 */
index = (samples >> sample_shift) & 3; /* lower 2b */
sign = (samples >> sample_shift) & 4; /* upper 1b */
diff = mc3_table[mode][index][step_index];
if (sign == 0)
hist += (- 1 - diff);
else
hist += diff;
/* new step + clamp */
step_index += step_table[index];
if (step_index < 0) step_index = 0;
else if (step_index > 63) step_index = 63;
/* output */
outbuf[sample_count] = hist;
sample_count += channelspacing;
}
/* internal interleave: increment offset on complete frame */
if (i == block_samples) stream->offset += vgmstream->interleave_block_size;
stream->adpcm_history1_32 = hist;
stream->adpcm_step_index = step_index;
}

View File

@ -82,4 +82,29 @@ void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_
data->sample_ptr = samples_remain;
}
}
void reset_mp4_aac(VGMSTREAM *vgmstream) {
mp4_aac_codec_data *data = vgmstream->codec_data;
data->sampleId = 0;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = 0;
}
void seek_mp4_aac(VGMSTREAM *vgmstream, int32_t num_sample) {
mp4_aac_codec_data *data = (mp4_aac_codec_data *)(vgmstream->codec_data);
data->sampleId = 0;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = num_sample;
}
void free_mp4_aac(mp4_aac_codec_data * data) {
if (data) {
if (data->h_aacdecoder) aacDecoder_Close(data->h_aacdecoder);
if (data->h_mp4file) MP4Close(data->h_mp4file, 0);
if (data->if_file.streamfile) close_streamfile(data->if_file.streamfile);
free(data);
}
}
#endif

View File

@ -1,9 +1,8 @@
#include "../vgmstream.h"
#include "coding.h"
#include "../util.h"
#ifdef VGM_USE_VORBIS
#include <vorbis/vorbisfile.h>
#include "coding.h"
#include "../util.h"
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels) {
int samples_done = 0;
@ -21,4 +20,30 @@ void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t sa
swap_samples_le(outbuf, samples_to_do*channels);
}
void reset_ogg_vorbis(VGMSTREAM *vgmstream) {
ogg_vorbis_codec_data *data = vgmstream->codec_data;
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_pcm_seek(ogg_vorbis_file, 0);
}
void seek_ogg_vorbis(VGMSTREAM *vgmstream, int32_t num_sample) {
ogg_vorbis_codec_data *data = (ogg_vorbis_codec_data *)(vgmstream->codec_data);
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_pcm_seek_lap(ogg_vorbis_file, num_sample);
}
void free_ogg_vorbis(ogg_vorbis_codec_data *data) {
if (!data) {
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_clear(ogg_vorbis_file);
close_streamfile(data->ov_streamfile.streamfile);
free(data);
}
}
#endif

View File

@ -0,0 +1,207 @@
#include <math.h>
#include "coding.h"
#include "../util.h"
/* PSVita ADPCM table */
static const int16_t HEVAG_coefs[128][4] = {
{ 0, 0, 0, 0 },
{ 7680, 0, 0, 0 },
{ 14720, -6656, 0, 0 },
{ 12544, -7040, 0, 0 },
{ 15616, -7680, 0, 0 },
{ 14731, -7059, 0, 0 },
{ 14507, -7366, 0, 0 },
{ 13920, -7522, 0, 0 },
{ 13133, -7680, 0, 0 },
{ 12028, -7680, 0, 0 },
{ 10764, -7680, 0, 0 },
{ 9359, -7680, 0, 0 },
{ 7832, -7680, 0, 0 },
{ 6201, -7680, 0, 0 },
{ 4488, -7680, 0, 0 },
{ 2717, -7680, 0, 0 },
{ 910, -7680, 0, 0 },
{ -910, -7680, 0, 0 },
{ -2717, -7680, 0, 0 },
{ -4488, -7680, 0, 0 },
{ -6201, -7680, 0, 0 },
{ -7832, -7680, 0, 0 },
{ -9359, -7680, 0, 0 },
{ -10764, -7680, 0, 0 },
{ -12028, -7680, 0, 0 },
{ -13133, -7680, 0, 0 },
{ -13920, -7522, 0, 0 },
{ -14507, -7366, 0, 0 },
{ -14731, -7059, 0, 0 },
{ 5376, -9216, 3328, -3072 },
{ -6400, -7168, -3328, -2304 },
{ -10496, -7424, -3584, -1024 },
{ -167, -2722, -494, -541 },
{ -7430, -2221, -2298, 424 },
{ -8001, -3166, -2814, 289 },
{ 6018, -4750, 2649, -1298 },
{ 3798, -6946, 3875, -1216 },
{ -8237, -2596, -2071, 227 },
{ 9199, 1982, -1382, -2316 },
{ 13021, -3044, -3792, 1267 },
{ 13112, -4487, -2250, 1665 },
{ -1668, -3744, -6456, 840 },
{ 7819, -4328, 2111, -506 },
{ 9571, -1336, -757, 487 },
{ 10032, -2562, 300, 199 },
{ -4745, -4122, -5486, -1493 },
{ -5896, 2378, -4787, -6947 },
{ -1193, -9117, -1237, -3114 },
{ 2783, -7108, -1575, -1447 },
{ -7334, -2062, -2212, 446 },
{ 6127, -2577, -315, -18 },
{ 9457, -1858, 102, 258 },
{ 7876, -4483, 2126, -538 },
{ -7172, -1795, -2069, 482 },
{ -7358, -2102, -2233, 440 },
{ -9170, -3509, -2674, -391 },
{ -2638, -2647, -1929, -1637 },
{ 1873, 9183, 1860, -5746 },
{ 9214, 1859, -1124, -2427 },
{ 13204, -3012, -4139, 1370 },
{ 12437, -4792, -256, 622 },
{ -2653, -1144, -3182, -6878 },
{ 9331, -1048, -828, 507 },
{ 1642, -620, -946, -4229 },
{ 4246, -7585, -533, -2259 },
{ -8988, -3891, -2807, 44 },
{ -2562, -2735, -1730, -1899 },
{ 3182, -483, -714, -1421 },
{ 7937, -3844, 2821, -1019 },
{ 10069, -2609, 314, 195 },
{ 8400, -3297, 1551, -155 },
{ -8529, -2775, -2432, -336 },
{ 9477, -1882, 108, 256 },
{ 75, -2241, -298, -6937 },
{ -9143, -4160, -2963, 5 },
{ -7270, -1958, -2156, 460 },
{ -2740, 3745, 5936, -1089 },
{ 8993, 1948, -683, -2704 },
{ 13101, -2835, -3854, 1055 },
{ 9543, -1961, 130, 250 },
{ 5272, -4270, 3124, -3157 },
{ -7696, -3383, -2907, -456 },
{ 7309, 2523, 434, -2461 },
{ 10275, -2867, 391, 172 },
{ 10940, -3721, 665, 97 },
{ 24, -310, -1262, 320 },
{ -8122, -2411, -2311, -271 },
{ -8511, -3067, -2337, 163 },
{ 326, -3846, 419, -933 },
{ 8895, 2194, -541, -2880 },
{ 12073, -1876, -2017, -601 },
{ 8729, -3423, 1674, -169 },
{ 12950, -3847, -3007, 1946 },
{ 10038, -2570, 302, 198 },
{ 9385, -2757, 1008, 41 },
{ -4720, -5006, -2852, -1161 },
{ 7869, -4326, 2135, -501 },
{ 2450, -8597, 1299, -2780 },
{ 10192, -2763, 360, 181 },
{ 11313, -4213, 833, 53 },
{ 10154, -2716, 345, 185 },
{ 9638, -1417, -737, 482 },
{ 3854, -4554, 2843, -3397 },
{ 6699, -5659, 2249, -1074 },
{ 11082, -3908, 728, 80 },
{ -1026, -9810, -805, -3462 },
{ 10396, -3746, 1367, -96 },
{ 10287, 988, -1915, -1437 },
{ 7953, 3878, -764, -3263 },
{ 12689, -3375, -3354, 2079 },
{ 6641, 3166, 231, -2089 },
{ -2348, -7354, -1944, -4122 },
{ 9290, -4039, 1885, -246 },
{ 4633, -6403, 1748, -1619 },
{ 11247, -4125, 802, 61 },
{ 9807, -2284, 219, 222 },
{ 9736, -1536, -706, 473 },
{ 8440, -3436, 1562, -176 },
{ 9307, -1021, -835, 509 },
{ 1698, -9025, 688, -3037 },
{ 10214, -2791, 368, 179 },
{ 8390, 3248, -758, -2989 },
{ 7201, 3316, 46, -2614 },
{ -88, -7809, -538, -4571 },
{ 6193, -5189, 2760, -1245 },
{ 12325, -1290, -3284, 253 },
{ 13064, -4075, -2824, 1877 },
{ 5333, 2999, 775, -1132 }
};
/**
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
* Evolution of the regular VAG (same flags and frames), uses 4 history samples and a bigger table.
*
* Original research and algorithm by id-daemon / daemon1.
*/
void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
uint8_t predict_nr, shift, flag, byte;
int32_t scale = 0;
int32_t sample;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int32_t hist3 = stream->adpcm_history3_32;
int32_t hist4 = stream->adpcm_history4_32;
int i, sample_count;
int framesin = first_sample / 28;
/* 4 byte header: predictor = 3rd and 1st, shift = 2nd, flag = 4th */
byte = (uint8_t)read_8bit(stream->offset+framesin*16+0,stream->streamfile);
predict_nr = byte >> 4;
shift = byte & 0x0f;
byte = (uint8_t)read_8bit(stream->offset+framesin*16+1,stream->streamfile);
predict_nr = (byte & 0xF0) | predict_nr;
flag = byte & 0x0f; /* no change in flags */
first_sample = first_sample % 28;
if (first_sample & 1) { /* if first sample is odd, read byte first */
byte = read_8bit(stream->offset+(framesin*16)+2+first_sample/2,stream->streamfile);
}
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
sample = 0;
if (flag < 7 && predict_nr < 128) {
if (i & 1) {/* odd/even nibble */
scale = byte >> 4;
} else {
byte = read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
scale = byte & 0x0f;
}
if (scale > 7) { /* sign extend */
scale = scale - 16;
}
sample = (hist1 * HEVAG_coefs[predict_nr][0] +
hist2 * HEVAG_coefs[predict_nr][1] +
hist3 * HEVAG_coefs[predict_nr][2] +
hist4 * HEVAG_coefs[predict_nr][3] ) / 32;
sample = (sample + (scale << (20 - shift)) + 128) >> 8;
}
outbuf[sample_count] = clamp16(sample);
hist4 = hist3;
hist3 = hist2;
hist2 = hist1;
hist1 = sample;
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
stream->adpcm_history3_32 = hist3;
stream->adpcm_history4_32 = hist4;
}

View File

@ -24,142 +24,11 @@ static const int8_t VAG_coefs[5][2] = {
};
#endif
/* PSVita ADPCM table */
static const int16_t HEVAG_coefs[128][4] = {
{ 0, 0, 0, 0 },
{ 7680, 0, 0, 0 },
{ 14720, -6656, 0, 0 },
{ 12544, -7040, 0, 0 },
{ 15616, -7680, 0, 0 },
{ 14731, -7059, 0, 0 },
{ 14507, -7366, 0, 0 },
{ 13920, -7522, 0, 0 },
{ 13133, -7680, 0, 0 },
{ 12028, -7680, 0, 0 },
{ 10764, -7680, 0, 0 },
{ 9359, -7680, 0, 0 },
{ 7832, -7680, 0, 0 },
{ 6201, -7680, 0, 0 },
{ 4488, -7680, 0, 0 },
{ 2717, -7680, 0, 0 },
{ 910, -7680, 0, 0 },
{ -910, -7680, 0, 0 },
{ -2717, -7680, 0, 0 },
{ -4488, -7680, 0, 0 },
{ -6201, -7680, 0, 0 },
{ -7832, -7680, 0, 0 },
{ -9359, -7680, 0, 0 },
{ -10764, -7680, 0, 0 },
{ -12028, -7680, 0, 0 },
{ -13133, -7680, 0, 0 },
{ -13920, -7522, 0, 0 },
{ -14507, -7366, 0, 0 },
{ -14731, -7059, 0, 0 },
{ 5376, -9216, 3328, -3072 },
{ -6400, -7168, -3328, -2304 },
{ -10496, -7424, -3584, -1024 },
{ -167, -2722, -494, -541 },
{ -7430, -2221, -2298, 424 },
{ -8001, -3166, -2814, 289 },
{ 6018, -4750, 2649, -1298 },
{ 3798, -6946, 3875, -1216 },
{ -8237, -2596, -2071, 227 },
{ 9199, 1982, -1382, -2316 },
{ 13021, -3044, -3792, 1267 },
{ 13112, -4487, -2250, 1665 },
{ -1668, -3744, -6456, 840 },
{ 7819, -4328, 2111, -506 },
{ 9571, -1336, -757, 487 },
{ 10032, -2562, 300, 199 },
{ -4745, -4122, -5486, -1493 },
{ -5896, 2378, -4787, -6947 },
{ -1193, -9117, -1237, -3114 },
{ 2783, -7108, -1575, -1447 },
{ -7334, -2062, -2212, 446 },
{ 6127, -2577, -315, -18 },
{ 9457, -1858, 102, 258 },
{ 7876, -4483, 2126, -538 },
{ -7172, -1795, -2069, 482 },
{ -7358, -2102, -2233, 440 },
{ -9170, -3509, -2674, -391 },
{ -2638, -2647, -1929, -1637 },
{ 1873, 9183, 1860, -5746 },
{ 9214, 1859, -1124, -2427 },
{ 13204, -3012, -4139, 1370 },
{ 12437, -4792, -256, 622 },
{ -2653, -1144, -3182, -6878 },
{ 9331, -1048, -828, 507 },
{ 1642, -620, -946, -4229 },
{ 4246, -7585, -533, -2259 },
{ -8988, -3891, -2807, 44 },
{ -2562, -2735, -1730, -1899 },
{ 3182, -483, -714, -1421 },
{ 7937, -3844, 2821, -1019 },
{ 10069, -2609, 314, 195 },
{ 8400, -3297, 1551, -155 },
{ -8529, -2775, -2432, -336 },
{ 9477, -1882, 108, 256 },
{ 75, -2241, -298, -6937 },
{ -9143, -4160, -2963, 5 },
{ -7270, -1958, -2156, 460 },
{ -2740, 3745, 5936, -1089 },
{ 8993, 1948, -683, -2704 },
{ 13101, -2835, -3854, 1055 },
{ 9543, -1961, 130, 250 },
{ 5272, -4270, 3124, -3157 },
{ -7696, -3383, -2907, -456 },
{ 7309, 2523, 434, -2461 },
{ 10275, -2867, 391, 172 },
{ 10940, -3721, 665, 97 },
{ 24, -310, -1262, 320 },
{ -8122, -2411, -2311, -271 },
{ -8511, -3067, -2337, 163 },
{ 326, -3846, 419, -933 },
{ 8895, 2194, -541, -2880 },
{ 12073, -1876, -2017, -601 },
{ 8729, -3423, 1674, -169 },
{ 12950, -3847, -3007, 1946 },
{ 10038, -2570, 302, 198 },
{ 9385, -2757, 1008, 41 },
{ -4720, -5006, -2852, -1161 },
{ 7869, -4326, 2135, -501 },
{ 2450, -8597, 1299, -2780 },
{ 10192, -2763, 360, 181 },
{ 11313, -4213, 833, 53 },
{ 10154, -2716, 345, 185 },
{ 9638, -1417, -737, 482 },
{ 3854, -4554, 2843, -3397 },
{ 6699, -5659, 2249, -1074 },
{ 11082, -3908, 728, 80 },
{ -1026, -9810, -805, -3462 },
{ 10396, -3746, 1367, -96 },
{ 10287, 988, -1915, -1437 },
{ 7953, 3878, -764, -3263 },
{ 12689, -3375, -3354, 2079 },
{ 6641, 3166, 231, -2089 },
{ -2348, -7354, -1944, -4122 },
{ 9290, -4039, 1885, -246 },
{ 4633, -6403, 1748, -1619 },
{ 11247, -4125, 802, 61 },
{ 9807, -2284, 219, 222 },
{ 9736, -1536, -706, 473 },
{ 8440, -3436, 1562, -176 },
{ 9307, -1021, -835, 509 },
{ 1698, -9025, 688, -3037 },
{ 10214, -2791, 368, 179 },
{ 8390, 3248, -758, -2989 },
{ 7201, 3316, 46, -2614 },
{ -88, -7809, -538, -4571 },
{ 6193, -5189, 2760, -1245 },
{ 12325, -1290, -3284, 253 },
{ 13064, -4075, -2824, 1877 },
{ 5333, 2999, 775, -1132 }
};
/**
* Sony's VAG ADPCM, decodes 16 bytes into 28 samples.
* The first 2 bytes are a header (shift, predictor, optional flag)
* Sony's PS ADPCM (sometimes called VAG), decodes 16 bytes into 28 samples.
* The first 2 bytes are a header (shift, predictor, optional flag).
* All variants are the same with minor differences.
*
* Flags:
* 0x0: Nothing
@ -172,6 +41,8 @@ static const int16_t HEVAG_coefs[128][4] = {
* 0x7: End marker + don't decode
* 0x8+ Not valid
*/
/* default */
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -214,6 +85,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
stream->adpcm_history2_32=hist2;
}
/* encrypted */
void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -259,8 +131,7 @@ void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
stream->adpcm_history2_32=hist2;
}
/* some TAITO games have garbage (?) in their flags, this decoder
* just ignores that byte */
/* some games have garbage (?) in their flags, this decoder just ignores that byte */
void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
@ -295,82 +166,8 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel
}
/**
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
* Variation of the regular VAG, uses 4 history samples and a bigger table.
*
* Original research and algorithm by id-daemon / daemon1.
*/
void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
uint8_t predict_nr, shift, flag, byte;
int32_t scale = 0;
int32_t sample;
int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32;
int32_t hist3 = stream->adpcm_history3_32;
int32_t hist4 = stream->adpcm_history4_32;
int i, sample_count;
int framesin = first_sample / 28;
/* 4 byte header: predictor = 3rd and 1st, shift = 2nd, flag = 4th */
byte = (uint8_t)read_8bit(stream->offset+framesin*16+0,stream->streamfile);
predict_nr = byte >> 4;
shift = byte & 0x0f;
byte = (uint8_t)read_8bit(stream->offset+framesin*16+1,stream->streamfile);
predict_nr = (byte & 0xF0) | predict_nr;
flag = byte & 0x0f; /* no change in flags */
first_sample = first_sample % 28;
if (first_sample & 1) { /* if first sample is odd, read byte first */
byte = read_8bit(stream->offset+(framesin*16)+2+first_sample/2,stream->streamfile);
}
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
sample = 0;
if (flag < 7 && predict_nr < 128) {
if (i & 1) {/* odd/even nibble */
scale = byte >> 4;
} else {
byte = read_8bit(stream->offset+(framesin*16)+2+i/2,stream->streamfile);
scale = byte & 0x0f;
}
if (scale > 7) { /* sign extend */
scale = scale - 16;
}
sample = (hist1 * HEVAG_coefs[predict_nr][0] +
hist2 * HEVAG_coefs[predict_nr][1] +
hist3 * HEVAG_coefs[predict_nr][2] +
hist4 * HEVAG_coefs[predict_nr][3] ) / 32;
sample = (sample + (scale << (20 - shift)) + 128) >> 8;
}
outbuf[sample_count] = clamp16(sample);
hist4 = hist3;
hist3 = hist2;
hist2 = hist1;
hist1 = sample;
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_history2_32 = hist2;
stream->adpcm_history3_32 = hist3;
stream->adpcm_history4_32 = hist4;
}
/**
* PS ADPCM of configurable size, with no flag.
* Found in PS3 Afrika (SGXD type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33.
*/
/* configurable frame size, with no flag
* Found in PS3 Afrika (SGXD type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33. */
void decode_psx_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) {
uint8_t predict_nr, shift, byte;
int16_t scale = 0;

View File

@ -1,3 +1,5 @@
#include "../vgmstream.h"
#ifdef VGM_USE_VORBIS
#include "wwise_vorbis_utils.h"
#define WWISE_VORBIS_USE_PRECOMPILED_WVC 1 /* if enabled vgmstream weights ~150kb more but doesn't need external .wvc packets */
@ -1161,3 +1163,5 @@ static int w_bits(ww_stream * ow, int num_bits, uint32_t value) {
fail:
return 0;
}
#endif

View File

@ -11,10 +11,12 @@ static const char* extension_list[] = {
"2dx9",
"2pfs",
//"aac", //common, also tri-Ace's
"aa3", //FFmpeg, not parsed (ATRAC3/ATRAC3PLUS/MP3/LPCM/WMA)
"aaap",
"aax",
//"ac3", //FFmpeg, not parsed //common?
"ace", //fake, for tri-Ace's formats
"acm",
"adm",
"adp",
@ -109,6 +111,7 @@ static const char* extension_list[] = {
"genh",
"gms",
"gsb",
"gtd",
"hca",
"hgc1",
@ -149,6 +152,7 @@ static const char* extension_list[] = {
"lwav", //fake extension, for looping
"matx",
"mc3",
"mca",
"mcg",
"mds",
@ -328,6 +332,7 @@ static const char* extension_list[] = {
"xwb",
"xwm", //FFmpeg, not parsed (XWMA)
"xwma", //FFmpeg, not parsed (XWMA)
"xws",
"xwv",
"ydsp",
@ -387,6 +392,8 @@ static const coding_info coding_info_list[] = {
{coding_PCM8_int, "8-bit PCM with 1 byte interleave"},
{coding_PCM8_SB_int, "8-bit PCM with sign bit, 1 byte interleave"},
{coding_CRI_ADX, "CRI ADX 4-bit ADPCM"},
{coding_CRI_ADX_exp, "CRI ADX 4-bit ADPCM with exponential scale"},
{coding_CRI_ADX_fixed, "CRI ADX 4-bit ADPCM with fixed coefficients"},
{coding_CRI_ADX_enc_8, "CRI ADX 4-bit ADPCM (type 8 encryption)"},
{coding_CRI_ADX_enc_9, "CRI ADX 4-bit ADPCM (type 8 encryption)"},
{coding_NGC_DSP, "Nintendo DSP 4-bit ADPCM"},
@ -403,7 +410,7 @@ static const coding_info coding_info_list[] = {
{coding_HEVAG, "Playstation Vita HEVAG 4-bit ADPCM"},
{coding_XA, "CD-ROM XA 4-bit ADPCM"},
{coding_XBOX, "XBOX 4-bit IMA ADPCM"},
{coding_INT_XBOX, "XBOX 4-bit IMA ADPCM (interleaved)"},
{coding_XBOX_int, "XBOX 4-bit IMA ADPCM (interleaved)"},
{coding_EA_XA, "Electronic Arts 4-bit ADPCM (XA based)"},
{coding_EA_ADPCM, "Electronic Arts R1 4-bit ADPCM (XA based)"},
{coding_SDX2, "Squareroot-delta-exact (SDX2) 8-bit DPCM"},
@ -411,20 +418,20 @@ static const coding_info coding_info_list[] = {
{coding_CBD2, "Cuberoot-delta-exact (CBD2) 8-bit DPCM"},
{coding_CBD2_int, "Cuberoot-delta-exact (CBD2) 8-bit DPCM with 1 byte interleave"},
{coding_DVI_IMA, "Intel DVI 4-bit IMA ADPCM"},
{coding_INT_DVI_IMA, "Interleaved Intel DVI 4-bit IMA ADPCM"},
{coding_DVI_IMA_int, "Intel DVI 4-bit IMA ADPCM (interleaved)"},
{coding_EACS_IMA, "EACS 4-bit IMA ADPCM"},
{coding_MAXIS_ADPCM, "Maxis XA (EA ADPCM Variant)"},
{coding_INT_IMA, "Interleaved 4-bit IMA ADPCM"},
{coding_IMA, "4-bit IMA ADPCM"},
{coding_IMA_int, "IMA 4-bit ADPCM (interleaved)"},
{coding_IMA, "IMA 4-bit ADPCM"},
{coding_MS_IMA, "Microsoft 4-bit IMA ADPCM"},
{coding_RAD_IMA, "'Radical' 4-bit IMA ADPCM"},
{coding_RAD_IMA_mono, "'Radical' 4-bit IMA ADPCM (mono)"},
{coding_RAD_IMA, "Radical 4-bit IMA ADPCM"},
{coding_RAD_IMA_mono, "Radical 4-bit IMA ADPCM (mono)"},
{coding_APPLE_IMA4, "Apple Quicktime 4-bit IMA ADPCM"},
{coding_SNDS_IMA, "Heavy Iron .snds 4-bit IMA ADPCM"},
{coding_OTNS_IMA, "Omikron: The Nomad Soul 4-bit IMA ADPCM"},
{coding_FSB_IMA, "FSB multichannel 4-bit IMA ADPCM"},
{coding_WWISE_IMA, "Audiokinetic Wwise 4-bit IMA ADPCM"},
{coding_WS, "Westwood Studios ADPCM"},
{coding_WS, "Westwood Studios VBR ADPCM"},
{coding_ACM, "InterPlay ACM"},
{coding_NWA0, "NWA DPCM Level 0"},
{coding_NWA1, "NWA DPCM Level 1"},
@ -439,6 +446,8 @@ static const coding_info coding_info_list[] = {
{coding_SASSC, "Activision / EXAKT SASSC 8-bit DPCM"},
{coding_LSF, "lsf 4-bit ADPCM"},
{coding_MTAF, "Konami MTAF 4-bit ADPCM"},
{coding_MC3, "Paradigm MC3 3-bit ADPCM"},
#ifdef VGM_USE_VORBIS
{coding_ogg_vorbis, "Ogg Vorbis"},
{coding_fsb_vorbis, "FSB Vorbis"},
@ -545,7 +554,7 @@ static const meta_info meta_info_list[] = {
{meta_CWAV, "Nintendo CWAV header"},
{meta_FWAV, "Nintendo FWAV header"},
{meta_PSX_XA, "RIFF/CDXA header"},
{meta_PS2_RXW, "RXWS header)"},
{meta_PS2_RXWS, "Sony RXWS header"},
{meta_PS2_RAW, "assumed RAW Interleaved PCM by .int extension"},
{meta_PS2_OMU, "Alter Echo OMU Header"},
{meta_DSP_STM, "Nintendo STM header"},
@ -677,6 +686,7 @@ static const meta_info meta_info_list[] = {
{meta_RSD6VAG, "RSD6/VAG Header"},
{meta_RSD6WADP, "RSD6/WADP Header"},
{meta_RSD6RADP, "RSD6/RADP Header"},
{meta_RSD6XMA, "RSD6/XMA Header"},
{meta_DC_ASD, "ASD Header"},
{meta_NAOMI_SPSD, "SPSD Header"},
{meta_FFXI_BGW, "BGW BGMStream header"},
@ -819,7 +829,7 @@ static const meta_info meta_info_list[] = {
{meta_TUN, "TUN 'ALP' header"},
{meta_WPD, "WPD 'DPW' header"},
{meta_MN_STR, "Mini Ninjas 'STR' header"},
{meta_PS2_MSS, "Guerilla MSCC header"},
{meta_MSS, "Guerilla MCSS header"},
{meta_PS2_HSF, "Lowrider 'HSF' header"},
{meta_PS3_IVAG, "PS3 'IVAG' Header"},
{meta_PS2_2PFS, "Konami 2PFS header"},
@ -847,6 +857,10 @@ static const meta_info meta_info_list[] = {
{meta_UBI_RAKI, "Ubisoft RAKI header"},
{meta_SXD, "Sony SXD header"},
{meta_OGL, "Shin'en OGL header"},
{meta_MC3, "Paradigm MC3 header"},
{meta_GTD, "GTD/GHS header"},
{meta_TA_AAC_X360, "tri-Ace AAC (X360) header"},
{meta_TA_AAC_PS3, "tri-Ace AAC (PS3) header"},
#ifdef VGM_USE_VORBIS
{meta_OGG_VORBIS, "Ogg Vorbis"},

View File

@ -1,41 +0,0 @@
noinst_LTLIBRARIES = liblayout.la
AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
liblayout_la_LDFLAGS =
liblayout_la_SOURCES =
liblayout_la_SOURCES += ast_blocked.c
liblayout_la_SOURCES += blocked.c
liblayout_la_SOURCES += caf_blocked.c
liblayout_la_SOURCES += ea_block.c
liblayout_la_SOURCES += halpst_blocked.c
liblayout_la_SOURCES += interleave.c
liblayout_la_SOURCES += nolayout.c
liblayout_la_SOURCES += xa_blocked.c
liblayout_la_SOURCES += wsi_blocked.c
liblayout_la_SOURCES += str_snds_blocked.c
liblayout_la_SOURCES += ws_aud_blocked.c
liblayout_la_SOURCES += interleave_byte.c
liblayout_la_SOURCES += mus_acm_layout.c
liblayout_la_SOURCES += aix_layout.c
liblayout_la_SOURCES += ims_block.c
liblayout_la_SOURCES += de2_blocked.c
liblayout_la_SOURCES += xvas_block.c
liblayout_la_SOURCES += vs_blocked.c
liblayout_la_SOURCES += emff_blocked.c
liblayout_la_SOURCES += thp_blocked.c
liblayout_la_SOURCES += gsb_blocked.c
liblayout_la_SOURCES += filp_blocked.c
liblayout_la_SOURCES += aax_layout.c
liblayout_la_SOURCES += ivaud_layout.c
liblayout_la_SOURCES += mxch_blocked.c
liblayout_la_SOURCES += psx_mgav_blocked.c
liblayout_la_SOURCES += ps2_adm_blocked.c
liblayout_la_SOURCES += bdsp_blocked.c
liblayout_la_SOURCES += tra_blocked.c
liblayout_la_SOURCES += ps2_iab_blocked.c
liblayout_la_SOURCES += ps2_strlr_blocked.c
liblayout_la_SOURCES += scd_int_layout.c
EXTRA_DIST = layout.h

View File

@ -1,69 +0,0 @@
#include "meta.h"
#include "../util.h"
/* 2DX (found in beatmaniaIIDX16 - EMPRESS (Arcade) */
VGMSTREAM * init_vgmstream_2dx(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("2dx",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x32445839) /* 2DX9 */
goto fail;
if (read_32bitBE(0x18,streamFile) != 0x52494646) /* RIFF */
goto fail;
if (read_32bitBE(0x20,streamFile) != 0x57415645) /* WAVE */
goto fail;
if (read_32bitBE(0x24,streamFile) != 0x666D7420) /* fmt */
goto fail;
if (read_32bitBE(0x6a,streamFile) != 0x64617461) /* data */
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x2e,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x72;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x30,streamFile);
vgmstream->coding_type = coding_MSADPCM;
vgmstream->num_samples = read_32bitLE(0x66,streamFile);
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bitLE(0x38,streamFile);
vgmstream->meta_type = meta_2DX9;
/* 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;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream;
fail:
/* clean up anything we may have opened */
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -1,264 +0,0 @@
noinst_LTLIBRARIES = libmeta.la
AM_CFLAGS = -Wall @CFLAGS@ -DVAR_ARRAYS -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix
libmeta_la_LDFLAGS =
libmeta_la_SOURCES =
libmeta_la_SOURCES += Cstr.c
libmeta_la_SOURCES += adx.c
libmeta_la_SOURCES += afc_header.c
libmeta_la_SOURCES += agsc.c
libmeta_la_SOURCES += ast.c
libmeta_la_SOURCES += brstm.c
libmeta_la_SOURCES += ea_header.c
libmeta_la_SOURCES += gcsw.c halpst.c
libmeta_la_SOURCES += nds_strm.c
libmeta_la_SOURCES += ngc_adpdtk.c
libmeta_la_SOURCES += ngc_caf.c
libmeta_la_SOURCES += ngc_dsp_std.c
libmeta_la_SOURCES += ps2_ads.c
libmeta_la_SOURCES += ps2_exst.c
libmeta_la_SOURCES += ps2_ild.c
libmeta_la_SOURCES += ps2_int.c
libmeta_la_SOURCES += ps2_mib.c
libmeta_la_SOURCES += ps2_mic.c
libmeta_la_SOURCES += ps2_npsf.c
libmeta_la_SOURCES += ps2_pnb.c
libmeta_la_SOURCES += ps2_rxw.c
libmeta_la_SOURCES += ps2_str.c
libmeta_la_SOURCES += ps2_svag.c
libmeta_la_SOURCES += ps2_vag.c
libmeta_la_SOURCES += ps2_vpk.c
libmeta_la_SOURCES += psx_cdxa.c
libmeta_la_SOURCES += raw.c
libmeta_la_SOURCES += rs03.c
libmeta_la_SOURCES += rsf.c
libmeta_la_SOURCES += rwsd.c
libmeta_la_SOURCES += psx_gms.c
libmeta_la_SOURCES += xbox_xwav.c
libmeta_la_SOURCES += xbox_wavm.c
libmeta_la_SOURCES += genh.c
libmeta_la_SOURCES += ogg_vorbis_file.c
libmeta_la_SOURCES += ps2_bmdx.c
libmeta_la_SOURCES += aifc.c
libmeta_la_SOURCES += str_snds.c
libmeta_la_SOURCES += ws_aud.c
libmeta_la_SOURCES += ahx.c
libmeta_la_SOURCES += ivb.c
libmeta_la_SOURCES += svs.c
libmeta_la_SOURCES += riff.c
libmeta_la_SOURCES += pos.c
libmeta_la_SOURCES += nwa.c
libmeta_la_SOURCES += ps2_rws.c
libmeta_la_SOURCES += ps2_hgc1.c
libmeta_la_SOURCES += xss.c
libmeta_la_SOURCES += ps2_sl3.c
libmeta_la_SOURCES += ps2_aus.c
libmeta_la_SOURCES += fsb.c
libmeta_la_SOURCES += fsb5.c
libmeta_la_SOURCES += rsd.c
libmeta_la_SOURCES += rwx.c
libmeta_la_SOURCES += xwb.c
libmeta_la_SOURCES += ea_old.c
libmeta_la_SOURCES += ps2_xa30.c
libmeta_la_SOURCES += musc.c
libmeta_la_SOURCES += ps2_leg.c
libmeta_la_SOURCES += ps2_filp.c
libmeta_la_SOURCES += ps2_ikm.c
libmeta_la_SOURCES += musx.c
libmeta_la_SOURCES += ps2_sfs.c
libmeta_la_SOURCES += sat_dvi.c
libmeta_la_SOURCES += ps2_bg00.c
libmeta_la_SOURCES += dc_kcey.c
libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c
libmeta_la_SOURCES += ps2_psh.c
libmeta_la_SOURCES += mus_acm.c
libmeta_la_SOURCES += sli.c
libmeta_la_SOURCES += sfl.c
libmeta_la_SOURCES += pcm.c
libmeta_la_SOURCES += ps2_psw.c
libmeta_la_SOURCES += rkv.c
libmeta_la_SOURCES += ps2_vas.c
libmeta_la_SOURCES += ps2_tec.c
libmeta_la_SOURCES += ps2_enth.c
libmeta_la_SOURCES += sdt.c
libmeta_la_SOURCES += aix.c
libmeta_la_SOURCES += ngc_tydsp.c
libmeta_la_SOURCES += wvs.c
libmeta_la_SOURCES += xbox_stma.c
libmeta_la_SOURCES += xbox_ims.c
libmeta_la_SOURCES += de2.c
libmeta_la_SOURCES += dc_str.c
libmeta_la_SOURCES += xbox_xmu.c
libmeta_la_SOURCES += ngc_bh2pcm.c
libmeta_la_SOURCES += sat_sap.c
libmeta_la_SOURCES += dc_idvi.c
libmeta_la_SOURCES += ps2_rnd.c
libmeta_la_SOURCES += xbox_xvas.c
libmeta_la_SOURCES += kraw.c
libmeta_la_SOURCES += ps2_xa2.c
libmeta_la_SOURCES += idsp.c
libmeta_la_SOURCES += ngc_ymf.c
libmeta_la_SOURCES += nds_sad.c
libmeta_la_SOURCES += ps2_ccc.c
libmeta_la_SOURCES += psx_fag.c
libmeta_la_SOURCES += ps2_mihb.c
libmeta_la_SOURCES += ngc_pdt.c
libmeta_la_SOURCES += wii_mus.c
libmeta_la_SOURCES += dc_asd.c
libmeta_la_SOURCES += naomi_spsd.c
libmeta_la_SOURCES += bgw.c
libmeta_la_SOURCES += ps2_ass.c
libmeta_la_SOURCES += ngc_waa_wac_wad_wam.c
libmeta_la_SOURCES += seg.c
libmeta_la_SOURCES += str_asr.c
libmeta_la_SOURCES += zwdsp.c
libmeta_la_SOURCES += gca.c
libmeta_la_SOURCES += ish_isd.c
libmeta_la_SOURCES += spt_spd.c
libmeta_la_SOURCES += ydsp.c
libmeta_la_SOURCES += gsp_gsb.c
libmeta_la_SOURCES += ngc_ssm.c
libmeta_la_SOURCES += msvp.c
libmeta_la_SOURCES += ps2_joe.c
libmeta_la_SOURCES += vs.c
libmeta_la_SOURCES += vgs.c
libmeta_la_SOURCES += dc_dcsw_dcs.c
libmeta_la_SOURCES += wii_smp.c
libmeta_la_SOURCES += ss_stream.c
libmeta_la_SOURCES += emff.c
libmeta_la_SOURCES += thp.c
libmeta_la_SOURCES += wii_sts.c
libmeta_la_SOURCES += capdsp.c
libmeta_la_SOURCES += wii_sng.c
libmeta_la_SOURCES += aax.c
libmeta_la_SOURCES += ps2_p2bt.c
libmeta_la_SOURCES += ps2_gbts.c
libmeta_la_SOURCES += ngc_ffcc_str.c
libmeta_la_SOURCES += sat_baka.c
libmeta_la_SOURCES += nds_swav.c
libmeta_la_SOURCES += vsf.c
libmeta_la_SOURCES += nds_rrds.c
libmeta_la_SOURCES += ps2_tk5.c
libmeta_la_SOURCES += ads.c
libmeta_la_SOURCES += wii_str.c
libmeta_la_SOURCES += zsd.c
libmeta_la_SOURCES += ps2_mcg.c
libmeta_la_SOURCES += redspark.c
libmeta_la_SOURCES += ivaud.c
libmeta_la_SOURCES += ps2_vgs.c
libmeta_la_SOURCES += ps2_sps.c
libmeta_la_SOURCES += nds_hwas.c
libmeta_la_SOURCES += ngc_lps.c
libmeta_la_SOURCES += ps2_snd.c
libmeta_la_SOURCES += naomi_adpcm.c
libmeta_la_SOURCES += sd9.c
libmeta_la_SOURCES += 2dx9.c
libmeta_la_SOURCES += ngc_dsp_ygo.c
libmeta_la_SOURCES += ps2_vgv.c
libmeta_la_SOURCES += ngc_gcub.c
libmeta_la_SOURCES += maxis_xa.c
libmeta_la_SOURCES += ngc_sck_dsp.c
libmeta_la_SOURCES += apple_caff.c
libmeta_la_SOURCES += pc_mxst.c
libmeta_la_SOURCES += pc_sob.c
libmeta_la_SOURCES += exakt_sc.c
libmeta_la_SOURCES += wii_bns.c
libmeta_la_SOURCES += pona.c
libmeta_la_SOURCES += xbox_hlwav.c
libmeta_la_SOURCES += stx.c
libmeta_la_SOURCES += ps2_stm.c
libmeta_la_SOURCES += myspd.c
libmeta_la_SOURCES += his.c
libmeta_la_SOURCES += ps2_ast.c
libmeta_la_SOURCES += dmsg_segh.c
libmeta_la_SOURCES += ngc_dsp_konami.c
libmeta_la_SOURCES += ps2_ster.c
libmeta_la_SOURCES += bnsf.c
libmeta_la_SOURCES += ps2_wb.c
libmeta_la_SOURCES += s14_sss.c
libmeta_la_SOURCES += ps2_gcm.c
libmeta_la_SOURCES += ps2_smpl.c
libmeta_la_SOURCES += ps2_msa.c
libmeta_la_SOURCES += pc_smp.c
libmeta_la_SOURCES += p3d.c
libmeta_la_SOURCES += ps2_adsc.c
libmeta_la_SOURCES += psx_str_mgav.c
libmeta_la_SOURCES += ngc_bo2.c
libmeta_la_SOURCES += ngc_dsp_mpds.c
libmeta_la_SOURCES += ps2_khv.c
libmeta_la_SOURCES += ps2_voi.c
libmeta_la_SOURCES += dsp_sth_str.c
libmeta_la_SOURCES += ps2_b1s.c
libmeta_la_SOURCES += ps2_wad.c
libmeta_la_SOURCES += ps2_lpcm.c
libmeta_la_SOURCES += ps2_adm.c
libmeta_la_SOURCES += dsp_bdsp.c
libmeta_la_SOURCES += ps2_vms.c
libmeta_la_SOURCES += ps2_xau.c
libmeta_la_SOURCES += gh3_bar.c
libmeta_la_SOURCES += ffw.c
libmeta_la_SOURCES += ps2_jstm.c
libmeta_la_SOURCES += ps3_xvag.c
libmeta_la_SOURCES += ps3_cps.c
libmeta_la_SOURCES += sqex_scd.c
libmeta_la_SOURCES += ngc_nst_dsp.c
libmeta_la_SOURCES += baf.c
libmeta_la_SOURCES += ps3_msf.c
libmeta_la_SOURCES += nub_vag.c
libmeta_la_SOURCES += ps3_past.c
libmeta_la_SOURCES += sgxd.c
libmeta_la_SOURCES += ngca.c
libmeta_la_SOURCES += wii_ras.c
libmeta_la_SOURCES += ps2_spm.c
libmeta_la_SOURCES += x360_tra.c
libmeta_la_SOURCES += ps2_iab.c
libmeta_la_SOURCES += ps2_strlr.c
libmeta_la_SOURCES += lsf.c
libmeta_la_SOURCES += vawx.c
libmeta_la_SOURCES += pc_snds.c
libmeta_la_SOURCES += ps2_wmus.c
libmeta_la_SOURCES += mattel_hyperscan.c
libmeta_la_SOURCES += ios_psnd.c
libmeta_la_SOURCES += pc_adp.c
libmeta_la_SOURCES += excitebots.c
libmeta_la_SOURCES += ps2_mtaf.c
libmeta_la_SOURCES += ps3_klbs.c
libmeta_la_SOURCES += tun.c
libmeta_la_SOURCES += wpd.c
libmeta_la_SOURCES += mn_str.c
libmeta_la_SOURCES += ps2_mss.c
libmeta_la_SOURCES += ps2_hsf.c
libmeta_la_SOURCES += ps3_ivag.c
libmeta_la_SOURCES += ps2_2pfs.c
libmeta_la_SOURCES += ubi_ckd.c
libmeta_la_SOURCES += otm.c
libmeta_la_SOURCES += bcstm.c
libmeta_la_SOURCES += bfwav.c
libmeta_la_SOURCES += bfstm.c
libmeta_la_SOURCES += g1l.c
libmeta_la_SOURCES += ps2_vbk.c
libmeta_la_SOURCES += mca.c
libmeta_la_SOURCES += btsnd.c
libmeta_la_SOURCES += hca.c
libmeta_la_SOURCES += ps2_svag_snk.c
libmeta_la_SOURCES += mp4.c
libmeta_la_SOURCES += xma.c
libmeta_la_SOURCES += ps2_vds_vdm.c
libmeta_la_SOURCES += x360_cxs.c
libmeta_la_SOURCES += dsp_adx.c
libmeta_la_SOURCES += bik.c
libmeta_la_SOURCES += akb.c
libmeta_la_SOURCES += x360_ast.c
libmeta_la_SOURCES += wwise.c
libmeta_la_SOURCES += ubi_raki.c
libmeta_la_SOURCES += x360_pasx.c
libmeta_la_SOURCES += x360_nub.c
libmeta_la_SOURCES += sxd.c
libmeta_la_SOURCES += ogl.c
EXTRA_DIST = meta.h

View File

@ -59,7 +59,7 @@ VGMSTREAM * init_vgmstream_ads(STREAMFILE *streamFile) {
start_offset = 0x28;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x0c,streamFile);
vgmstream->coding_type = coding_INT_XBOX;
vgmstream->coding_type = coding_XBOX_int;
vgmstream->num_samples = (read_32bitBE(0x24,streamFile) / 36 *64 / vgmstream->channels)-64; // to avoid the "pop" at the loop point
vgmstream->layout_type = channel_count == 1 ? layout_none : layout_interleave;
vgmstream->interleave_block_size = 0x24;

View File

@ -18,9 +18,11 @@ VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile) {
int loop_flag = 0, channel_count;
int32_t loop_start_sample = 0, loop_end_sample = 0;
uint16_t version_signature;
uint8_t encoding_type;
uint8_t frame_size;
meta_t header_type;
coding_t coding_type = coding_CRI_ADX;
coding_t coding_type;
int16_t coef1, coef2;
uint16_t xor_start=0,xor_mult=0,xor_add=0;
@ -40,10 +42,23 @@ VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile) {
/* check for encoding type */
/* 0x02 is for some unknown fixed filter, 0x03 is standard ADX, 0x04 is
* ADX with exponential scale, 0x10 is AHX for DC, 0x11 is AHX */
if (read_8bit(0x04,streamFile) != 3) goto fail;
encoding_type = read_8bit(0x04, streamFile);
/* check for frame size (only 18 is supported at the moment) */
if (read_8bit(0x05,streamFile) != 18) goto fail;
switch (encoding_type) {
case 2:
coding_type = coding_CRI_ADX_fixed;
break;
case 3:
coding_type = coding_CRI_ADX;
break;
case 4:
coding_type = coding_CRI_ADX_exp;
break;
default:
goto fail;
}
frame_size = read_8bit(0x05, streamFile);
/* check for bits per sample? (only 4 makes sense for ADX) */
if (read_8bit(0x06,streamFile) != 4) goto fail;
@ -142,13 +157,27 @@ VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_type;
vgmstream->layout_type = channel_count==1 ? layout_none : layout_interleave;
vgmstream->interleave_block_size = 18;
vgmstream->interleave_block_size = frame_size;
vgmstream->meta_type = header_type;
/* calculate filter coefficients */
{
if (coding_type == coding_CRI_ADX_fixed) {
int i;
for (i = 0; i < channel_count; i++) {
vgmstream->ch[i].adpcm_coef[0] = 0x0000;
vgmstream->ch[i].adpcm_coef[1] = 0x0000;
vgmstream->ch[i].adpcm_coef[2] = 0x0F00;
vgmstream->ch[i].adpcm_coef[3] = 0x0000;
vgmstream->ch[i].adpcm_coef[4] = 0x1CC0;
vgmstream->ch[i].adpcm_coef[5] = 0xF300;
vgmstream->ch[i].adpcm_coef[6] = 0x1880;
vgmstream->ch[i].adpcm_coef[7] = 0xF240;
}
}
else {
double x,y,z,a,b,c;
int i;
/* high-pass cutoff frequency, always 500 that I've seen */
uint16_t cutoff = (uint16_t)read_16bitBE(0x10,streamFile);
@ -160,8 +189,13 @@ VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile) {
b = M_SQRT2-1.0;
c = (a-sqrt((a+b)*(a-b)))/b;
coef1 = floor(c*8192);
coef2 = floor(c*c*-4096);
coef1 = (short)(c*8192);
coef2 = (short)(c*c*-4096);
for (i = 0; i < channel_count; i++) {
vgmstream->ch[i].adpcm_coef[0] = coef1;
vgmstream->ch[i].adpcm_coef[1] = coef2;
}
}
/* init decoder */
@ -169,9 +203,6 @@ VGMSTREAM * init_vgmstream_adx(STREAMFILE *streamFile) {
int i;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].adpcm_coef[0] = coef1;
vgmstream->ch[i].adpcm_coef[1] = coef2;
/* 2 hist shorts per ch, corresponding to the very first original sample repeated (verified with CRI's encoders).
* Not vital as their effect is small, after a few samples they don't matter, and most songs start in silence. */
if (hist_offset) {

View File

@ -36,11 +36,12 @@ fail:
/* AKB - found in SQEX iOS games */
VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
size_t filesize;
off_t start_offset, extra_data_offset = 0;
size_t file_size, header_size, extra_header_size = 0, extra_data_size = 0;
int loop_flag = 0, channel_count, codec;
/* check extensions */
/* .akb.bytes is the usual extension in later games */
if ( !check_extensions(streamFile, "akb") )
goto fail;
@ -49,41 +50,58 @@ VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile) {
goto fail;
channel_count = read_8bit(0x0d,streamFile);
loop_flag = read_32bitLE(0x18,streamFile) > 0;
loop_flag = read_32bitLE(0x18,streamFile) > 0; /* loop end */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* 0x04: version? (iPad/IPhone?) 0x24: file_id? */
filesize = read_32bitLE(0x08,streamFile);
/* 0x04 (2): version (iPad/IPhone?) */
header_size = read_16bitLE(0x06,streamFile);
file_size = read_32bitLE(0x08,streamFile);
codec = read_8bit(0x0c,streamFile);
vgmstream->sample_rate = (uint16_t)read_16bitLE(0x0e,streamFile);
vgmstream->num_samples = read_32bitLE(0x10,streamFile);
vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x18,streamFile);
/* 0x0c: some size based on codec 0x10+: unk stuff? 0xc0+: data stuff? */
vgmstream->loop_end_sample = read_32bitLE(0x18,streamFile);
vgmstream->meta_type = meta_AKB;
/* should be ok but not exact (probably more complex, see AKB2) */
if ( header_size >= 0x44) { /* v2 */
/* 0x10+: config? (pan, volume), 0x24: file_id? */
extra_data_size = read_16bitLE(0x1c,streamFile);
extra_header_size = read_16bitLE(0x28,streamFile);
extra_data_offset = header_size + extra_header_size;
start_offset = extra_data_offset + extra_data_size;
/* ~num_samples at extra_data_offset + 0x04/0x0c? */
}
else { /* v0 */
start_offset = header_size;
}
switch (codec) {
#if 0
case 0x02: { /* some kind of ADPCM or PCM [various SFX] */
start_offset = 0xC4;
vgmstream->coding_type = coding_APPLE_IMA4;
vgmstream->layout_type = channel_count==1 ? layout_none : layout_interleave;
vgmstream->interleave_block_size = 0x100;
case 0x02: { /* MSAPDCM [various SFX] */
vgmstream->coding_type = coding_MSADPCM;
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bitLE(extra_data_offset + 0x02,streamFile);
/* adjusted samples; bigger or smaller than base samples, but seems more accurate
* (base samples may have more than possible and read over file size otherwise, very strange)
* loop_end seems to exist even with loop disabled */
vgmstream->num_samples = read_32bitLE(extra_data_offset + 0x04, streamFile);
vgmstream->loop_start_sample = read_32bitLE(extra_data_offset + 0x08, streamFile);
vgmstream->loop_end_sample = read_32bitLE(extra_data_offset + 0x0c, streamFile);
break;
}
#endif
#ifdef VGM_USE_FFMPEG
case 0x05: { /* ogg vorbis [Final Fantasy VI, Dragon Quest II-VI] */
case 0x05: { /* Ogg Vorbis [Final Fantasy VI, Dragon Quest II-VI] */
/* Starting from an offset in the current libvorbis code is a bit hard so just use FFmpeg.
* Decoding seems to produce the same output with (inaudible) +-1 lower byte differences here and there. */
* Decoding seems to produce the same output with (inaudible) +-1 lower byte differences due to rounding. */
ffmpeg_codec_data *ffmpeg_data;
start_offset = 0xCC;
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,filesize-start_offset);
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,file_size-start_offset);
if ( !ffmpeg_data ) goto fail;
vgmstream->codec_data = ffmpeg_data;
@ -98,8 +116,7 @@ VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile) {
/* init_vgmstream_akb above has priority, but this works fine too */
ffmpeg_codec_data *ffmpeg_data;
start_offset = 0x20;
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,filesize-start_offset);
ffmpeg_data = init_ffmpeg_offset(streamFile, start_offset,file_size-start_offset);
if ( !ffmpeg_data ) goto fail;
vgmstream->codec_data = ffmpeg_data;
@ -115,7 +132,6 @@ VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile) {
}
#endif
/* AAC @20 in some cases? (see above) */
default:
goto fail;
}
@ -141,6 +157,7 @@ VGMSTREAM * init_vgmstream_akb2_multi(STREAMFILE *streamFile) {
int akb_header_size, sound_index = 0, sound_offset_data, sound, sound_header_size, material_offset_data, material_index = 0, material, extradata, encryption_flag;
/* check extensions */
/* .akb.bytes is the usual extension in later games */
if ( !check_extensions(streamFile, "akb") )
goto fail;
@ -161,7 +178,7 @@ VGMSTREAM * init_vgmstream_akb2_multi(STREAMFILE *streamFile) {
header_offset = material;
channel_count = read_8bit(header_offset+0x02,streamFile);
loop_flag = read_32bitLE(header_offset+0x14,streamFile) > 0;
loop_flag = read_32bitLE(header_offset+0x14,streamFile) > 0; /* loop end */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
@ -175,17 +192,23 @@ VGMSTREAM * init_vgmstream_akb2_multi(STREAMFILE *streamFile) {
* Actual num_samples would be loop_end_sample+1, but more testing is needed */
vgmstream->num_samples = read_32bitLE(header_offset+0x0c,streamFile);
vgmstream->loop_start_sample = read_32bitLE(header_offset+0x10,streamFile);
vgmstream->loop_end_sample = read_32bitLE(header_offset+0x14,streamFile);
vgmstream->loop_end_sample = read_32bitLE(header_offset+0x14,streamFile);
vgmstream->meta_type = meta_AKB;
switch (codec) {
case 0x02: { /* msadpcm [The Irregular at Magic High School Lost Zero (Android)] */
case 0x02: { /* MSAPDCM [The Irregular at Magic High School Lost Zero (Android)] */
if (encryption_flag) goto fail;
vgmstream->num_samples = read_32bitLE(extradata + 0x04, streamFile);
vgmstream->coding_type = coding_MSADPCM;
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bitLE(extradata + 0x02, streamFile);
/* adjusted samples; bigger or smaller than base samples, but seems more accurate
* (base samples may have more than possible and read over file size otherwise, very strange)
* loop_end seems to exist even with loop disabled */
vgmstream->num_samples = read_32bitLE(extradata + 0x04, streamFile);
vgmstream->loop_start_sample = read_32bitLE(extradata + 0x08, streamFile);
vgmstream->loop_end_sample = read_32bitLE(extradata + 0x0c, streamFile);
break;
}

View File

@ -75,7 +75,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
if (seek_offset == 0) goto fail;
if ((uint32_t)read_32bitBE(seek_offset, streamFile) != 0x5345454B) { /* "SEEK" If this header doesn't exist, assuming that the file is IMA */
ima = 1;
coding_type = coding_INT_IMA;
coding_type = coding_IMA_int;
}
else
coding_type = coding_NGC_DSP;

View File

@ -29,7 +29,7 @@ VGMSTREAM * init_vgmstream_dc_idvi(STREAMFILE *streamFile) {
vgmstream->channels = channel_count;
start_offset = 0x800;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->coding_type = coding_DVI_IMA_int;
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x0C,streamFile);

View File

@ -165,17 +165,27 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
{
if (coding == coding_SDX2) {
coding = coding_SDX2_int;
vgmstream->coding_type = coding_SDX2_int;
}
//todo if 0 do this too (most codecs seem to enter an infinite loop otherwise)
if(vgmstream->interleave_block_size==0xffffffff)
vgmstream->layout_type=layout_none;
if (vgmstream->interleave_block_size==0xffffffff) {
vgmstream->layout_type = layout_none;
}
else {
vgmstream->layout_type = layout_interleave;
if(coding==coding_DVI_IMA)
coding=coding_INT_DVI_IMA;
if(coding==coding_IMA)
coding=coding_INT_IMA;
if (coding == coding_DVI_IMA)
coding = coding_DVI_IMA_int;
if (coding == coding_IMA)
coding = coding_IMA_int;
}
/* to avoid endless loops */
if (!interleave && (
coding == coding_PSX ||
coding == coding_PSX_badflags ||
coding == coding_IMA_int ||
coding == coding_DVI_IMA_int ||
coding == coding_SDX2_int) ) {
goto fail;
}
} else {
vgmstream->layout_type = layout_none;
@ -191,11 +201,15 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
break;
case coding_MS_IMA:
if (!interleave) goto fail; /* creates garbage */
vgmstream->interleave_block_size = interleave;
vgmstream->layout_type = layout_none;
break;
case coding_MSADPCM:
if (channel_count != 2) goto fail;
if (channel_count > 2) goto fail;
if (!interleave) goto fail; /* creates garbage */
vgmstream->interleave_block_size = interleave;
vgmstream->layout_type = layout_none;
break;
@ -208,9 +222,11 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
break;
case coding_NGC_DSP:
if (dsp_interleave_type == 0) {
if (!interleave) goto fail;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = interleave;
} else if (dsp_interleave_type == 1) {
if (!interleave) goto fail;
vgmstream->layout_type = layout_interleave_byte;
vgmstream->interleave_block_size = interleave;
} else if (dsp_interleave_type == 2) {

View File

@ -0,0 +1,86 @@
#include "meta.h"
#include "../coding/coding.h"
typedef enum { XMA2 } gtd_codec;
/* GTD - found in Knights Contract (X360, PS3), Valhalla Knights 3 (PSV) */
VGMSTREAM * init_vgmstream_gtd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset, chunk_offset;
size_t data_size, chunk_size;
int loop_flag, channel_count, sample_rate;
int num_samples, loop_start_sample, loop_end_sample;
gtd_codec codec;
/* check extension, case insensitive */
if ( !check_extensions(streamFile,"gtd"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x47485320) /* "GHS " */
goto fail;
VGM_LOG("1");
/* header type, not formally specified */
if (read_32bitBE(0x04,streamFile) == 1 && read_16bitBE(0x0C,streamFile) == 0x0166) { /* XMA2 */
/* 0x08(4): seek table size */
chunk_offset = 0x0c; /* custom header with a "fmt " data chunk inside */
chunk_size = 0x34;
channel_count = read_16bitBE(chunk_offset+0x02,streamFile);
sample_rate = read_32bitBE(chunk_offset+0x04,streamFile);
xma2_parse_fmt_chunk_extra(streamFile, chunk_offset, &loop_flag, &num_samples, &loop_start_sample, &loop_end_sample, 1);
start_offset = read_32bitBE(0x58,streamFile); /* always 0x800 */
data_size = read_32bitBE(0x5c,streamFile);
/* 0x40(18): null, 0x60(4): header size (0x70), 0x64(4): seek table size again, 0x68(8): null */
/* 0x70: seek table; then a "STPR" chunk with the file ID and filename */
codec = XMA2;
}
else {
/* there are PSV (LE, ATRAC9) and PS3 (MSF inside?) variations, somewhat-but-not-quite similar
* (contain the "STPR" chunk but the rest is mostly different) */
goto fail;
}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = num_samples;
vgmstream->loop_start_sample = loop_start_sample;
vgmstream->loop_end_sample = loop_end_sample;
vgmstream->meta_type = meta_GTD;
switch(codec) {
case XMA2: {
#ifdef VGM_USE_FFMPEG
uint8_t buf[0x100];
size_t bytes;
bytes = ffmpeg_make_riff_xma_from_fmt_chunk(buf,0x100, chunk_offset,chunk_size, data_size, streamFile, 1);
if (bytes <= 0) goto fail;
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
if ( !vgmstream->codec_data ) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
break;
}
#endif
default:
goto fail;
}
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -36,7 +36,7 @@ VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile) {
block_table_offset = read_32bitLE(0,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(block_table_offset + 0x04,streamFile);
vgmstream->coding_type = coding_INT_IMA;
vgmstream->coding_type = coding_IMA_int;
vgmstream->layout_type = layout_ivaud_blocked;
vgmstream->meta_type = meta_PC_IVAUD;

View File

@ -0,0 +1,46 @@
#include "meta.h"
/* MC3 - from Paradigm games [Spy Hunter, MX Rider, Terminator 3] */
VGMSTREAM * init_vgmstream_mc3(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* check extension, case insensitive */
if ( !check_extensions(streamFile,"mc3"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x4D504333) /* "MPC3" */
goto fail;
if (read_32bitBE(0x04,streamFile) != 0x00011400) /* version? */
goto fail;
start_offset = 0x1c;
loop_flag = 0;
channel_count = read_32bitLE(0x08, streamFile);
if (channel_count > 2) goto fail; /* not seen, decoder must be adapted */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->coding_type = coding_MC3;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_MC3;
vgmstream->sample_rate = read_32bitLE(0x0c, streamFile);
vgmstream->num_samples = read_32bitLE(0x10, streamFile) * 10; /* sizes in sub-blocks of 10 samples (without headers) */
vgmstream->interleave_block_size = (read_32bitLE(0x14, streamFile) * 4 * channel_count) + 4;
if (read_32bitLE(0x18, streamFile) + start_offset != get_streamfile_size(streamFile))
goto fail;
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -27,6 +27,8 @@ VGMSTREAM * init_vgmstream_ngc_adpdtk(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ngc_dsp_std(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ngc_mdsp_std(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ngc_dsp_stm(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ngc_mpdsp(STREAMFILE *streamFile);
@ -47,6 +49,7 @@ VGMSTREAM * init_vgmstream_rwsd(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_cdxa(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_rxws(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_int(STREAMFILE *streamFile);
@ -197,13 +200,9 @@ VGMSTREAM * init_vgmstream_xa30(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musc(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musx_v004(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musx_v005(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musx_v006(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musx_v010(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_musx_v201(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_leg(STREAMFILE * streamFile);
@ -315,28 +314,22 @@ VGMSTREAM * init_vgmstream_ngc_pdt(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_wii_mus(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd2vag(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd2pcmb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd2xadp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3pcm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3pcmb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3gadp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3vag(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd4pcmb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd4pcm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd4radp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd4vag(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd6vag(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd6wadp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd6xadp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd6radp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_rsd6xma(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_dc_asd(STREAMFILE * streamFile);
@ -436,18 +429,12 @@ VGMSTREAM * init_vgmstream_ps2_xa2_rrp(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_rsd3vag(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ngc_lps(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3pcmb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd3gadp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_sd9(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_2dx9(STREAMFILE * streamFile);
@ -625,7 +612,7 @@ VGMSTREAM * init_vgmstream_wpd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_mn_str(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_mss(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_mss(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_hsf(STREAMFILE* streamFile);
@ -633,8 +620,6 @@ VGMSTREAM * init_vgmstream_ps3_ivag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_2pfs(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ubi_ckd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_vbk(STREAMFILE* streamFile);
@ -669,7 +654,6 @@ VGMSTREAM * init_vgmstream_x360_cxs(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_dsp_adx(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_akb_multi(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_akb2_multi(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_x360_ast(STREAMFILE *streamFile);
@ -686,4 +670,11 @@ VGMSTREAM * init_vgmstream_sxd(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ogl(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_mc3(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_gtd(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ta_aac_x360(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile);
#endif /*_META_H*/

View File

@ -0,0 +1,66 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* Guerrilla's MSS - Found in ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */
VGMSTREAM * init_vgmstream_mss(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
size_t data_size;
int loop_flag = 0, channel_count;
/* check extension, case insensitive */
if (!check_extensions(streamFile, "mss")) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D435353) /* "MCSS" */
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x16,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
/* 0x04: version? (always 0x00000100 LE) */
start_offset = read_32bitLE(0x08,streamFile);
data_size = read_32bitLE(0x0c,streamFile);
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
/* 0x14(1): 1/2/3/4 if 2/4/6/8ch, 0x15(1): 0/1?, 0x16: ch */
vgmstream->interleave_block_size = read_32bitLE(0x18,streamFile);
vgmstream->num_samples = read_32bitLE(0x1C,streamFile);
vgmstream->meta_type = meta_MSS;
/* no other way to know */
if (vgmstream->interleave_block_size == 0x4800) {
/* interleaved stereo streams (2ch 0x4800 + 2ch 0x4800 = 4ch) */
vgmstream->coding_type = coding_XBOX;
vgmstream->layout_type = layout_interleave;
/* header values are somehow off? */
data_size = get_streamfile_size(streamFile);
vgmstream->num_samples = ms_ima_bytes_to_samples(data_size, 0x24*vgmstream->channels, vgmstream->channels);
vgmstream->channels = 2; //todo add support for interleave stereo streams
}
else {
/* 0x800 interleave */
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = channel_count == 1 ? layout_none : layout_interleave;
if (vgmstream->num_samples * vgmstream->channels <= data_size)
vgmstream->num_samples = vgmstream->num_samples / 16 * 28;
}
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -28,7 +28,7 @@ VGMSTREAM * init_vgmstream_nds_hwas(STREAMFILE *streamFile) {
start_offset = 0x200;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->coding_type = coding_INT_IMA;
vgmstream->coding_type = coding_IMA_int;
vgmstream->num_samples = read_32bitLE(0x14,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x10,streamFile);

View File

@ -27,7 +27,7 @@ VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
switch (read_8bit(0x33,streamFile)&0xf0)
{
case 0x70:
coding_type = coding_INT_IMA;
coding_type = coding_IMA_int;
break;
case 0xb0:
coding_type = coding_NDS_PROCYON;
@ -61,7 +61,7 @@ VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_type;
if (coding_type == coding_INT_IMA)
if (coding_type == coding_IMA_int)
vgmstream->num_samples =
(read_32bitLE(0x40,streamFile)-start_offset)/channel_count*2;
else if (coding_type == coding_NDS_PROCYON)
@ -72,7 +72,7 @@ VGMSTREAM * init_vgmstream_sadl(STREAMFILE *streamFile) {
if (loop_flag)
{
if (coding_type == coding_INT_IMA)
if (coding_type == coding_IMA_int)
vgmstream->loop_start_sample = (read_32bitLE(0x54,streamFile)-start_offset)/channel_count*2;
else
vgmstream->loop_start_sample = (read_32bitLE(0x54,streamFile)-start_offset)/channel_count/16*30;

View File

@ -134,7 +134,7 @@ VGMSTREAM * init_vgmstream_nds_strm_ffta2(STREAMFILE *streamFile) {
start_offset = 0x2C;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
vgmstream->coding_type = coding_INT_IMA;
vgmstream->coding_type = coding_IMA_int;
vgmstream->num_samples = (read_32bitLE(0x04,streamFile)-start_offset);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x20,streamFile);

View File

@ -49,7 +49,7 @@ VGMSTREAM * init_vgmstream_nds_swav(STREAMFILE *streamFile) {
bits_per_sample = 16;
break;
case 2:
coding_type = coding_INT_IMA;
coding_type = coding_IMA_int;
bits_per_sample = 4;
break;
default:
@ -74,7 +74,7 @@ VGMSTREAM * init_vgmstream_nds_swav(STREAMFILE *streamFile) {
vgmstream->loop_start_sample;
}
if (coding_type == coding_INT_IMA) {
if (coding_type == coding_IMA_int) {
/* handle IMA frame header */
vgmstream->loop_start_sample -= 32 / bits_per_sample;
vgmstream->loop_end_sample -= 32 / bits_per_sample;

View File

@ -10,7 +10,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_mpds(STREAMFILE *streamFile) {
/* check extension, case insensitive */
/* .adp: Big Air Freestyle */
/* .dsp: Big Air Freestyle */
/* .mds: Terminator 3 The Redemption, Mission Impossible: Operation Surma */
if (!check_extensions(streamFile, "dsp,mds")) goto fail;
@ -18,7 +18,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_mpds(STREAMFILE *streamFile) {
if (read_32bitBE(0x00,streamFile) != 0x4D504453) /* "MPDS" */
goto fail;
short_mpds = read_32bitBE(0x04,streamFile) != 0x00010000 && read_32bitBE(0x0c,streamFile) == 0x00000002; /* version byte? */
short_mpds = read_32bitBE(0x04,streamFile) != 0x00010000 && check_extensions(streamFile, "mds"); /* version byte? */
channel_count = short_mpds ?
read_16bitBE(0x0a, streamFile) :
@ -51,12 +51,13 @@ VGMSTREAM * init_vgmstream_ngc_dsp_mpds(STREAMFILE *streamFile) {
vgmstream->sample_rate = (uint16_t)read_16bitBE(0x08,streamFile);
vgmstream->interleave_block_size = channel_count==1 ? 0 : 0x200;
#if 0 //todo unknown coeffs, maybe depends on stuff @ 0x10? (but looks like some kind of size)
#if 0 //unknown coeffs/hist, related to data after 0x0c? (only coefs 0..7 seem to be needed)
{
off_t offset = 0x0c;
int i,ch;
for (ch=0; ch < vgmstream->channels; ch++) {
for (i=0; i < 16; i++)
vgmstream->ch[ch].adpcm_coef[i] = mpds_coefs[i];
vgmstream->ch[ch].adpcm_coef[i] = read_16bitBE(offset + i*2);
}
}
#endif

View File

@ -24,13 +24,15 @@ struct dsp_header {
uint16_t loop_ps;
int16_t loop_hist1;
int16_t loop_hist2;
int16_t channel_count;
int16_t block_size;
};
/* nonzero on failure */
static int read_dsp_header(struct dsp_header *header, off_t offset, STREAMFILE *file) {
int i;
uint8_t buf[0x4a]; /* usually padded out to 0x60 */
if (read_streamfile(buf, offset, 0x4a, file) != 0x4a) return 1;
uint8_t buf[0x4e]; /* usually padded out to 0x60 */
if (read_streamfile(buf, offset, 0x4e, file) != 0x4e) return 1;
header->sample_count =
get_32bitBE(buf+0x00);
@ -65,6 +67,10 @@ static int read_dsp_header(struct dsp_header *header, off_t offset, STREAMFILE *
get_16bitBE(buf+0x46);
header->loop_hist2 =
get_16bitBE(buf+0x48);
header->channel_count =
get_16bitBE(buf+0x4a);
header->block_size =
get_16bitBE(buf+0x4c);
return 0;
}
@ -175,6 +181,81 @@ fail:
return NULL;
}
/* the standard multi-channel .dsp, as generated by DSPADPCM.exe */
VGMSTREAM * init_vgmstream_ngc_mdsp_std(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
struct dsp_header header;
const off_t header_size = 0x60;
off_t start_offset;
int i, c, channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile, filename, sizeof(filename));
if (strcasecmp("dsp", filename_extension(filename)) &&
strcasecmp("mdsp", filename_extension(filename))) goto fail;
if (read_dsp_header(&header, 0, streamFile)) goto fail;
channel_count = header.channel_count==0 ? 1 : header.channel_count;
start_offset = header_size * channel_count;
/* check initial predictor/scale */
if (header.initial_ps != (uint8_t)read_8bit(start_offset, streamFile))
goto fail;
/* check type==0 and gain==0 */
if (header.format || header.gain)
goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, header.loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->num_samples = header.sample_count;
vgmstream->sample_rate = header.sample_rate;
vgmstream->loop_start_sample = dsp_nibbles_to_samples(
header.loop_start_offset);
vgmstream->loop_end_sample = dsp_nibbles_to_samples(
header.loop_end_offset) + 1;
/* don't know why, but it does happen*/
if (vgmstream->loop_end_sample > vgmstream->num_samples)
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = channel_count == 1 ? layout_none : layout_interleave;
vgmstream->meta_type = meta_DSP_STD;
vgmstream->interleave_block_size = header.block_size * 8;
for (i = 0; i < channel_count; i++) {
if (read_dsp_header(&header, header_size * i, streamFile)) goto fail;
/* coeffs */
for (c = 0; c < 16; c++)
vgmstream->ch[i].adpcm_coef[c] = header.coef[c];
/* initial history */
/* always 0 that I've ever seen, but for completeness... */
vgmstream->ch[i].adpcm_history1_16 = header.initial_hist1;
vgmstream->ch[i].adpcm_history2_16 = header.initial_hist2;
}
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
/* clean up anything we may have opened */
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
/* Some very simple stereo variants of standard dsp just use the standard header
* twice and add interleave, or just concatenate the channels. We'll support
* them all here.

View File

@ -1,80 +0,0 @@
#include "meta.h"
#include "../util.h"
/**
* Guerrilla's MSS
*
* Found in ShellShock Nam '67, Killzone (PS2)
*/
VGMSTREAM * init_vgmstream_ps2_mss(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset, datasize, num_samples;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("mss",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D435353) /* "MCSS" */
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x16,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x08,streamFile);
vgmstream->channels = channel_count;
datasize = read_32bitLE(0x0c,streamFile);
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
num_samples = read_32bitLE(0x1C,streamFile);
vgmstream->coding_type = coding_PSX;
if (num_samples * vgmstream->channels <= datasize)
{
num_samples = num_samples / 16 * 28;
}
vgmstream->num_samples = num_samples;
if (channel_count == 1)
{
vgmstream->layout_type = layout_none;
}
else
{
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x18,streamFile);
}
vgmstream->meta_type = meta_PS2_MSS;
/* 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;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -1,70 +0,0 @@
#include "meta.h"
#include "../util.h"
/* RXW file (Arc the Lad) */
VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
int loop_flag=0;
int channel_count;
off_t start_offset;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("rxw",filename_extension(filename))) goto fail;
/* check RXWS/FORM Header */
if (!((read_32bitBE(0x00,streamFile) == 0x52585753) &&
(read_32bitBE(0x10,streamFile) == 0x464F524D)))
goto fail;
/* check loop */
loop_flag = (read_32bitLE(0x3C,streamFile)!=0xFFFFFFFF);
/* Always stereo files */
channel_count=2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x2E,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x38,streamFile)*28/16)/2;
/* Get loop point values */
if(vgmstream->loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x3C,streamFile)/16*14;
vgmstream->loop_end_sample = read_32bitLE(0x38,streamFile)/16*14;
}
vgmstream->interleave_block_size = read_32bitLE(0x1c,streamFile)+0x10;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_RXW;
start_offset = 0x40;
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
(off_t)(start_offset+vgmstream->interleave_block_size*i);
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -0,0 +1,211 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* RXWS - from Sony SCEI PS2 games (Okage: Shadow King, Genji, Bokura no Kazoku) */
VGMSTREAM * init_vgmstream_ps2_rxws(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
STREAMFILE * streamHeader = NULL;
off_t start_offset, chunk_offset;
size_t data_size;
int loop_flag = 0, channel_count, is_separate, type, sample_rate;
int32_t loop_start, loop_end;
int target_stream = 0, total_streams;
/* check extensions */
/* .xws: header and data, .xwh+xwb: header + data */
if (!check_extensions(streamFile,"xws,xwb")) goto fail;
is_separate = check_extensions(streamFile,"xwb");
/* xwh+xwb: use xwh as header; otherwise use the current file */
if (is_separate) {
/* extra check to avoid hijacking Microsoft's XWB */
if ((read_32bitBE(0x00,streamFile) == 0x57424E44) || /* "WBND" (LE) */
(read_32bitBE(0x00,streamFile) == 0x444E4257)) /* "DNBW" (BE) */
goto fail;
streamHeader = open_stream_ext(streamFile, "xwh");
if (!streamHeader) goto fail;
} else {
streamHeader = streamFile;
}
if (read_32bitBE(0x00,streamHeader) != 0x52585753) /* "RXWS" */
goto fail;
/* file size (just the .xwh/xws) */
if (read_32bitLE(0x04,streamHeader)+0x10 != get_streamfile_size(streamHeader))
goto fail;
/* 0x08(4): version/type? (0x200), 0x0C: null */
/* typical chunks: FORM, FTXT, MARK, BODY (for .xws) */
if (read_32bitBE(0x10,streamHeader) != 0x464F524D) /* "FORM", main header (always first) */
goto fail;
/* 0x04: chunk size (-0x10), 0x08 version/type? (0x100), 0x0c: null */
chunk_offset = 0x20;
/* check multi-streams */
total_streams = read_32bitLE(chunk_offset+0x00,streamHeader);
if (target_stream == 0) target_stream = 1;
if (target_stream < 0 || target_stream > total_streams || total_streams < 1) goto fail;
/* read stream header */
{
off_t header_offset = chunk_offset + 0x4 + 0x1c * (target_stream-1); /* position in FORM */
off_t stream_offset, next_stream_offset, data_offset = 0;
type = read_8bit(header_offset+0x00, streamHeader);
/* 0x01(1): unknown (always 0x1c), 0x02(2): flags? (usually 8002/0002, & 0x01 if looped) */
/* 0x04(4): vol/pan stuff? (0x00007F7F), 0x08(1): null?, 0x0c(4): null? */
channel_count = read_8bit(header_offset+0x09, streamHeader);
sample_rate = (uint16_t)read_16bitLE(header_offset+0x0a,streamHeader);
stream_offset = read_32bitLE(header_offset+0x10,streamHeader);
loop_end = read_32bitLE(header_offset+0x14,streamHeader);
loop_start = read_32bitLE(header_offset+0x18,streamHeader);
loop_flag = (loop_start != 0xFFFFFFFF);
/* find data start and size */
if (is_separate) {
data_offset = 0x00;
}
else {
off_t current_chunk = 0x10;
/* note the extra 0x10 in chunk_size/offsets */
while (current_chunk < get_streamfile_size(streamFile)) {
if (read_32bitBE(current_chunk,streamFile) == 0x424F4459) { /* "BODY" chunk_type */
data_offset = 0x10 + current_chunk;
break;
}
current_chunk += 0x10 + read_32bitLE(current_chunk+4,streamFile);
}
if (!data_offset) goto fail;
}
if (target_stream == total_streams) {
next_stream_offset = data_offset + get_streamfile_size(is_separate ? streamFile : streamHeader);
} else {
off_t next_header_offset = chunk_offset + 0x4 + 0x1c * (target_stream);
next_stream_offset = read_32bitLE(next_header_offset+0x10,streamHeader);
}
data_size = next_stream_offset - stream_offset;
start_offset = data_offset + stream_offset;
}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = sample_rate;
vgmstream->num_streams = total_streams;
vgmstream->meta_type = meta_PS2_RXWS;
switch (type) {
case 0x00: /* PS-ADPCM */
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->num_samples = ps_bytes_to_samples(loop_end, channel_count); //todo (read_32bitLE(0x38,streamFile)*28/16)/2;
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start, channel_count); //todo read_32bitLE(0x3C,streamFile)/16*14;
vgmstream->loop_end_sample = ps_bytes_to_samples(loop_end, channel_count); //todo read_32bitLE(0x38,streamFile)/16*14;
break;
case 0x01: /* PCM */
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = channel_count==1 ? layout_none : layout_interleave;
vgmstream->interleave_block_size = 0x2;
vgmstream->num_samples = pcm_bytes_to_samples(loop_end, channel_count, 16);
vgmstream->loop_start_sample = pcm_bytes_to_samples(loop_start, channel_count, 16);
vgmstream->loop_end_sample = pcm_bytes_to_samples(loop_end, channel_count, 16);
break;
#ifdef VGM_USE_FFMPEG
case 0x02: { /* ATRAC3 */
uint8_t buf[0x100];
int32_t bytes, block_size, encoder_delay, joint_stereo;
block_size = 0xc0 * channel_count;
joint_stereo = 0;
encoder_delay = 0x0;
bytes = ffmpeg_make_riff_atrac3(buf, 0x100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, encoder_delay);
if (bytes <= 0) goto fail;
vgmstream->codec_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,data_size);
if (!vgmstream->codec_data) goto fail;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = loop_end;
vgmstream->loop_start_sample = loop_start;
vgmstream->loop_end_sample = loop_end;
break;
}
#endif
default:
goto fail;
}
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
if (is_separate && streamHeader) close_streamfile(streamHeader);
return vgmstream;
fail:
if (is_separate && streamHeader) close_streamfile(streamHeader);
close_vgmstream(vgmstream);
return NULL;
}
/* .RXW - legacy fake ext/header for poorly split XWH+XWB files generated by old tools (incorrect header/chunk sizes) */
VGMSTREAM * init_vgmstream_ps2_rxw(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
int loop_flag=0, channel_count;
off_t start_offset;
/* check extension, case insensitive */
if (!check_extensions(streamFile,"rxw")) goto fail;
/* check RXWS/FORM Header */
if (!((read_32bitBE(0x00,streamFile) == 0x52585753) &&
(read_32bitBE(0x10,streamFile) == 0x464F524D)))
goto fail;
loop_flag = (read_32bitLE(0x3C,streamFile)!=0xFFFFFFFF);
channel_count=2; /* Always stereo files */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x2E,streamFile);
vgmstream->num_samples = (read_32bitLE(0x38,streamFile)*28/16)/2;
/* Get loop point values */
if(vgmstream->loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x3C,streamFile)/16*14;
vgmstream->loop_end_sample = read_32bitLE(0x38,streamFile)/16*14;
}
vgmstream->interleave_block_size = read_32bitLE(0x1c,streamFile)+0x10;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_RXWS;
start_offset = 0x40;
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -31,7 +31,7 @@ VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE *streamFile) {
vgmstream->sample_rate = (uint16_t)read_16bitLE(0xe,streamFile);
if(read_8bit(0x08,streamFile)==1) {
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->coding_type = coding_DVI_IMA_int;
}
else
vgmstream->coding_type = coding_PCM16LE;

View File

@ -33,7 +33,7 @@ VGMSTREAM * init_vgmstream_ps2_stm(STREAMFILE *streamFile) {
start_offset = 0x800;
vgmstream->sample_rate = (uint16_t)read_32bitLE(0xc,streamFile);
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->coding_type = coding_DVI_IMA_int;
vgmstream->num_samples = read_32bitLE(0x18,streamFile);

View File

@ -1,5 +1,6 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* RSD */
/* RSD2VAG */
@ -1068,70 +1069,99 @@ fail:
return NULL;
}
#if 0
/* RSD6XMA */
VGMSTREAM * init_vgmstream_rsd6xma(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag, channel_count;
uint32_t version;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("rsd",filename_extension(filename))) goto fail;
/* check extension, case insensitive */
if (!check_extensions(streamFile,"rsd"))
goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x52534436) /* RSD6 */
if (read_32bitBE(0x0, streamFile) != 0x52534436) /* RSD6 */
goto fail;
if (read_32bitBE(0x4,streamFile) != 0x584D4120) /* XMA */
if (read_32bitBE(0x04,streamFile) != 0x584D4120) /* XMA */
goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x8,streamFile);
loop_flag = 0;
channel_count = read_32bitLE(0x8, streamFile);
version = read_32bitBE(0x80C, streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
start_offset = read_32bitBE(0x800, streamFile) + read_32bitBE(0x804, streamFile) + 0xc; /* assumed, seek table always at 0x800 */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_XMA;
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)*64/36/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = loop_flag;
vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-start_offset)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_RSD6XMA;
vgmstream->sample_rate = read_32bitBE(0x818, 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;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
switch (version) {
case 0x03010000: {
vgmstream->num_samples = read_32bitBE(0x824, streamFile);
if (vgmstream->coding_type == coding_XMA) {
vgmstream->layout_type=layout_none;
vgmstream->ch[i].channel_start_offset=start_offset;
} else {
vgmstream->ch[i].channel_start_offset=
start_offset+vgmstream->interleave_block_size*i;
}
vgmstream->ch[i].offset = vgmstream->ch[i].channel_start_offset;
}
}
#ifdef VGM_USE_FFMPEG
{
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
size_t bytes, datasize, block_size, block_count;
block_count = read_32bitBE(0x828, streamFile);
block_size = 0x10000;
datasize = read_32bitBE(0x808, streamFile);
bytes = ffmpeg_make_riff_xma2(buf, 100, vgmstream->num_samples, datasize, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf, bytes, start_offset, datasize);
if (!ffmpeg_data) goto fail;
vgmstream->codec_data = ffmpeg_data;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
}
#else
goto fail;
#endif
break;
}
case 0x04010000: {
vgmstream->num_samples = read_32bitBE(0x814, streamFile);
#ifdef VGM_USE_FFMPEG
{
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
size_t bytes, datasize, block_size, block_count;
block_count = read_32bitBE(0x830, streamFile);
block_size = 0x10000;
datasize = read_32bitBE(0x808, streamFile);
bytes = ffmpeg_make_riff_xma2(buf, 100, vgmstream->num_samples, datasize, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf, bytes, start_offset, datasize);
if (!ffmpeg_data) goto fail;
vgmstream->codec_data = ffmpeg_data;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
}
#else
goto fail;
#endif
break;
}
}
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
@ -1139,5 +1169,3 @@ fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
#endif

View File

@ -29,7 +29,7 @@ VGMSTREAM * init_vgmstream_dvi(STREAMFILE *streamFile) {
vgmstream->channels = channel_count;
start_offset = read_32bitBE(0x04,streamFile);
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->coding_type = coding_DVI_IMA_int;
vgmstream->num_samples = read_32bitBE(0x08,streamFile);

View File

@ -20,7 +20,7 @@ typedef struct _SCDINTSTREAMFILE
static STREAMFILE *open_scdint_with_STREAMFILE(STREAMFILE *file, const char * filename, off_t start_offset, off_t interleave_block_size, off_t stride_size, size_t total_size);
#ifdef VGM_USE_VORBIS
/* V3 decryption table found in the .exe */
static const uint8_t scd_ogg_v3_lookuptable[256] = { /* FF XIV Heavensward */
0x3A, 0x32, 0x32, 0x32, 0x03, 0x7E, 0x12, 0xF7, 0xB2, 0xE2, 0xA2, 0x67, 0x32, 0x32, 0x22, 0x32, // 00-0F
@ -43,6 +43,7 @@ static const uint8_t scd_ogg_v3_lookuptable[256] = { /* FF XIV Heavensward */
static void scd_ogg_decrypt_v2_callback(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read);
static void scd_ogg_decrypt_v3_callback(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read);
#endif
@ -547,7 +548,7 @@ static STREAMFILE *open_scdint_with_STREAMFILE(STREAMFILE *file, const char * fi
return &scd->sf;
}
#ifdef VGM_USE_VORBIS
static void scd_ogg_decrypt_v2_callback(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read) {
ogg_vorbis_streamfile * ov_streamfile = (ogg_vorbis_streamfile*)datasource;
@ -586,3 +587,4 @@ static void scd_ogg_decrypt_v3_callback(void *ptr, size_t size, size_t nmemb, vo
}
}
}
#endif

View File

@ -0,0 +1,210 @@
#include "meta.h"
#include "../coding/coding.h"
/* AAC - Tri-Ace Audio Container */
/* Xbox 360 Variants (Star Ocean 4, End of Eternity, Infinite Undiscovery) */
VGMSTREAM * init_vgmstream_ta_aac_x360(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
size_t sampleRate, numSamples, startSample, dataSize, blockSize, blockCount; // A mess
/* check extension, case insensitive */
/* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */
if ( !check_extensions(streamFile,"aac,laac,ace"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x41414320) /* "AAC " */
goto fail;
/* Ok, let's check what's behind door number 1 */
if (read_32bitBE(0x1000, streamFile) == 0x41534320) /* "ASC " */
{
loop_flag = read_32bitBE(0x1118, streamFile);
/*Funky Channel Count Checking */
if (read_32bitBE(0x1184, streamFile) == 0x7374726D)
channel_count = 6;
else if (read_32bitBE(0x1154, streamFile) == 0x7374726D)
channel_count = 4;
else
channel_count = read_8bit(0x1134, streamFile);
sampleRate = read_32bitBE(0x10F4, streamFile);
numSamples = read_32bitBE(0x10FC, streamFile);
startSample = read_32bitBE(0x10F8, streamFile);
dataSize = read_32bitBE(0x10F0, streamFile);
blockSize = read_32bitBE(0x1100, streamFile);
blockCount = read_32bitBE(0x110C, streamFile);
}
else if (read_32bitBE(0x1000, streamFile) == 0x57415645) /* "WAVE" */
{
loop_flag = read_32bitBE(0x1048, streamFile);
/*Funky Channel Count Checking */
if (read_32bitBE(0x10B0, streamFile) == 0x7374726D)
channel_count = 6;
else if (read_32bitBE(0x1080, streamFile) == 0x7374726D)
channel_count = 4;
else
channel_count = read_8bit(0x1060, streamFile);
sampleRate = read_32bitBE(0x1024, streamFile);
numSamples = read_32bitBE(0x102C, streamFile);
startSample = read_32bitBE(0x1028, streamFile);
dataSize = read_32bitBE(0x1020, streamFile);
blockSize = read_32bitBE(0x1030, streamFile);
blockCount = read_32bitBE(0x103C, streamFile);
}
else if (read_32bitBE(0x1000, streamFile) == 0x00000000) /* some like to be special */
{
loop_flag = read_32bitBE(0x6048, streamFile);
/*Funky Channel Count Checking */
if (read_32bitBE(0x60B0, streamFile) == 0x7374726D)
channel_count = 6;
else if (read_32bitBE(0x6080, streamFile) == 0x7374726D)
channel_count = 4;
else
channel_count = read_8bit(0x6060, streamFile);
sampleRate = read_32bitBE(0x6024, streamFile);
numSamples = read_32bitBE(0x602C, streamFile);
startSample = read_32bitBE(0x6028, streamFile);
dataSize = read_32bitBE(0x6020, streamFile);
blockSize = read_32bitBE(0x6030, streamFile);
blockCount = read_32bitBE(0x603C, streamFile);
}
else
goto fail; //cuz I don't know if there are other variants
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
if (read_32bitBE(0x1000, streamFile) == 0x00000000)
start_offset = 0x7000;
else
start_offset = 0x2000;
vgmstream->sample_rate = sampleRate;
vgmstream->channels = channel_count;
vgmstream->num_samples = numSamples;
if (loop_flag) {
vgmstream->loop_start_sample = startSample;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->meta_type = meta_TA_AAC_X360;
#ifdef VGM_USE_FFMPEG
{
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
size_t bytes, datasize, block_size, block_count;
block_count = blockCount;
block_size = blockSize;
datasize = dataSize;
bytes = ffmpeg_make_riff_xma2(buf,100, vgmstream->num_samples, datasize, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,datasize);
if ( !ffmpeg_data ) goto fail;
vgmstream->codec_data = ffmpeg_data;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
}
#else
goto fail;
#endif
/* open the file for reading */
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}
/* PlayStation 3 Variants (Star Ocean International, Resonance of Fate) */
VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
uint32_t data_size, loop_start, loop_end, codec_id;
/* check extension, case insensitive */
/* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */
if (!check_extensions(streamFile, "aac,laac,ace"))
goto fail;
if (read_32bitBE(0x00, streamFile) != 0x41414320) /* "AAC " */
goto fail;
/* Haven't Found a codec flag yet. Let's just use this for now */
if (read_32bitBE(0x10000, streamFile) != 0x41534320) /* "ASC " */
goto fail;
if (read_32bitBE(0x10104, streamFile) != 0xFFFFFFFF)
loop_flag = 1;
else
loop_flag = 0;
channel_count = read_32bitBE(0x100F4, streamFile);
codec_id = read_32bitBE(0x100F0, streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
/* Useless header, let's play the guessing game */
start_offset = 0x10110;
vgmstream->sample_rate = read_32bitBE(0x100FC, streamFile);
vgmstream->channels = channel_count;
vgmstream->meta_type = meta_TA_AAC_PS3;
data_size = read_32bitBE(0x100F8, streamFile);
loop_start = read_32bitBE(0x10104, streamFile);
loop_end = read_32bitBE(0x10108, streamFile);
#ifdef VGM_USE_FFMPEG
{
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
int32_t bytes, samples_size = 1024, block_size, encoder_delay, joint_stereo, max_samples;
block_size = (codec_id == 4 ? 0x60 : (codec_id == 5 ? 0x98 : 0xC0)) * vgmstream->channels;
max_samples = (data_size / block_size) * samples_size;
encoder_delay = 0x0;
joint_stereo = 0;
/* make a fake riff so FFmpeg can parse the ATRAC3 */
bytes = ffmpeg_make_riff_atrac3(buf, 100, vgmstream->num_samples, data_size, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, encoder_delay);
if (bytes <= 0) goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf, bytes, start_offset, data_size);
if (!ffmpeg_data) goto fail;
vgmstream->codec_data = ffmpeg_data;
vgmstream->coding_type = coding_FFmpeg;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = max_samples;
if (loop_flag) {
vgmstream->loop_start_sample = (loop_start / block_size) * samples_size;
vgmstream->loop_end_sample = (loop_end / block_size) * samples_size;
}
}
#endif
/* open the file for reading */
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -33,7 +33,7 @@ const short wad_coef[16] =
};
/* WAC - WAD - WAM (Beyond Good & Evil GC/PS2) */
/* WAC - WAD - WAM (Beyond Good & Evil GC/PS2/Xbox/Wii) */
/* Note: A "Flat Layout" has no interleave */
VGMSTREAM * init_vgmstream_waa_wac_wad_wam(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;

View File

@ -34,7 +34,7 @@ VGMSTREAM * init_vgmstream_xbox_stma(STREAMFILE *streamFile) {
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->coding_type = coding_DVI_IMA_int;
vgmstream->num_samples = read_32bitLE(0x18,streamFile)*2/vgmstream->channels;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size=0x40;

View File

@ -117,7 +117,8 @@ VGMSTREAM * init_vgmstream_xwb(STREAMFILE *streamFile) {
/* for Techland's XWB with no data */
if (xwb.base_offset == 0) goto fail;
if (xwb.data_offset + xwb.data_size != get_streamfile_size(streamFile)) goto fail;
/* some BlazBlue Centralfiction songs have padding after data size */
if (xwb.data_offset + xwb.data_size > get_streamfile_size(streamFile)) goto fail;
/* read base entry (WAVEBANKDATA) */
off = xwb.base_offset;

View File

@ -5,15 +5,23 @@
#include "util.h"
#include "vgmstream.h"
/* On EOF reads we can return length 0, or ignore and return the requested length + 0-set the buffer.
* Some decoders don't check for EOF and may decode garbage if returned 0, as read_Nbit() funcs return -1.
* Only matters for metas that get num_samples wrong (bigger than total data). */
#define STREAMFILE_IGNORE_EOF 0
/* buffered file reader */
typedef struct {
STREAMFILE sf;
FILE * infile;
STREAMFILE sf; /* callbacks */
FILE * infile; /* actual FILE */
char name[PATH_LIMIT];
off_t offset;
size_t validsize;
uint8_t * buffer;
size_t buffersize;
size_t filesize;
off_t offset; /* current offset */
size_t validsize; /* current buffer size */
uint8_t * buffer; /* data buffer */
size_t buffersize; /* max buffer size */
size_t filesize; /* cached file size (max offset) */
#ifdef VGM_DEBUG_OUTPUT
int error_notified;
#endif
@ -28,19 +36,20 @@ static STREAMFILE * open_stdio_streamfile_buffer_by_FILE(FILE *infile,const char
static size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STDIOSTREAMFILE * streamfile) {
size_t length_read_total=0;
/* is the beginning at least there? */
if (offset >= streamfile->offset && offset < streamfile->offset+streamfile->validsize) {
/* is the part of the requested length in the buffer? */
if (offset >= streamfile->offset && offset < streamfile->offset + streamfile->validsize) {
size_t length_read;
off_t offset_into_buffer = offset-streamfile->offset;
length_read = streamfile->validsize-offset_into_buffer;
memcpy(dest,streamfile->buffer+offset_into_buffer,length_read);
off_t offset_into_buffer = offset - streamfile->offset;
length_read = streamfile->validsize - offset_into_buffer;
memcpy(dest,streamfile->buffer + offset_into_buffer,length_read);
length_read_total += length_read;
length -= length_read;
offset += length_read;
dest += length_read;
}
/* TODO: What would make more sense here is to read the whole request
/* What would make more sense here is to read the whole request
* at once into the dest buffer, as it must be large enough, and then
* copy some part of that into our own buffer.
* The destination buffer is supposed to be much smaller than the
@ -48,23 +57,29 @@ static size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STDIOST
* to the buffer size to avoid having to deal with things like this
* which are outside of my intended use.
*/
/* read as much of the beginning of the request as possible, proceed */
while (length>0) {
/* read the rest of the requested length */
while (length > 0) {
size_t length_to_read;
size_t length_read;
streamfile->validsize=0;
streamfile->validsize = 0; /* buffer is empty now */
/* request outside file: ignore to avoid seek/read */
if (offset > streamfile->filesize) {
#ifdef VGM_DEBUG_OUTPUT
streamfile->offset = streamfile->filesize;
#ifdef VGM_DEBUG_OUTPUT
if (!streamfile->error_notified) {
VGM_LOG("ERROR: reading outside filesize, at offset 0x%lx + 0x%x (buggy meta?)\n", offset, length);
VGM_LOG("ERROR: reading over filesize 0x%x @ 0x%lx + 0x%x (buggy meta?)\n", streamfile->filesize, offset, length);
streamfile->error_notified = 1;
}
#endif
streamfile->offset = streamfile->filesize;
memset(dest,0,length);
return length; /* return partially-read buffer and 0-set the rest */
#endif
#if STREAMFILE_IGNORE_EOF
memset(dest,0,length); /* dest is already shifted */
return length_read_total + length; /* partially-read + 0-set buffer */
#else
return length_read_total; /* partially-read buffer */
#endif
}
/* position to new offset */
@ -73,18 +88,19 @@ static size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STDIOST
#ifdef PROFILE_STREAMFILE
streamfile->error_count++;
#endif
return 0; //fail miserably
return 0; /* fail miserably (fseek shouldn't fail and reach this) */
}
streamfile->offset=offset;
streamfile->offset = offset;
/* decide how much must be read this time */
if (length>streamfile->buffersize) length_to_read=streamfile->buffersize;
else length_to_read=length;
if (length > streamfile->buffersize)
length_to_read = streamfile->buffersize;
else
length_to_read = length;
/* always try to fill the buffer */
length_read = fread(streamfile->buffer,1,streamfile->buffersize,streamfile->infile);
streamfile->validsize=length_read;
/* fill the buffer */
length_read = fread(streamfile->buffer,sizeof(uint8_t),streamfile->buffersize,streamfile->infile);
streamfile->validsize = length_read;
#ifdef PROFILE_STREAMFILE
if (ferror(streamfile->infile)) {
@ -95,19 +111,24 @@ static size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STDIOST
streamfile->bytes_read += length_read;
#endif
/* if we can't get enough to satisfy the request we give up */
/* if we can't get enough to satisfy the request (EOF) we give up */
if (length_read < length_to_read) {
memcpy(dest,streamfile->buffer,length_read);
length_read_total+=length_read;
return length_read_total;
#if STREAMFILE_IGNORE_EOF
memset(dest+length_read,0,length-length_read);
return length_read_total + length; /* partially-read + 0-set buffer */
#else
return length_read_total + length_read; /* partially-read buffer */
#endif
}
/* use the new buffer */
memcpy(dest,streamfile->buffer,length_to_read);
length_read_total+=length_to_read;
length-=length_to_read;
dest+=length_to_read;
offset+=length_to_read;
length_read_total += length_to_read;
length -= length_to_read;
dest += length_to_read;
offset += length_to_read;
}
return length_read_total;
@ -115,25 +136,32 @@ static size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STDIOST
static size_t read_stdio(STDIOSTREAMFILE *streamfile,uint8_t * dest, off_t offset, size_t length) {
if (!streamfile || !dest || length<=0) return 0;
/* if entire request is within the buffer */
if (offset >= streamfile->offset && offset+length <= streamfile->offset+streamfile->validsize) {
memcpy(dest,streamfile->buffer+(offset-streamfile->offset),length);
return length;
}
if (!streamfile || !dest || length<=0)
return 0;
/* request outside file: ignore to avoid seek/read in read_the_rest() */
if (offset > streamfile->filesize) {
streamfile->offset = streamfile->filesize;
#ifdef VGM_DEBUG_OUTPUT
if (!streamfile->error_notified) {
VGM_LOG("ERROR: reading outside filesize, at offset over 0x%lx (buggy meta?)\n", offset);
VGM_LOG("ERROR: offset over filesize 0x%x @ 0x%lx + 0x%x (buggy meta?)\n", streamfile->filesize, offset, length);
streamfile->error_notified = 1;
}
#endif
streamfile->offset = streamfile->filesize;
#if STREAMFILE_IGNORE_EOF
memset(dest,0,length);
return length; /* 0-set buffer */
#else
return 0; /* nothing to read */
#endif
}
/* just copy if entire request is within the buffer */
if (offset >= streamfile->offset && offset + length <= streamfile->offset + streamfile->validsize) {
off_t offset_into_buffer = offset - streamfile->offset;
memcpy(dest,streamfile->buffer + offset_into_buffer,length);
return length;
}
@ -523,4 +551,3 @@ int find_chunk(STREAMFILE *streamFile, uint32_t chunk_id, off_t start_offset, in
return 0;
}

View File

@ -18,8 +18,7 @@ static void try_dual_file_stereo(VGMSTREAM * opened_stream, STREAMFILE *streamFi
/*
* List of functions that will recognize files. These should correspond pretty
* directly to the metadata types
* List of functions that will recognize files.
*/
VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_adx,
@ -37,6 +36,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_halpst,
init_vgmstream_rs03,
init_vgmstream_ngc_dsp_std,
init_vgmstream_ngc_mdsp_std,
init_vgmstream_ngc_dsp_csmp,
init_vgmstream_Cstr,
init_vgmstream_gcsw,
@ -44,6 +44,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_npsf,
init_vgmstream_rwsd,
init_vgmstream_cdxa,
init_vgmstream_ps2_rxws,
init_vgmstream_ps2_rxw,
init_vgmstream_ps2_int,
init_vgmstream_ngc_dsp_stm,
@ -326,7 +327,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_tun,
init_vgmstream_wpd,
init_vgmstream_mn_str,
init_vgmstream_ps2_mss,
init_vgmstream_mss,
init_vgmstream_ps2_hsf,
init_vgmstream_ps3_ivag,
init_vgmstream_ps2_2pfs,
@ -354,6 +355,11 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_xma,
init_vgmstream_sxd,
init_vgmstream_ogl,
init_vgmstream_mc3,
init_vgmstream_gtd,
init_vgmstream_rsd6xma,
init_vgmstream_ta_aac_x360,
init_vgmstream_ta_aac_ps3,
#ifdef VGM_USE_FFMPEG
init_vgmstream_mp4_aac_ffmpeg,
@ -373,22 +379,20 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
fcns_size = (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]));
/* try a series of formats, see which works */
for (i=0;i<fcns_size;i++) {
for (i=0; i < fcns_size; i++) {
/* call init function and see if valid VGMSTREAM was returned */
VGMSTREAM * vgmstream = (init_vgmstream_fcns[i])(streamFile);
if (vgmstream) {
/* these are little hacky checks */
/* fail if there is nothing to play
* (without this check vgmstream can generate empty files) */
/* fail if there is nothing to play (without this check vgmstream can generate empty files) */
if (vgmstream->num_samples <= 0) {
VGM_LOG("VGMSTREAM: wrong num_samples (ns=%i)\n", vgmstream->num_samples);
VGM_LOG("VGMSTREAM: wrong num_samples (ns=%i / 0x%08x)\n", vgmstream->num_samples, vgmstream->num_samples);
close_vgmstream(vgmstream);
continue;
}
/* everything should have a reasonable sample rate
* (a verification of the metadata) */
/* everything should have a reasonable sample rate (a verification of the metadata) */
if (!check_sample_rate(vgmstream->sample_rate)) {
VGM_LOG("VGMSTREAM: wrong sample rate (sr=%i)\n", vgmstream->sample_rate);
close_vgmstream(vgmstream);
@ -479,11 +483,7 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type==coding_ogg_vorbis) {
ogg_vorbis_codec_data *data = vgmstream->codec_data;
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_pcm_seek(ogg_vorbis_file, 0);
reset_ogg_vorbis(vgmstream);
}
if (vgmstream->coding_type==coding_fsb_vorbis) {
@ -498,59 +498,40 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
reset_ogl_vorbis(vgmstream);
}
#endif
if (vgmstream->coding_type==coding_CRI_HCA) {
hca_codec_data *data = vgmstream->codec_data;
/*clHCA *hca = (clHCA *)(data + 1);*/
data->curblock = 0;
data->sample_ptr = clHCA_samplesPerBlock;
data->samples_discard = 0;
reset_hca(vgmstream);
}
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
if (vgmstream->coding_type==coding_MP4_AAC) {
mp4_aac_codec_data *data = vgmstream->codec_data;
data->sampleId = 0;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = 0;
reset_mp4_aac(vgmstream);
}
#endif
#ifdef VGM_USE_MPEG
if (vgmstream->layout_type==layout_mpeg ||
vgmstream->layout_type==layout_fake_mpeg) {
reset_mpeg(vgmstream);
}
#endif
#ifdef VGM_USE_G7221
if (vgmstream->coding_type==coding_G7221 ||
vgmstream->coding_type==coding_G7221C) {
g7221_codec_data *data = vgmstream->codec_data;
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g7221_reset(data[i].handle);
}
reset_g7221(vgmstream);
}
#endif
#ifdef VGM_USE_G719
if (vgmstream->coding_type==coding_G719) {
g719_codec_data *data = vgmstream->codec_data;
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g719_reset(data[i].handle);
}
reset_g719(vgmstream);
}
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
if (vgmstream->coding_type==coding_AT3plus) {
maiatrac3plus_codec_data *data = vgmstream->codec_data;
if (data->handle) Atrac3plusDecoder_closeContext(data->handle);
data->handle = Atrac3plusDecoder_openContext();
data->samples_discard = 0;
reset_at3plus(vgmstream);
}
#endif
@ -680,20 +661,13 @@ VGMSTREAM * allocate_vgmstream(int channel_count, int looped) {
void close_vgmstream(VGMSTREAM * vgmstream) {
int i,j;
if (!vgmstream) return;
if (!vgmstream)
return;
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type==coding_ogg_vorbis) {
ogg_vorbis_codec_data *data = (ogg_vorbis_codec_data *) vgmstream->codec_data;
if (vgmstream->codec_data) {
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_clear(ogg_vorbis_file);
close_streamfile(data->ov_streamfile.streamfile);
free(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
free_ogg_vorbis(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
if (vgmstream->coding_type==coding_fsb_vorbis) {
@ -713,43 +687,28 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
#endif
if (vgmstream->coding_type==coding_CRI_HCA) {
hca_codec_data *data = (hca_codec_data *) vgmstream->codec_data;
if (vgmstream->codec_data) {
clHCA *hca = (clHCA *)(data + 1);
clHCA_done(hca);
if (data->streamfile) close_streamfile(data->streamfile);
free(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
free_hca(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
#ifdef VGM_USE_FFMPEG
if (vgmstream->coding_type==coding_FFmpeg) {
ffmpeg_codec_data *data = (ffmpeg_codec_data *) vgmstream->codec_data;
if (vgmstream->codec_data) {
free_ffmpeg(data);
vgmstream->codec_data = NULL;
}
free_ffmpeg(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
#endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
if (vgmstream->coding_type==coding_MP4_AAC) {
mp4_aac_codec_data *data = (mp4_aac_codec_data *) vgmstream->codec_data;
if (vgmstream->codec_data) {
if (data->h_aacdecoder) aacDecoder_Close(data->h_aacdecoder);
if (data->h_mp4file) MP4Close(data->h_mp4file, 0);
if (data->if_file.streamfile) close_streamfile(data->if_file.streamfile);
free(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
free_mp4_aac(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
#endif
#ifdef VGM_USE_MPEG
if (vgmstream->layout_type==layout_fake_mpeg||
if (vgmstream->layout_type==layout_fake_mpeg ||
vgmstream->layout_type==layout_mpeg) {
free_mpeg((mpeg_codec_data *)vgmstream->codec_data);
free_mpeg(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
#endif
@ -757,52 +716,22 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
#ifdef VGM_USE_G7221
if (vgmstream->coding_type == coding_G7221 ||
vgmstream->coding_type == coding_G7221C) {
g7221_codec_data *data = (g7221_codec_data *) vgmstream->codec_data;
if (data)
{
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g7221_free(data[i].handle);
}
free(data);
}
free_g7221(vgmstream);
vgmstream->codec_data = NULL;
}
#endif
#ifdef VGM_USE_G719
if (vgmstream->coding_type == coding_G719) {
g719_codec_data *data = (g719_codec_data *) vgmstream->codec_data;
if (data)
{
int i;
for (i = 0; i < vgmstream->channels; i++)
{
g719_free(data[i].handle);
}
free(data);
}
free_g719(vgmstream);
vgmstream->codec_data = NULL;
}
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
if (vgmstream->coding_type == coding_AT3plus) {
maiatrac3plus_codec_data *data = (maiatrac3plus_codec_data *) vgmstream->codec_data;
if (data)
{
if (data->handle) Atrac3plusDecoder_closeContext(data->handle);
free(data);
}
free_at3plus(vgmstream->codec_data);
vgmstream->codec_data = NULL;
}
#endif
@ -884,9 +813,7 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
vgmstream->coding_type == coding_NWA5
) {
nwa_codec_data *data = (nwa_codec_data *) vgmstream->codec_data;
close_nwa(data->nwa);
free(data);
vgmstream->codec_data = NULL;
@ -1010,11 +937,15 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
}
}
/* get the size in samples of a single frame (1 or N channels), for interleaved/blocked layouts */
int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
switch (vgmstream->coding_type) {
case coding_CRI_ADX:
case coding_CRI_ADX_fixed:
case coding_CRI_ADX_exp:
case coding_CRI_ADX_enc_8:
case coding_CRI_ADX_enc_9:
return (vgmstream->interleave_block_size - 2) * 2;
case coding_L5_555:
return 32;
case coding_NGC_DSP:
@ -1070,8 +1001,8 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_IMA:
case coding_OTNS_IMA:
return 1;
case coding_INT_IMA:
case coding_INT_DVI_IMA:
case coding_IMA_int:
case coding_DVI_IMA_int:
case coding_AICA:
return 2;
case coding_NGC_AFC:
@ -1085,7 +1016,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_PSX_cfg:
return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */
case coding_XBOX:
case coding_INT_XBOX:
case coding_XBOX_int:
case coding_FSB_IMA:
return 64;
case coding_EA_XA:
@ -1094,8 +1025,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_EA_ADPCM:
return 14*vgmstream->channels;
case coding_WS:
/* only works if output sample size is 8 bit, which is always
is for WS ADPCM */
/* only works if output sample size is 8 bit, which always is for WS ADPCM */
return vgmstream->ws_output_size;
case coding_MSADPCM:
return (vgmstream->interleave_block_size-(7-1)*vgmstream->channels)*2/vgmstream->channels;
@ -1135,6 +1065,8 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
return 54;
case coding_MTAF:
return 0x80*2;
case coding_MC3:
return 10;
case coding_CRI_HCA:
return clHCA_samplesPerBlock;
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
@ -1159,11 +1091,15 @@ int get_vgmstream_samples_per_shortframe(VGMSTREAM * vgmstream) {
}
}
/* get the data size of a single frame (1 or N channels), for interleaved/blocked layouts */
int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
switch (vgmstream->coding_type) {
case coding_CRI_ADX:
case coding_CRI_ADX_fixed:
case coding_CRI_ADX_exp:
case coding_CRI_ADX_enc_8:
case coding_CRI_ADX_enc_9:
return vgmstream->interleave_block_size;
case coding_L5_555:
return 18;
case coding_NGC_DSP:
@ -1220,7 +1156,7 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_XA:
return 14*vgmstream->channels;
case coding_XBOX:
case coding_INT_XBOX:
case coding_XBOX_int:
case coding_FSB_IMA:
return 36;
case coding_MAXIS_ADPCM:
@ -1231,8 +1167,8 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return 1; // the frame is variant in size
case coding_WS:
return vgmstream->current_block_size;
case coding_INT_IMA:
case coding_INT_DVI_IMA:
case coding_IMA_int:
case coding_DVI_IMA_int:
case coding_AICA:
return 1;
case coding_APPLE_IMA4:
@ -1255,6 +1191,8 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_MSADPCM:
case coding_MTAF:
return vgmstream->interleave_block_size;
case coding_MC3:
return 4;
default:
return 0;
}
@ -1291,7 +1229,26 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
for (chan=0;chan<vgmstream->channels;chan++) {
decode_adx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
samples_to_do,
vgmstream->interleave_block_size);
}
break;
case coding_CRI_ADX_exp:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_adx_exp(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do,
vgmstream->interleave_block_size);
}
break;
case coding_CRI_ADX_fixed:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_adx_fixed(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do,
vgmstream->interleave_block_size);
}
break;
@ -1300,7 +1257,8 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
for (chan=0;chan<vgmstream->channels;chan++) {
decode_adx_enc(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
samples_to_do,
vgmstream->interleave_block_size);
}
break;
@ -1395,7 +1353,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do,chan);
}
break;
case coding_INT_XBOX:
case coding_XBOX_int:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_int_xbox_ima(vgmstream,&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
@ -1581,7 +1539,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
}
break;
case coding_DVI_IMA:
case coding_INT_DVI_IMA:
case coding_DVI_IMA_int:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_dvi_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
@ -1596,7 +1554,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
}
break;
case coding_IMA:
case coding_INT_IMA:
case coding_IMA_int:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
@ -1777,6 +1735,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
chan, vgmstream->channels);
}
break;
case coding_MC3:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_mc3(vgmstream, &vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels, vgmstream->samples_into_block, samples_to_do,
chan);
}
break;
}
}
@ -1805,135 +1770,122 @@ int vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMST
}
/* if it's a framed encoding don't do more than one frame */
if (samples_per_frame>1 && (vgmstream->samples_into_block%samples_per_frame)+samples_to_do>samples_per_frame) samples_to_do=samples_per_frame-(vgmstream->samples_into_block%samples_per_frame);
if (samples_per_frame>1 && (vgmstream->samples_into_block%samples_per_frame)+samples_to_do>samples_per_frame)
samples_to_do = samples_per_frame - (vgmstream->samples_into_block%samples_per_frame);
return samples_to_do;
}
/* return 1 if we just looped */
int vgmstream_do_loop(VGMSTREAM * vgmstream) {
/* if (vgmstream->loop_flag) {*/
/* is this the loop end? */
if (vgmstream->current_sample==vgmstream->loop_end_sample) {
/* against everything I hold sacred, preserve adpcm
* history through loop for certain types */
if (vgmstream->meta_type == meta_DSP_STD ||
vgmstream->meta_type == meta_DSP_RS03 ||
vgmstream->meta_type == meta_DSP_CSTR ||
vgmstream->coding_type == coding_PSX ||
vgmstream->coding_type == coding_PSX_bmdx ||
vgmstream->coding_type == coding_PSX_badflags) {
int i;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->loop_ch[i].adpcm_history1_16 = vgmstream->ch[i].adpcm_history1_16;
vgmstream->loop_ch[i].adpcm_history2_16 = vgmstream->ch[i].adpcm_history2_16;
vgmstream->loop_ch[i].adpcm_history1_32 = vgmstream->ch[i].adpcm_history1_32;
vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32;
}
}
/* todo preserve ADPCM (ex hevag) history? */
/*if (vgmstream->loop_flag) return 0;*/
if (vgmstream->coding_type==coding_CRI_HCA) {
hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data);
data->curblock = data->info.loopStart;
data->sample_ptr = clHCA_samplesPerBlock;
data->samples_discard = 0;
/* is this the loop end? */
if (vgmstream->current_sample==vgmstream->loop_end_sample) {
/* against everything I hold sacred, preserve adpcm
* history through loop for certain types */
if (vgmstream->meta_type == meta_DSP_STD ||
vgmstream->meta_type == meta_DSP_RS03 ||
vgmstream->meta_type == meta_DSP_CSTR ||
vgmstream->coding_type == coding_PSX ||
vgmstream->coding_type == coding_PSX_bmdx ||
vgmstream->coding_type == coding_PSX_badflags) {
int i;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->loop_ch[i].adpcm_history1_16 = vgmstream->ch[i].adpcm_history1_16;
vgmstream->loop_ch[i].adpcm_history2_16 = vgmstream->ch[i].adpcm_history2_16;
vgmstream->loop_ch[i].adpcm_history1_32 = vgmstream->ch[i].adpcm_history1_32;
vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32;
}
}
/* prepare certain codecs' internal state for looping */
if (vgmstream->coding_type==coding_CRI_HCA) {
loop_hca(vgmstream);
}
#ifdef VGM_USE_VORBIS
if (vgmstream->coding_type==coding_ogg_vorbis) {
ogg_vorbis_codec_data *data =
(ogg_vorbis_codec_data *)(vgmstream->codec_data);
OggVorbis_File *ogg_vorbis_file = &(data->ogg_vorbis_file);
ov_pcm_seek_lap(ogg_vorbis_file, vgmstream->loop_sample);
}
if (vgmstream->coding_type==coding_ogg_vorbis) {
seek_ogg_vorbis(vgmstream, vgmstream->loop_sample);
}
if (vgmstream->coding_type==coding_fsb_vorbis) {
seek_fsb_vorbis(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_fsb_vorbis) {
seek_fsb_vorbis(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_wwise_vorbis) {
seek_wwise_vorbis(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_wwise_vorbis) {
seek_wwise_vorbis(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_ogl_vorbis) {
seek_ogl_vorbis(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_ogl_vorbis) {
seek_ogl_vorbis(vgmstream, vgmstream->loop_start_sample);
}
#endif
#ifdef VGM_USE_FFMPEG
if (vgmstream->coding_type==coding_FFmpeg) {
seek_ffmpeg(vgmstream, vgmstream->loop_start_sample);
}
if (vgmstream->coding_type==coding_FFmpeg) {
seek_ffmpeg(vgmstream, vgmstream->loop_start_sample);
}
#endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
if (vgmstream->coding_type==coding_MP4_AAC) {
mp4_aac_codec_data *data = (mp4_aac_codec_data *)(vgmstream->codec_data);
data->sampleId = 0;
data->sample_ptr = data->samples_per_frame;
data->samples_discard = vgmstream->loop_sample;
}
if (vgmstream->coding_type==coding_MP4_AAC) {
seek_mp4_aac(vgmstream, vgmstream->loop_sample);
}
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
if (vgmstream->coding_type==coding_AT3plus) {
int blocks_to_skip = vgmstream->loop_sample / 2048;
int samples_to_discard = vgmstream->loop_sample % 2048;
maiatrac3plus_codec_data *data = (maiatrac3plus_codec_data *)(vgmstream->codec_data);
vgmstream->loop_ch[0].offset =
vgmstream->loop_ch[0].channel_start_offset +
vgmstream->interleave_block_size * blocks_to_skip;
data->samples_discard = samples_to_discard;
}
if (vgmstream->coding_type==coding_AT3plus) {
seek_at3plus(vgmstream, vgmstream->loop_sample);
}
#endif
#ifdef VGM_USE_MPEG
/* won't work for fake MPEG */
if (vgmstream->layout_type==layout_mpeg) {
seek_mpeg(vgmstream, vgmstream->loop_sample);
}
if (vgmstream->layout_type==layout_mpeg) {
seek_mpeg(vgmstream, vgmstream->loop_sample); /* won't work for fake MPEG */
}
#endif
if (vgmstream->coding_type == coding_NWA0 ||
vgmstream->coding_type == coding_NWA1 ||
vgmstream->coding_type == coding_NWA2 ||
vgmstream->coding_type == coding_NWA3 ||
vgmstream->coding_type == coding_NWA4 ||
vgmstream->coding_type == coding_NWA5)
{
nwa_codec_data *data = vgmstream->codec_data;
seek_nwa(data->nwa, vgmstream->loop_sample);
}
/* restore! */
memcpy(vgmstream->ch,vgmstream->loop_ch,sizeof(VGMSTREAMCHANNEL)*vgmstream->channels);
vgmstream->current_sample=vgmstream->loop_sample;
vgmstream->samples_into_block=vgmstream->loop_samples_into_block;
vgmstream->current_block_size=vgmstream->loop_block_size;
vgmstream->current_block_offset=vgmstream->loop_block_offset;
vgmstream->next_block_offset=vgmstream->loop_next_block_offset;
return 1;
if (vgmstream->coding_type == coding_NWA0 ||
vgmstream->coding_type == coding_NWA1 ||
vgmstream->coding_type == coding_NWA2 ||
vgmstream->coding_type == coding_NWA3 ||
vgmstream->coding_type == coding_NWA4 ||
vgmstream->coding_type == coding_NWA5)
{
nwa_codec_data *data = vgmstream->codec_data;
seek_nwa(data->nwa, vgmstream->loop_sample);
}
/* restore! */
memcpy(vgmstream->ch,vgmstream->loop_ch,sizeof(VGMSTREAMCHANNEL)*vgmstream->channels);
vgmstream->current_sample = vgmstream->loop_sample;
vgmstream->samples_into_block = vgmstream->loop_samples_into_block;
vgmstream->current_block_size = vgmstream->loop_block_size;
vgmstream->current_block_offset = vgmstream->loop_block_offset;
vgmstream->next_block_offset = vgmstream->loop_next_block_offset;
/* is this the loop start? */
if (!vgmstream->hit_loop && vgmstream->current_sample==vgmstream->loop_start_sample) {
/* save! */
memcpy(vgmstream->loop_ch,vgmstream->ch,sizeof(VGMSTREAMCHANNEL)*vgmstream->channels);
return 1; /* looped */
}
vgmstream->loop_sample=vgmstream->current_sample;
vgmstream->loop_samples_into_block=vgmstream->samples_into_block;
vgmstream->loop_block_size=vgmstream->current_block_size;
vgmstream->loop_block_offset=vgmstream->current_block_offset;
vgmstream->loop_next_block_offset=vgmstream->next_block_offset;
vgmstream->hit_loop=1;
}
/*}*/
return 0;
/* is this the loop start? */
if (!vgmstream->hit_loop && vgmstream->current_sample==vgmstream->loop_start_sample) {
/* save! */
memcpy(vgmstream->loop_ch,vgmstream->ch,sizeof(VGMSTREAMCHANNEL)*vgmstream->channels);
vgmstream->loop_sample = vgmstream->current_sample;
vgmstream->loop_samples_into_block = vgmstream->samples_into_block;
vgmstream->loop_block_size = vgmstream->current_block_size;
vgmstream->loop_block_offset = vgmstream->current_block_offset;
vgmstream->loop_next_block_offset = vgmstream->next_block_offset;
vgmstream->hit_loop = 1;
}
return 0; /* not looped */
}
/* build a descriptive string */
@ -1943,18 +1895,22 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
const char* description;
if (!vgmstream) {
snprintf(temp,TEMPSIZE,"NULL VGMSTREAM");
snprintf(temp,TEMPSIZE,
"NULL VGMSTREAM");
concatn(length,desc,temp);
return;
}
snprintf(temp,TEMPSIZE,"sample rate: %d Hz\n"
snprintf(temp,TEMPSIZE,
"sample rate: %d Hz\n"
"channels: %d\n",
vgmstream->sample_rate,vgmstream->channels);
vgmstream->sample_rate,
vgmstream->channels);
concatn(length,desc,temp);
if (vgmstream->loop_flag) {
snprintf(temp,TEMPSIZE,"loop start: %d samples (%.4f seconds)\n"
snprintf(temp,TEMPSIZE,
"loop start: %d samples (%.4f seconds)\n"
"loop end: %d samples (%.4f seconds)\n",
vgmstream->loop_start_sample,
(double)vgmstream->loop_start_sample/vgmstream->sample_rate,
@ -1963,12 +1919,14 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
concatn(length,desc,temp);
}
snprintf(temp,TEMPSIZE,"stream total samples: %d (%.4f seconds)\n",
snprintf(temp,TEMPSIZE,
"stream total samples: %d (%.4f seconds)\n",
vgmstream->num_samples,
(double)vgmstream->num_samples/vgmstream->sample_rate);
concatn(length,desc,temp);
snprintf(temp,TEMPSIZE,"encoding: ");
snprintf(temp,TEMPSIZE,
"encoding: ");
concatn(length,desc,temp);
switch (vgmstream->coding_type) {
#ifdef VGM_USE_FFMPEG
@ -1976,9 +1934,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
ffmpeg_codec_data *data = (ffmpeg_codec_data *) vgmstream->codec_data;
if (vgmstream->codec_data) {
if (data->codec && data->codec->long_name) {
snprintf(temp,TEMPSIZE,data->codec->long_name);
snprintf(temp,TEMPSIZE,"%s",data->codec->long_name);
} else if (data->codec && data->codec->name) {
snprintf(temp,TEMPSIZE,data->codec->name);
snprintf(temp,TEMPSIZE,"%s",data->codec->name);
} else {
snprintf(temp,TEMPSIZE,"FFmpeg (unknown codec)");
}
@ -1992,56 +1950,79 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
description = get_vgmstream_coding_description(vgmstream->coding_type);
if (!description)
description = "CANNOT DECODE";
strncpy(temp,description,TEMPSIZE);
snprintf(temp,TEMPSIZE,"%s",description);
break;
}
concatn(length,desc,temp);
snprintf(temp,TEMPSIZE,"\nlayout: ");
snprintf(temp,TEMPSIZE,
"\nlayout: ");
concatn(length,desc,temp);
switch (vgmstream->layout_type) {
default:
description = get_vgmstream_layout_description(vgmstream->layout_type);
if (!description)
description = "INCONCEIVABLE";
strncpy(temp,description,TEMPSIZE);
snprintf(temp,TEMPSIZE,"%s",description);
break;
}
concatn(length,desc,temp);
snprintf(temp,TEMPSIZE,"\n");
snprintf(temp,TEMPSIZE,
"\n");
concatn(length,desc,temp);
if (vgmstream->layout_type == layout_interleave
|| vgmstream->layout_type == layout_interleave_shortblock
|| vgmstream->layout_type == layout_interleave_byte) {
snprintf(temp,TEMPSIZE,"interleave: %#x bytes\n",
snprintf(temp,TEMPSIZE,
"interleave: %#x bytes\n",
(int32_t)vgmstream->interleave_block_size);
concatn(length,desc,temp);
if (vgmstream->layout_type == layout_interleave_shortblock) {
snprintf(temp,TEMPSIZE,"last block interleave: %#x bytes\n",
snprintf(temp,TEMPSIZE,
"last block interleave: %#x bytes\n",
(int32_t)vgmstream->interleave_smallblock_size);
concatn(length,desc,temp);
}
}
snprintf(temp,TEMPSIZE,"metadata from: ");
concatn(length,desc,temp);
/* codecs with blocks + headers (there are more, this is a start) */
if (vgmstream->layout_type == layout_none && vgmstream->interleave_block_size > 0) {
switch (vgmstream->coding_type) {
case coding_MSADPCM:
case coding_MS_IMA:
case coding_MC3:
case coding_WWISE_IMA:
snprintf(temp,TEMPSIZE,
"block size: %#x bytes\n",
(int32_t)vgmstream->interleave_block_size);
concatn(length,desc,temp);
break;
default:
break;
}
}
snprintf(temp,TEMPSIZE,
"metadata from: ");
concatn(length,desc,temp);
switch (vgmstream->meta_type) {
default:
description = get_vgmstream_meta_description(vgmstream->meta_type);
if (!description)
description = "THEY SHOULD HAVE SENT A POET";
strncpy(temp,description,TEMPSIZE);
snprintf(temp,TEMPSIZE,"%s",description);
break;
}
concatn(length,desc,temp);
/* only interesting if more than one */
if (vgmstream->num_streams > 1) {
snprintf(temp,TEMPSIZE,"\nnumber of streams: %d",vgmstream->num_streams);
snprintf(temp,TEMPSIZE,
"\nnumber of streams: %d",
vgmstream->num_streams);
concatn(length,desc,temp);
}
}

View File

@ -13,9 +13,10 @@ enum { PATH_LIMIT = 32768 };
* done by external libraries.
* If someone wants to do a standalone build, they can do it by simply
* removing these defines (and the references to the libraries in the Makefile) */
#ifndef VGM_DISABLE_VORBIS
#define VGM_USE_VORBIS
#endif
/* can be disabled to decode with FFmpeg instead */
#ifndef VGM_DISABLE_MPEG
#define VGM_USE_MPEG
#endif
@ -56,7 +57,7 @@ enum { PATH_LIMIT = 32768 };
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
#include "maiatrac3plus.h"
#include <maiatrac3plus.h>
#endif
#ifdef VGM_USE_FFMPEG
@ -64,6 +65,8 @@ enum { PATH_LIMIT = 32768 };
#include <libavformat/avformat.h>
#endif
#include "clHCA.h"
#ifdef BUILD_VGMSTREAM
#include "coding/g72x_state.h"
#include "coding/acm_decoder.h"
@ -73,8 +76,6 @@ enum { PATH_LIMIT = 32768 };
#include "acm_decoder.h"
#include "nwa_decoder.h"
#endif
#include "clHCA.h"
/* The encoding type specifies the format the sound data itself takes */
typedef enum {
@ -93,6 +94,8 @@ typedef enum {
/* 4-bit ADPCM */
coding_CRI_ADX, /* CRI ADX */
coding_CRI_ADX_fixed, /* CRI ADX, encoding type 2 with fixed coefficients */
coding_CRI_ADX_exp, /* CRI ADX, encoding type 4 with exponential scale */
coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */
coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */
@ -115,16 +118,16 @@ typedef enum {
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
coding_XBOX, /* XBOX IMA ADPCM */
coding_INT_XBOX, /* XBOX IMA ADPCM (interleaved) */
coding_XBOX_int, /* XBOX IMA ADPCM (interleaved) */
coding_IMA, /* IMA ADPCM (low nibble first) */
coding_INT_IMA, /* IMA ADPCM (interleaved) */
coding_IMA_int, /* IMA ADPCM (interleaved) */
coding_DVI_IMA, /* DVI IMA ADPCM (high nibble first), aka ADP4 */
coding_INT_DVI_IMA, /* DVI IMA ADPCM (Interleaved) */
coding_DVI_IMA_int, /* DVI IMA ADPCM (Interleaved) */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_EACS_IMA,
coding_MS_IMA, /* Microsoft IMA */
coding_RAD_IMA, /* "Radical ADPCM" IMA */
coding_RAD_IMA_mono, /* "Radical ADPCM" IMA, mono (for interleave) */
coding_RAD_IMA, /* Radical IMA ADPCM */
coding_RAD_IMA_mono, /* Radical IMA ADPCM, mono (for interleave) */
coding_APPLE_IMA4, /* Apple Quicktime IMA4 */
coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */
coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */
@ -139,6 +142,7 @@ typedef enum {
coding_SASSC, /* Activision EXAKT SASSC DPCM */
coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/
coding_MTAF, /* Konami MTAF ADPCM (IMA-derived) */
coding_MC3, /* Paradigm MC3 3-bit ADPCM */
/* others */
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression DPCM */
@ -317,7 +321,7 @@ typedef enum {
meta_PSX_XA, /* CD-ROM XA with RIFF header */
meta_PS2_SShd, /* .ADS with SShd header */
meta_PS2_NPSF, /* Namco Production Sound File */
meta_PS2_RXW, /* Sony Arc The Lad Sound File */
meta_PS2_RXWS, /* Sony games (Genji, Okage Shadow King, Arc The Lad Twilight of Spirits) */
meta_PS2_RAW, /* RAW Interleaved Format */
meta_PS2_EXST, /* Shadow of Colossus EXST */
meta_PS2_SVAG, /* Konami SVAG */
@ -423,6 +427,7 @@ typedef enum {
meta_RSD6XADP, /* RSD6XADP */
meta_RSD6RADP, /* RSD6RADP */
meta_RSD6OOGV, /* RSD6OOGV */
meta_RSD6XMA, /* RSD6XMA */
meta_PS2_ASS, /* ASS */
meta_PS2_SEG, /* Eragon */
@ -589,7 +594,7 @@ typedef enum {
meta_TUN, // LEGO Racers (PC)
meta_WPD, // Shuffle! (PC)
meta_MN_STR, // Mini Ninjas (PC/PS3/WII)
meta_PS2_MSS, // Guerilla: ShellShock Nam '67, Killzone (PS2)
meta_MSS, // Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2)
meta_PS2_HSF, // Lowrider (PS2)
meta_PS3_IVAG, // Interleaved VAG files (PS3)
meta_PS2_2PFS, // Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2)
@ -614,6 +619,10 @@ typedef enum {
meta_UBI_RAKI, /* Ubisoft RAKI header (Rayman Legends, Just Dance 2017) */
meta_SXD, /* Sony SXD (Gravity Rush, Freedom Wars PSV) */
meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */
meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */
meta_GTD, /* Knights Contract (X360/PS3), Valhalla Knights 3 (PSV) */
meta_TA_AAC_X360, /* tri-ace AAC (Star Ocean 4, End of Eternity, Infinite Undiscovery) */
meta_TA_AAC_PS3, /* tri-ace AAC (Star Ocean International, Resonance of Fate) */
#ifdef VGM_USE_VORBIS
meta_OGG_VORBIS, /* Ogg Vorbis */