2008-01-31 07:04:26 +01:00
/*
* vgmstream . h - definitions for VGMSTREAM , encapsulating a multi - channel , looped audio stream
*/
# ifndef _VGMSTREAM_H
# define _VGMSTREAM_H
2010-03-23 21:57:12 +01:00
/* Due mostly to licensing issues, Vorbis, MPEG, and G.722.1 decoding are
2010-03-21 05:23:18 +01:00
* done by external libraries .
2008-07-05 13:49:29 +02:00
* 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 ) */
2008-06-15 06:01:03 +02:00
# define VGM_USE_VORBIS
2011-05-08 05:12:45 +02:00
//#define VGM_USE_MPEG
2010-04-10 11:58:47 +02:00
/* disabled by default, defined for builds that support it */
//#define VGM_USE_G7221
2008-06-15 06:01:03 +02:00
2008-05-06 05:35:37 +02:00
# include "streamfile.h"
# include "coding/g72x_state.h"
2008-06-15 06:01:03 +02:00
# ifdef VGM_USE_VORBIS
# include <vorbis/vorbisfile.h>
# endif
2008-07-05 13:49:29 +02:00
# ifdef VGM_USE_MPEG
# include <mpg123.h>
# endif
2010-03-23 21:57:12 +01:00
# ifdef VGM_USE_G7221
# include "g7221.h"
# endif
2008-07-20 07:41:41 +02:00
# include "coding/acm_decoder.h"
2008-08-03 16:58:03 +02:00
# include "coding/nwa_decoder.h"
2008-05-06 05:35:37 +02:00
2008-01-31 07:04:26 +01:00
/* The encoding type specifies the format the sound data itself takes */
typedef enum {
/* 16-bit PCM */
coding_PCM16BE , /* big endian 16-bit PCM */
coding_PCM16LE , /* little endian 16-bit PCM */
2009-01-23 15:06:14 +01:00
coding_PCM16LE_int , /* little endian 16-bit PCM with sample-level
2008-07-14 22:42:49 +02:00
interleave handled by the decoder */
2008-07-14 21:21:45 +02:00
2008-01-31 07:04:26 +01:00
/* 8-bit PCM */
coding_PCM8 , /* 8-bit PCM */
2009-04-28 18:52:49 +02:00
coding_PCM8_U , /* 8-bit PCM, unsigned (0x80 = 0) */
2009-01-23 15:06:14 +01:00
coding_PCM8_int , /* 8-Bit PCM with sample-level interleave handled
2008-07-14 22:42:49 +02:00
by the decoder */
2008-07-30 22:58:50 +02:00
coding_PCM8_SB_int , /* 8-bit PCM, sign bit (others are 2's complement),
sample - level interleave */
2008-11-23 13:21:36 +01:00
coding_PCM8_U_int , /* 8-bit PCM, unsigned (0x80 = 0), sample-level
interleave */
2008-07-14 21:21:45 +02:00
2008-01-31 07:04:26 +01:00
/* 4-bit ADPCM */
coding_NDS_IMA , /* IMA ADPCM w/ NDS layout */
coding_CRI_ADX , /* CRI ADX */
2008-12-24 08:19:15 +01:00
coding_CRI_ADX_enc , /* encrypted CRI ADX */
2008-01-31 07:04:26 +01:00
coding_NGC_DSP , /* NGC ADPCM, called DSP */
2008-02-13 15:31:21 +01:00
coding_NGC_DTK , /* NGC hardware disc ADPCM, called DTK, TRK or ADP */
2008-02-14 23:10:08 +01:00
coding_G721 , /* CCITT G.721 ADPCM */
2008-03-03 22:38:11 +01:00
coding_NGC_AFC , /* NGC ADPCM, called AFC */
2009-01-23 15:06:14 +01:00
coding_PSX , /* PSX & PS2 ADPCM */
2009-01-07 13:38:46 +01:00
coding_invert_PSX , /* PSX ADPCM with some weirdness */
2008-07-25 21:02:29 +02:00
coding_PSX_badflags , /* with garbage in the flags byte */
2008-11-07 00:30:33 +01:00
coding_FFXI , /* FF XI PSX-ish ADPCM */
2011-01-12 02:50:45 +01:00
coding_BAF_ADPCM , /* Bizarre Creations PSX-ish ADPCM */
2009-01-23 15:06:14 +01:00
coding_XA , /* PSX CD-XA */
coding_XBOX , /* XBOX IMA */
2009-06-29 23:58:40 +02:00
coding_INT_XBOX , /* XBOX 'real interleaved' IMA */
2009-01-23 15:06:14 +01:00
coding_EAXA , /* EA/XA ADPCM */
coding_EA_ADPCM , /* EA ADPCM */
2009-09-01 23:28:55 +02:00
coding_MAXIS_ADPCM , /* MAXIS ADPCM */
2008-12-28 07:29:43 +01:00
coding_NDS_PROCYON , /* NDS Procyon Studio ADPCM */
2008-07-14 21:21:45 +02:00
2008-06-15 06:01:03 +02:00
# ifdef VGM_USE_VORBIS
coding_ogg_vorbis , /* vorbis */
# endif
2008-07-01 05:23:44 +02:00
coding_SDX2 , /* SDX2 2:1 Squareroot-Delta-Exact compression */
2008-07-14 22:42:49 +02:00
coding_SDX2_int , /* SDX2 2:1 Squareroot-Delta-Exact compression,
with smaple - level interleave handled by the
decoder */
2010-07-27 14:24:03 +02:00
coding_CBD2 , /* CBD2 2:1 Cuberoot-Delta-Exact compression */
coding_CBD2_int , /* CBD2 2:1 Cuberoot-Delta-Exact compression,
with sample - level interleave handled by the
decoder */
2008-07-03 04:20:52 +02:00
coding_DVI_IMA , /* DVI (bare IMA, high nibble first), aka ADP4 */
2009-01-23 15:06:14 +01:00
coding_INT_DVI_IMA , /* Interleaved DVI */
coding_EACS_IMA ,
2008-07-03 04:20:52 +02:00
coding_IMA , /* bare IMA, low nibble first */
2008-09-23 13:07:41 +02:00
coding_INT_IMA , /* */
2009-03-09 13:48:53 +01:00
coding_MS_IMA , /* Microsoft IMA */
2009-09-12 06:51:39 +02:00
coding_RAD_IMA , /* "Radical ADPCM" IMA */
2010-04-10 14:06:25 +02:00
coding_RAD_IMA_mono , /* "Radical ADPCM" IMA, mono (for interleave) */
2009-08-30 04:16:54 +02:00
coding_APPLE_IMA4 , /* Apple Quicktime IMA4 */
2009-12-16 07:12:53 +01:00
coding_DAT4_IMA , /* Eurocom 'DAT4' IMA ADPCM */
2011-02-06 10:49:57 +01:00
coding_SNDS_IMA , /* Heavy Iron Studios .snds IMA ADPCM */
2008-07-03 23:21:01 +02:00
coding_WS , /* Westwood Studios' custom VBR ADPCM */
2008-07-05 13:49:29 +02:00
# ifdef VGM_USE_MPEG
2008-07-06 17:33:38 +02:00
coding_fake_MPEG2_L2 , /* MPEG-2 Layer 2 (AHX), with lying headers */
/* I don't even know offhand if all these combinations exist... */
coding_MPEG1_L1 ,
coding_MPEG1_L2 ,
coding_MPEG1_L3 , /* good ol' MPEG-1 Layer 3 (MP3) */
coding_MPEG2_L1 ,
coding_MPEG2_L2 ,
coding_MPEG2_L3 ,
coding_MPEG25_L1 ,
coding_MPEG25_L2 ,
coding_MPEG25_L3 ,
2008-07-05 13:49:29 +02:00
# endif
2010-03-21 05:23:18 +01:00
# ifdef VGM_USE_G7221
coding_G7221 , /* G.722.1 (Polycom Siren 7) */
coding_G7221C , /* G.722.1 with Annex C extension (Polycom Siren 14) */
# endif
2008-07-20 07:41:41 +02:00
coding_ACM , /* InterPlay ACM */
2008-08-03 16:58:03 +02:00
/* compressed NWA at various levels */
coding_NWA0 ,
coding_NWA1 ,
coding_NWA2 ,
coding_NWA3 ,
coding_NWA4 ,
coding_NWA5 ,
2008-08-11 09:19:44 +02:00
2008-08-13 08:11:05 +02:00
coding_MSADPCM , /* Microsoft ADPCM */
coding_AICA , /* Yamaha AICA ADPCM */
2009-01-04 16:36:06 +01:00
coding_L5_555 , /* Level-5 0x555 */
2009-09-04 06:19:39 +02:00
coding_SASSC , /* Activision EXAKT SASSC DPCM */
2010-08-28 03:43:40 +02:00
coding_PCM16LE_XOR_int , /* sample-level xor */
2011-01-13 09:11:58 +01:00
coding_LSF , /* lsf ADPCM */
2011-05-07 13:05:05 +02:00
coding_MTAF , /* Konami IMA-derived MTAF ADPCM */
2008-01-31 07:04:26 +01:00
} coding_t ;
/* The layout type specifies how the sound data is laid out in the file */
typedef enum {
/* generic */
layout_none , /* straight data */
/* interleave */
layout_interleave , /* equal interleave throughout the stream */
layout_interleave_shortblock , /* interleave with a short last block */
2008-07-14 14:31:19 +02:00
layout_interleave_byte , /* full byte interleave */
2008-01-31 07:04:26 +01:00
/* headered blocks */
2008-03-04 01:46:55 +01:00
layout_ast_blocked , /* .ast STRM with BLCK blocks*/
2008-03-04 08:15:25 +01:00
layout_halpst_blocked , /* blocks with HALPST-format header */
2009-01-23 15:06:14 +01:00
layout_xa_blocked ,
layout_ea_blocked ,
layout_eacs_blocked ,
layout_caf_blocked ,
2008-06-29 03:30:13 +02:00
layout_wsi_blocked ,
2008-07-02 15:39:51 +02:00
layout_str_snds_blocked ,
2008-07-03 04:20:52 +02:00
layout_ws_aud_blocked ,
2009-01-23 15:06:14 +01:00
layout_matx_blocked ,
2008-08-11 09:19:44 +02:00
layout_de2_blocked ,
2009-01-23 15:06:14 +01:00
layout_xvas_blocked ,
layout_vs_blocked ,
layout_emff_ps2_blocked ,
layout_emff_ngc_blocked ,
layout_gsb_blocked ,
layout_thp_blocked ,
layout_filp_blocked ,
2010-04-20 22:26:10 +02:00
layout_psx_mgav_blocked ,
2010-05-02 21:16:35 +02:00
layout_ps2_adm_blocked ,
2010-05-10 10:02:22 +02:00
layout_dsp_bdsp_blocked ,
2011-05-07 13:05:05 +02:00
layout_mxch_blocked ,
2010-10-03 10:04:17 +02:00
2008-03-04 01:46:55 +01:00
#if 0
2008-01-31 07:04:26 +01:00
layout_strm_blocked , /* */
2008-02-15 17:26:29 +01:00
# endif
2008-02-13 15:31:21 +01:00
/* otherwise odd */
layout_dtk_interleave , /* dtk interleaves channels by nibble */
2008-06-15 06:01:03 +02:00
# ifdef VGM_USE_VORBIS
layout_ogg_vorbis , /* ogg vorbis file */
# endif
2008-07-05 13:49:29 +02:00
# ifdef VGM_USE_MPEG
layout_fake_mpeg , /* MPEG audio stream with bad frame headers (AHX) */
2008-07-06 17:33:38 +02:00
layout_mpeg , /* proper MPEG audio stream */
2008-07-05 13:49:29 +02:00
# endif
2008-07-20 07:41:41 +02:00
layout_acm , /* dummy, let libacm handle layout */
2008-07-21 01:28:16 +02:00
layout_mus_acm , /* mus has multi-files to deal with */
2008-08-02 12:24:28 +02:00
layout_aix , /* CRI AIX's wheels within wheels */
2009-01-03 12:08:44 +01:00
layout_aax , /* CRI AAX's wheels within databases */
2009-03-19 20:43:06 +01:00
layout_ivaud_blocked , /* GTA IV .ivaud blocks */
2010-12-03 23:48:51 +01:00
layout_tra_blocked , /* DefJam Rapstar .tra blocks */
2010-12-06 23:22:06 +01:00
layout_ps2_iab_blocked ,
2010-12-29 13:33:33 +01:00
layout_ps2_strlr_blocked ,
2008-01-31 07:04:26 +01:00
} layout_t ;
/* The meta type specifies how we know what we know about the file. We may know because of a header we read, some of it may have been guessed from filenames, etc. */
typedef enum {
/* DSP-specific */
meta_DSP_STD , /* standard GC ADPCM (DSP) header */
meta_DSP_CSTR , /* Star Fox Assault "Cstr" */
meta_DSP_RS03 , /* Metroid Prime 2 "RS03" */
meta_DSP_STM , /* Paper Mario 2 STM */
meta_DSP_HALP , /* SSB:M "HALPST" */
2008-05-15 00:26:44 +02:00
meta_DSP_AGSC , /* Metroid Prime 2 title */
meta_DSP_MPDSP , /* Monopoly Party single header stereo */
2008-05-16 00:06:33 +02:00
meta_DSP_JETTERS , /* Bomberman Jetters .dsp */
meta_DSP_MSS ,
meta_DSP_GCM ,
2008-06-15 11:23:34 +02:00
meta_DSP_STR , /* Conan .str files */
meta_DSP_SADB , /* .sad */
2008-06-29 03:30:13 +02:00
meta_DSP_WSI , /* .wsi */
2009-01-23 15:06:14 +01:00
meta_DSP_AMTS , /* .amts */
meta_DSP_WII_IDSP , /* .gcm with IDSP header */
2008-10-11 06:00:57 +02:00
meta_DSP_WII_MUS , /* .mus */
2009-03-28 06:49:16 +01:00
meta_DSP_WII_WSD , /* Phantom Brave (WII) */
2009-03-30 06:18:46 +02:00
meta_WII_NDP , /* Vertigo (Wii) */
2010-02-05 19:25:31 +01:00
meta_DSP_YGO , /* Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
2008-05-28 13:36:17 +02:00
2008-01-31 07:04:26 +01:00
/* Nintendo */
meta_STRM , /* STRM */
meta_RSTM , /* RSTM (similar to STRM) */
2008-03-03 22:38:11 +01:00
meta_AFC , /* AFC */
2008-03-04 01:46:55 +01:00
meta_AST , /* AST */
2008-05-06 03:01:06 +02:00
meta_RWSD , /* single-stream RWSD */
2008-12-20 23:57:54 +01:00
meta_RWAR , /* single-stream RWAR */
2009-01-20 02:03:33 +01:00
meta_RWAV , /* contents of RWAR */
2008-05-17 01:14:47 +02:00
meta_RSTM_SPM , /* RSTM with 44->22khz hack */
2009-01-23 15:06:14 +01:00
meta_THP ,
2009-01-01 04:24:57 +01:00
meta_RSTM_shrunken , /* Atlus' mutant shortened RSTM */
2009-02-06 20:16:37 +01:00
meta_NDS_SWAV , /* Asphalt Urban GT 1 & 2 */
2009-03-05 11:11:47 +01:00
meta_NDS_RRDS , /* Ridge Racer DS */
2009-09-05 14:18:34 +02:00
meta_WII_BNS , /* Wii BNS Banner Sound (similar to RSTM) */
2009-11-18 01:46:36 +01:00
meta_STX , /* Pikmin .stx */
2008-12-12 00:16:09 +01:00
2008-01-31 07:04:26 +01:00
/* CRI ADX */
meta_ADX_03 , /* ADX "type 03" */
meta_ADX_04 , /* ADX "type 04" */
2009-01-23 15:06:14 +01:00
meta_ADX_05 , /* ADX "type 05" */
2008-08-02 12:24:28 +02:00
meta_AIX , /* CRI AIX */
2009-01-03 12:08:44 +01:00
meta_AAX , /* CRI AAX */
2011-01-04 15:20:49 +01:00
meta_UTF_DSP , /* CRI ADPCM_WII, like AAX with DSP */
2008-05-03 21:44:49 +02:00
2008-01-31 07:04:26 +01:00
/* etc */
2008-02-14 23:10:08 +01:00
meta_NGC_ADPDTK , /* NGC DTK/ADP, no header (.adp) */
2008-01-31 07:04:26 +01:00
meta_kRAW , /* almost headerless PCM */
2008-02-14 23:10:08 +01:00
meta_RSF , /* Retro Studios RSF, no header (.rsf) */
2008-03-04 08:15:25 +01:00
meta_HALPST , /* HAL Labs HALPST */
2008-04-02 19:50:50 +02:00
meta_GCSW , /* GCSW (PCM) */
2009-01-23 15:06:14 +01:00
meta_CFN , /* Namco CAF Audio File */
2010-01-10 22:22:20 +01:00
meta_MYSPD , /* U-Sing .myspd */
2010-01-19 20:40:41 +01:00
meta_HIS , /* Her Ineractive .his */
2010-03-21 05:23:18 +01:00
meta_BNSF , /* Bandai Namco Sound Format */
2009-01-23 15:06:14 +01:00
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_RAW , /* RAW Interleaved Format */
meta_PS2_EXST , /* Shadow of Colossus EXST */
meta_PS2_SVAG , /* Konami SVAG */
meta_PS2_MIB , /* MIB File */
meta_PS2_MIB_MIH , /* MIB File + MIH Header*/
meta_PS2_MIC , /* KOEI MIC File */
meta_PS2_VAGi , /* VAGi Interleaved File */
meta_PS2_VAGp , /* VAGp Mono File */
meta_PS2_VAGm , /* VAGp Mono File */
meta_PS2_pGAV , /* VAGp with Little Endian Header */
meta_PSX_GMS , /* GMS File (used in PS1 & PS2) */
meta_PS2_STR , /* Pacman STR+STH files */
meta_PS2_ILD , /* ILD File */
meta_PS2_PNB , /* PsychoNauts Bgm File */
meta_PSX_XA , /* CD-XA with RIFF header */
meta_PS2_VAGs , /* VAG Stereo from Kingdom Hearts */
meta_PS2_VPK , /* VPK Audio File */
2008-06-25 18:42:13 +02:00
meta_PS2_BMDX , /* Beatmania thing */
2008-07-06 14:23:37 +02:00
meta_PS2_IVB , /* Langrisser 3 IVB */
2009-05-01 17:03:51 +02:00
meta_PS2_SND , /* some Might & Magics SSND header */
2008-07-06 14:23:37 +02:00
meta_PS2_SVS , /* Square SVS */
2008-07-12 17:20:39 +02:00
meta_XSS , /* Dino Crisis 3 */
meta_SL3 , /* Test Drive Unlimited */
meta_HGC1 , /* Knights of the Temple 2 */
meta_AUS , /* Variuos Capcom Games */
meta_RWS , /* Variuos Konami Games */
2009-01-23 15:06:14 +01:00
meta_FSB1 , /* FMOD Sample Bank, version 1 */
2009-09-15 08:22:01 +02:00
meta_FSB3_0 , /* FMOD Sample Bank, version 3.0 */
meta_FSB3_1 , /* FMOD Sample Bank, version 3.1 */
2009-01-23 15:06:14 +01:00
meta_FSB4 , /* FMOD Sample Bank, version 4 */
2010-09-15 21:37:54 +02:00
meta_FSB_MPEG , /* Just Test */
meta_FSB4_WAV , /* FMOD Sample Bank, version 4 with "WAV" Header */
2009-01-23 15:06:14 +01:00
meta_RWX , /* Air Force Delta Storm (XBOX) */
meta_XWB , /* King of Fighters (XBOX) */
meta_XA30 , /* Driver - Parallel Lines (PS2) */
meta_MUSC , /* Spyro Games, possibly more */
meta_MUSX_V004 , /* Spyro Games, possibly more */
2010-05-02 21:16:35 +02:00
meta_MUSX_V005 , /* Spyro Games, possibly more */
2009-01-23 15:06:14 +01:00
meta_MUSX_V006 , /* Spyro Games, possibly more */
meta_MUSX_V010 , /* Spyro Games, possibly more */
meta_MUSX_V201 , /* Sphinx and the cursed Mummy */
meta_LEG , /* Legaia 2 */
meta_FILP , /* Resident Evil - Dead Aim */
meta_IKM , /* Zwei! */
meta_SFS , /* Baroque */
meta_BG00 , /* Ibara, Mushihimesama */
meta_PS2_RSTM , /* Midnight Club 3 */
meta_PS2_KCES , /* Dance Dance Revolution */
meta_PS2_DXH , /* Tokobot Plus - Myteries of the Karakuri */
meta_PS2_PSH , /* Dawn of Mana - Seiken Densetsu 4 */
2010-02-08 21:14:57 +01:00
meta_PCM_SCD , /* Ephemeral Fantasia */
2010-02-27 23:10:52 +01:00
meta_PCM_PS2 , /* Lunar - Eternal Blue */
2009-01-23 15:06:14 +01:00
meta_PS2_RKV , /* Legacy of Kain - Blood Omen 2 */
meta_PS2_PSW , /* Rayman Raving Rabbids */
meta_PS2_VAS , /* Pro Baseball Spirits 5 */
meta_PS2_TEC , /* TECMO badflagged stream */
meta_PS2_ENTH , /* Enthusia */
meta_SDT , /* Baldur's Gate - Dark Alliance */
meta_NGC_TYDSP , /* Ty - The Tasmanian Tiger */
meta_NGC_SWD , /* Conflict - Desert Storm 1 & 2 */
meta_CAPDSP , /* Capcom DSP Header */
meta_DC_STR , /* SEGA Stream Asset Builder */
meta_DC_STR_V2 , /* variant of SEGA Stream Asset Builder */
meta_NGC_BH2PCM , /* Bio Hazard 2 */
meta_SAT_SAP , /* Bubble Symphony */
meta_DC_IDVI , /* Eldorado Gate */
meta_KRAW , /* Geometry Wars - Galaxies */
meta_PS2_OMU , /* PS2 Int file with Header */
2009-04-08 21:31:56 +02:00
meta_PS2_XA2 , /* XG3 Extreme-G Racing */
2010-04-20 22:26:10 +02:00
meta_IDSP , /* Chronicles of Narnia, Soul Calibur Legends, Mario Strikers Charged */
2010-02-27 23:10:52 +01:00
meta_SPT_SPD , /* Variouis */
2009-01-23 15:06:14 +01:00
meta_ISH_ISD , /* Various */
meta_GSP_GSB , /* Various */
meta_YDSP , /* WWE Day of Reckoning */
2010-02-27 23:10:52 +01:00
meta_FFCC_STR , /* Final Fantasy: Crystal Chronicles */
2008-11-11 19:10:26 +01:00
2009-03-11 17:23:47 +01:00
2009-01-23 15:06:14 +01:00
meta_WAA_WAC_WAD_WAM , /* Beyond Good & Evil */
2010-02-27 23:10:52 +01:00
meta_GCA , /* Metal Slug Anthology */
meta_MSVP , /* Popcap Hits */
meta_NGC_SSM , /* Golden Gashbell Full Power */
meta_PS2_JOE , /* Wall-E / Pixar games */
2008-11-11 19:10:26 +01:00
2010-02-27 23:10:52 +01:00
meta_NGC_YMF , /* WWE WrestleMania X8 */
meta_SADL , /* .sad */
meta_PS2_CCC , /* Tokyo Xtreme Racer DRIFT 2 */
meta_PSX_FAG , /* Jackie Chan - Stuntmaster */
meta_PS2_MIHB , /* Merged MIH+MIB */
meta_NGC_PDT , /* Mario Party 6 */
meta_DC_ASD , /* Miss Moonligh */
meta_NAOMI_SPSD , /* Guilty Gear X */
2009-01-23 15:06:14 +01:00
2010-02-27 23:10:52 +01:00
meta_RSD2VAG , /* RSD2VAG */
2009-01-23 15:06:14 +01:00
meta_RSD2PCMB , /* RSD2PCMB */
meta_RSD2XADP , /* RSD2XADP */
2010-02-27 23:10:52 +01:00
meta_RSD3VAG , /* RSD3VAG */
meta_RSD3GADP , /* RSD3GADP */
meta_RSD3PCM , /* RSD3PCM */
2009-05-20 04:48:13 +02:00
meta_RSD3PCMB , /* RSD3PCMB */
2009-01-23 15:06:14 +01:00
meta_RSD4PCMB , /* RSD4PCMB */
2010-02-27 23:10:52 +01:00
meta_RSD4PCM , /* RSD4PCM */
meta_RSD4RADP , /* RSD4RADP */
meta_RSD4VAG , /* RSD4VAG */
meta_RSD6VAG , /* RSD6VAG */
2009-01-23 15:06:14 +01:00
meta_RSD6WADP , /* RSD6WADP */
meta_RSD6XADP , /* RSD6XADP */
2009-09-12 06:51:39 +02:00
meta_RSD6RADP , /* RSD6RADP */
2009-01-23 15:06:14 +01:00
meta_PS2_ASS , /* ASS */
meta_PS2_SEG , /* Eragon */
2011-01-22 03:31:52 +01:00
meta_XBOX_SEG ,
2009-01-23 15:06:14 +01:00
meta_NDS_STRM_FFTA2 , /* Final Fantasy Tactics A2 */
meta_STR_ASR , /* Donkey Kong Jet Race */
meta_ZWDSP , /* Zack and Wiki */
meta_VGS , /* Guitar Hero Encore - Rocks the 80s */
2010-02-15 10:02:31 +01:00
meta_DC_DCSW_DCS , /* Evil Twin - Cypriens Chronicles (DC) */
2009-01-23 15:06:14 +01:00
meta_WII_SMP , /* Mushroom Men - The Spore Wars */
2008-12-24 01:00:10 +01:00
meta_WII_SNG , /* Excite Trucks */
2009-01-23 15:06:14 +01:00
meta_EMFF_PS2 , /* Eidos Music File Format for PS2*/
meta_EMFF_NGC , /* Eidos Music File Format for NGC/WII */
2009-01-28 10:35:55 +01:00
meta_SAT_BAKA , /* Crypt Killer */
2010-02-27 23:10:52 +01:00
meta_PS2_VSF , /* Musashi: Samurai Legend */
meta_PS2_VSF_TTA , /* Tiny Toon Adventures: Defenders of the Universe */
meta_ADS , /* Gauntlet Dark Legends (GC) */
meta_PS2_SPS , /* Ape Escape 2 */
meta_PS2_XA2_RRP , /* RC Revenge Pro */
meta_PS2_STM , /* Red Dead Revolver .stm, renamed .ps2stm */
2010-05-02 21:16:35 +02:00
meta_NGC_DSP_KONAMI , /* Konami DSP header, found in various games */
2009-01-28 10:35:55 +01:00
2009-01-23 15:06:14 +01:00
meta_XBOX_WAVM , /* XBOX WAVM File */
meta_XBOX_RIFF , /* XBOX RIFF/WAVE File */
meta_XBOX_WVS , /* XBOX WVS */
2010-02-27 23:10:52 +01:00
meta_NGC_WVS , /* NGC WVS */
2009-01-23 15:06:14 +01:00
meta_XBOX_STMA , /* XBOX STMA */
meta_XBOX_MATX , /* XBOX MATX */
meta_XBOX_XMU , /* XBOX XMU */
meta_XBOX_XVAS , /* XBOX VAS */
meta_EAXA_R2 , /* EA XA Release 2 */
meta_EAXA_R3 , /* EA XA Release 3 */
meta_EAXA_PSX , /* EA with PSX ADPCM */
meta_EACS_PC , /* EACS PC */
meta_EACS_PSX , /* EACS PSX */
meta_EACS_SAT , /* EACS SATURN */
meta_EA_ADPCM , /* EA XA ADPCM */
meta_EA_IMA , /* EA IMA */
meta_EA_PCM , /* EA PCM */
meta_RAW , /* RAW PCM file */
2008-05-17 19:26:20 +02:00
2008-06-10 03:20:54 +02:00
meta_GENH , /* generic header */
2008-06-15 06:01:03 +02:00
# ifdef VGM_USE_VORBIS
meta_ogg_vorbis , /* ogg vorbis */
2008-07-21 07:50:28 +02:00
meta_OGG_SLI , /* Ogg Vorbis file w/ companion .sli for looping */
2008-07-22 03:03:20 +02:00
meta_OGG_SLI2 , /* Ogg Vorbis file w/ different styled .sli for looping */
2008-07-22 04:18:32 +02:00
meta_OGG_SFL , /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
2008-07-24 23:49:27 +02:00
meta_um3_ogg , /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */
2010-12-11 07:42:42 +01:00
meta_KOVS_ogg , /* Ogg Vorbis with exta header and 0x100 bytes XOR */
2008-06-15 06:01:03 +02:00
# endif
2008-07-01 05:23:44 +02:00
meta_AIFC , /* Audio Interchange File Format AIFF-C */
2008-07-01 18:11:59 +02:00
meta_AIFF , /* Audio Interchange File Format */
2008-07-02 15:39:51 +02:00
meta_STR_SNDS , /* .str with SNDS blocks and SHDR header */
2008-07-03 04:20:52 +02:00
meta_WS_AUD , /* Westwood Studios .aud */
meta_WS_AUD_old , /* Westwood Studios .aud, old style */
2008-07-05 13:49:29 +02:00
# ifdef VGM_USE_MPEG
meta_AHX , /* CRI AHX header (same structure as ADX) */
# endif
2008-07-06 20:05:04 +02:00
meta_RIFF_WAVE , /* RIFF, for WAVs */
meta_RIFF_WAVE_POS , /* .wav + .pos for looping */
2008-07-21 07:03:16 +02:00
meta_RIFF_WAVE_labl_Marker , /* RIFF w/ loop Markers in LIST-adtl-labl */
2008-10-08 02:09:11 +02:00
meta_RIFF_WAVE_smpl , /* RIFF w/ loop data in smpl chunk */
2009-01-04 16:36:06 +01:00
meta_RIFF_WAVE_MWV , /* .mwv RIFF w/ loop data in ctrl chunk pflt */
2010-03-15 05:33:22 +01:00
meta_RIFF_WAVE_SNS , /* .sns RIFF */
2009-05-25 22:59:50 +02:00
meta_RIFX_WAVE , /* RIFX, for big-endian WAVs */
meta_RIFX_WAVE_smpl , /* RIFX w/ loop data in smpl chunk */
2010-02-19 12:28:29 +01:00
meta_PC_MXST , /* Lego Island MxSt */
meta_PC_SOB_SAB , /* Worms 4 Mayhem SOB+SAB file */
2008-07-11 02:41:21 +02:00
meta_NWA , /* Visual Art's NWA */
2008-07-11 08:34:09 +02:00
meta_NWA_NWAINFOINI , /* NWA w/ NWAINFO.INI for looping */
meta_NWA_GAMEEXEINI , /* NWA w/ Gameexe.ini for looping */
2010-02-19 12:28:29 +01:00
meta_DVI , /* DVI Interleaved */
meta_KCEY , /* KCEYCOMP */
2008-07-20 07:41:41 +02:00
meta_ACM , /* InterPlay ACM header */
meta_MUS_ACM , /* MUS playlist of InterPlay ACM files */
2008-08-11 09:19:44 +02:00
meta_DE2 , /* Falcom (Gurumin) .de2 */
2010-02-19 12:28:29 +01:00
meta_VS , /* Men in Black .vs */
2008-11-07 00:30:33 +01:00
meta_FFXI_BGW , /* FFXI BGW */
2008-11-07 02:47:39 +01:00
meta_FFXI_SPW , /* FFXI SPW */
2010-02-19 12:28:29 +01:00
meta_STS_WII , /* Shikigami No Shiro 3 STS Audio File */
meta_PS2_P2BT , /* Pop'n'Music 7 Audio File */
meta_PS2_GBTS , /* Pop'n'Music 9 Audio File */
2010-09-16 13:53:36 +02:00
meta_NGC_DSP_IADP , /* Gamecube Interleave DSP */
2010-02-19 12:28:29 +01:00
meta_PS2_TK5 , /* Tekken 5 Stream Files */
meta_WII_STR , /* House of The Dead Overkill STR+STH */
meta_PS2_MCG , /* Gunvari MCG Files (was name .GCM on disk) */
2009-03-13 00:42:56 +01:00
meta_ZSD , /* Dragon Booster ZSD */
2009-03-16 16:45:02 +01:00
meta_RedSpark , /* "RedSpark" RSD (MadWorld) */
2010-02-19 12:28:29 +01:00
meta_PC_IVAUD , /* .ivaud GTA IV */
meta_NDS_HWAS , /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */
meta_NGC_LPS , /* Rave Master (Groove Adventure Rave)(GC) */
meta_NAOMI_ADPCM , /* NAOMI/NAOMI2 ARcade games */
meta_SD9 , /* beatmaniaIIDX16 - EMPRESS (Arcade) */
2010-06-29 17:52:07 +02:00
meta_2DX9 , /* beatmaniaIIDX16 - EMPRESS (Arcade) */
2009-07-11 13:28:36 +02:00
meta_PS2_VGV , /* Rune: Viking Warlord */
2009-08-25 19:50:43 +02:00
meta_NGC_GCUB , /* Sega Soccer Slam */
meta_MAXIS_XA , /* Sim City 3000 (PC) */
meta_NGC_SCK_DSP , /* Scorpion King (NGC) */
2009-08-30 04:16:54 +02:00
meta_CAFF , /* iPhone .caf */
2009-09-04 06:19:39 +02:00
meta_EXAKT_SC , /* Activision EXAKT .SC (PS2) */
2009-09-11 20:40:26 +02:00
meta_WII_WAS , /* DiRT 2 (WII) */
2010-02-19 12:28:29 +01:00
meta_PONA_3DO , /* Policenauts (3DO) */
meta_PONA_PSX , /* Policenauts (PSX) */
2009-10-15 11:24:04 +02:00
meta_XBOX_HLWAV , /* Half Life 2 (XBOX) */
2010-02-19 12:28:29 +01:00
meta_PS2_AST , /* Some KOEI game (PS2) */
meta_DMSG , /* Nightcaster II - Equinox (XBOX) */
2010-05-02 21:16:35 +02:00
meta_NGC_DSP_AAAP , /* Turok: Evolution (NGC), Vexx (NGC) */
2010-04-20 22:26:10 +02:00
meta_PS2_STER , /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */
meta_PS2_WB , /* Shooting Love. ~TRIZEAL~ */
2010-03-23 21:57:12 +01:00
meta_S14 , /* raw Siren 14, 24kbit mono */
meta_SSS , /* raw Siren 14, 48kbit stereo */
2010-04-20 22:26:10 +02:00
meta_PS2_GCM , /* NamCollection */
meta_PS2_SMPL , /* Homura */
meta_PS2_MSA , /* Psyvariar -Complete Edition- */
meta_PS2_VOI , /* RAW Danger (Zettaizetsumei Toshi 2 - Itetsuita Kiokutachi) [PS2] */
meta_PS2_KHV , /* Kingdom Hearts 2 VAG streams */
2010-04-12 05:35:58 +02:00
meta_PC_SMP , /* Ghostbusters PC .smp */
2010-04-10 14:06:25 +02:00
meta_P3D , /* Prototype P3D */
2010-09-11 19:53:33 +02:00
meta_PS2_TK1 , /* Tekken (NamCollection) */
2010-04-12 03:06:18 +02:00
meta_PS2_ADSC , /* Kenka Bancho 2: Full Throttle */
2010-04-20 22:26:10 +02:00
meta_NGC_BO2 , /* Blood Omen 2 (NGC) */
meta_DSP_DDSP , /* Various (2 dsp files stuck together */
meta_NGC_DSP_MPDS , /* Big Air Freestyle, Terminator 3 */
meta_DSP_STR_IG , /* Micro Machines, Superman Superman: Shadow of Apokolis */
meta_PSX_MGAV , /* Future Cop L.A.P.D. */
2010-05-02 21:16:35 +02:00
meta_NGC_DSP_STH_STR , /* SpongeBob Squarepants (NGC), Taz Wanted (NGC), Cubix (NGC), Tak (WII)*/
meta_PS2_B1S , /* 7 Wonders of the ancient world */
meta_PS2_WAD , /* The golden Compass */
meta_DSP_XIII , /* XIII, possibly more (Ubisoft header???) */
meta_DSP_CABELAS , /* Cabelas games */
meta_PS2_ADM , /* Dragon Quest 5 */
2010-07-27 21:45:59 +02:00
meta_PS2_LPCM , /* Ah! My Goddess */
2010-05-10 10:02:22 +02:00
meta_DSP_BDSP , /* Ah! My Goddess */
2010-09-11 19:53:33 +02:00
meta_PS2_VMS , /* Autobahn Raser - Police Madness */
meta_PS2_XAU , // Spectral Force Chronicle
2010-06-13 06:41:26 +02:00
meta_GH3_BAR , /* Guitar Hero III Mobile .bar */
2010-09-11 19:53:33 +02:00
meta_FFW , /* Freedom Fighters [NGC] */
meta_DSP_DSPW , /* Sengoku Basara 3 [WII] */
2010-08-28 03:43:40 +02:00
meta_PS2_JSTM , /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
2011-02-08 13:56:16 +01:00
meta_SQEX_SCD , /* Square-Enix SCD */
2010-09-11 19:53:33 +02:00
meta_NGC_NST_DSP , /* Animaniacs [NGC] */
2010-09-11 22:57:39 +02:00
meta_BAF , /* .baf (Blur) */
2010-10-03 10:04:17 +02:00
meta_PS3_XVAG , /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_PS3_CPS , /* Eternal Sonata (PS3) */
2010-09-14 20:22:49 +02:00
meta_PS3_MSF , /* MSF header */
2010-10-12 02:16:49 +02:00
meta_NUB_VAG , /* VAG from Nub archives */
meta_PS3_PAST , /* Bakugan Battle Brawlers (PS3) */
2010-10-19 04:16:08 +02:00
meta_PS3_SGH_SGB , /* Folklore (PS3) */
2010-11-09 05:21:22 +01:00
meta_NGCA , /* GoldenEye 007 (Wii) */
2010-11-22 02:45:39 +01:00
meta_WII_RAS , /* Donkey Kong Country Returns (Wii) */
2010-12-03 23:48:51 +01:00
meta_PS2_SPM , /* Lethal Skies Elite Pilot: Team SW */
meta_X360_TRA , /* Def Jam Rapstar */
2010-12-06 18:30:48 +01:00
meta_PS2_VGS , // Princess Soft PS2 games
2010-12-06 23:22:06 +01:00
meta_PS2_IAB , // Ueki no Housoku - Taosu ze Robert Juudan!! (PS2)
2010-12-29 13:33:33 +01:00
meta_PS2_STRLR ,
2011-01-13 09:11:58 +01:00
meta_LSF_N1NJ4N , /* .lsf n1nj4n Fastlane Street Racing (iPhone) */
2011-02-22 07:57:50 +01:00
meta_PS3_VAWX , // No More Heroes: Heroes Paradise (PS3)
2011-02-06 10:49:57 +01:00
meta_PC_SNDS , // Incredibles PC .snds
2011-02-13 03:23:53 +01:00
meta_PS2_WMUS , // The Warriors (PS2)
2011-02-22 07:57:50 +01:00
meta_HYPERSCAN_KVAG , // Hyperscan KVAG/BVG
meta_IOS_PSND , // Crash Bandicoot Nitro Kart 2 (iOS)
meta_BOS_ADP , // ADP! (Balls of Steel, PC)
2011-03-03 10:03:18 +01:00
meta_EB_SFX , // Excitebots .sfx
meta_EB_SF0 , // Excitebots .sf0
2011-03-23 04:17:53 +01:00
meta_PS3_KLBS , // L@VE ONCE (PS3)
2011-03-23 09:06:05 +01:00
meta_PS3_SGX ,
2011-05-07 13:05:05 +02:00
meta_PS2_MTAF , // Metal Gear Solid 3 MTAF
2008-01-31 07:04:26 +01:00
} meta_t ;
typedef struct {
STREAMFILE * streamfile ; /* file used by this channel */
off_t channel_start_offset ; /* where data for this channel begins */
off_t offset ; /* current location in the file */
2008-07-04 02:06:51 +02:00
off_t frame_header_offset ; /* offset of the current frame header (for WS) */
int samples_left_in_frame ; /* for WS */
2008-01-31 07:04:26 +01:00
/* format specific */
/* adpcm */
int16_t adpcm_coef [ 16 ] ; /* for formats with decode coefficients built in */
2009-01-04 16:36:06 +01:00
int32_t adpcm_coef_3by32 [ 0x60 ] ; /* for Level-5 0x555 */
2008-01-31 07:04:26 +01:00
union {
int16_t adpcm_history1_16 ; /* previous sample */
int32_t adpcm_history1_32 ;
} ;
union {
int16_t adpcm_history2_16 ; /* previous previous sample */
int32_t adpcm_history2_32 ;
} ;
2009-01-04 16:36:06 +01:00
union {
int16_t adpcm_history3_16 ;
int32_t adpcm_history3_32 ;
} ;
2008-02-05 10:21:20 +01:00
2009-03-05 17:08:23 +01:00
double adpcm_history1_double ;
double adpcm_history2_double ;
2008-08-11 09:19:44 +02:00
int adpcm_step_index ; /* for IMA */
int adpcm_scale ; /* for MS ADPCM */
2008-02-14 23:10:08 +01:00
struct g72x_state g72x_state ; /* state for G.721 decoder, sort of big but we
might as well keep it around */
2008-04-02 18:11:53 +02:00
# ifdef DEBUG
int samples_done ;
int16_t loop_history1 , loop_history2 ;
# endif
2008-12-24 08:19:15 +01:00
/* ADX encryption */
int adx_channels ;
uint16_t adx_xor ;
uint16_t adx_mult ;
uint16_t adx_add ;
2009-01-10 01:07:12 +01:00
/* BMDX encryption */
uint8_t bmdx_xor ;
uint8_t bmdx_add ;
2010-08-28 03:43:40 +02:00
/* generic encryption */
uint16_t key_xor ;
2008-01-31 07:04:26 +01:00
} VGMSTREAMCHANNEL ;
typedef struct {
/* basics */
int32_t num_samples ; /* the actual number of samples in this stream */
int32_t sample_rate ; /* sample rate in Hz */
int channels ; /* number of channels */
coding_t coding_type ; /* type of encoding */
layout_t layout_type ; /* type of layout for data */
meta_t meta_type ; /* how we know the metadata */
/* looping */
int loop_flag ; /* is this stream looped? */
int32_t loop_start_sample ; /* first sample of the loop (included in the loop) */
int32_t loop_end_sample ; /* last sample of the loop (not included in the loop) */
/* channels */
VGMSTREAMCHANNEL * ch ; /* pointer to array of channels */
2008-05-20 22:19:46 +02:00
/* channel copies */
2008-03-25 08:30:04 +01:00
VGMSTREAMCHANNEL * start_ch ; /* copies of channel status as they were at the beginning of the stream */
2008-01-31 07:04:26 +01:00
VGMSTREAMCHANNEL * loop_ch ; /* copies of channel status as they were at the loop point */
/* layout-specific */
int32_t current_sample ; /* number of samples we've passed */
int32_t samples_into_block ; /* number of samples into the current block */
/* interleave */
size_t interleave_block_size ; /* interleave for this file */
size_t interleave_smallblock_size ; /* smaller interleave for last block */
/* headered blocks */
off_t current_block_offset ; /* start of this block (offset of block header) */
size_t current_block_size ; /* size of the block we're in now */
off_t next_block_offset ; /* offset of header of the next block */
2010-10-03 10:04:17 +02:00
int block_count ; /* count of "semi" block in total block */
2008-01-31 07:04:26 +01:00
int hit_loop ; /* have we seen the loop yet? */
/* loop layout (saved values) */
int32_t loop_sample ; /* saved from current_sample, should be loop_start_sample... */
int32_t loop_samples_into_block ; /* saved from samples_into_block */
off_t loop_block_offset ; /* saved from current_block_offset */
size_t loop_block_size ; /* saved from current_block_size */
off_t loop_next_block_offset ; /* saved from next_block_offset */
2009-01-23 15:06:14 +01:00
uint8_t xa_channel ; /* Selected XA Channel */
int32_t xa_sector_length ; /* XA block */
2010-10-03 10:04:17 +02:00
uint8_t xa_headerless ; /* headerless XA block */
2008-07-14 22:42:49 +02:00
int8_t get_high_nibble ;
2008-05-19 05:58:15 +02:00
2009-01-23 15:06:14 +01:00
uint8_t ea_big_endian ; /* Big Endian ? */
uint8_t ea_compression_type ;
uint8_t ea_compression_version ;
uint8_t ea_platform ;
2008-06-02 19:58:08 +02:00
2008-07-04 02:06:51 +02:00
int32_t ws_output_size ; /* output bytes for this block */
2008-07-03 23:21:01 +02:00
2008-05-19 05:58:15 +02:00
void * start_vgmstream ; /* a copy of the VGMSTREAM as it was at the beginning of the stream */
2008-06-15 06:01:03 +02:00
2009-01-23 15:06:14 +01:00
int32_t thpNextFrameSize ;
2009-09-01 23:28:55 +02:00
int skip_last_channel ;
2008-12-12 00:16:09 +01:00
2010-10-03 10:04:17 +02:00
/* Data the codec needs for the whole stream. This is for codecs too
2008-06-15 06:01:03 +02:00
* different from vgmstream ' s structure to be reasonably shoehorned into
* using the ch structures .
* Note also that support must be added for resetting , looping and
* closing for every codec that uses this , as it will not be handled . */
void * codec_data ;
2008-01-31 07:04:26 +01:00
} VGMSTREAM ;
2008-06-15 06:01:03 +02:00
# ifdef VGM_USE_VORBIS
typedef struct {
STREAMFILE * streamfile ;
ogg_int64_t offset ;
ogg_int64_t size ;
} ogg_vorbis_streamfile ;
typedef struct {
OggVorbis_File ogg_vorbis_file ;
int bitstream ;
ogg_vorbis_streamfile ov_streamfile ;
} ogg_vorbis_codec_data ;
# endif
2008-07-05 13:49:29 +02:00
# ifdef VGM_USE_MPEG
# define AHX_EXPECTED_FRAME_SIZE 0x414
2008-07-06 17:33:38 +02:00
/* MPEG_BUFFER_SIZE should be >= AHX_EXPECTED_FRAME_SIZE */
# define MPEG_BUFFER_SIZE 0x1000
2008-07-05 13:49:29 +02:00
typedef struct {
2008-07-06 17:33:38 +02:00
uint8_t buffer [ MPEG_BUFFER_SIZE ] ;
2008-07-05 13:49:29 +02:00
int buffer_used ;
int buffer_full ;
2008-07-06 17:33:38 +02:00
size_t bytes_in_buffer ;
2008-07-05 13:49:29 +02:00
mpg123_handle * m ;
2008-07-06 17:33:38 +02:00
} mpeg_codec_data ;
2008-07-05 13:49:29 +02:00
# endif
2008-06-15 06:01:03 +02:00
2010-03-23 21:57:12 +01:00
# ifdef VGM_USE_G7221
typedef struct {
sample buffer [ 640 ] ;
g7221_handle * handle ;
} g7221_codec_data ;
# endif
2008-07-20 07:41:41 +02:00
/* with one file this is also used for just
ACM */
typedef struct {
int file_count ;
int current_file ;
2008-07-20 09:28:17 +02:00
/* the index we return to upon loop completion */
int loop_start_file ;
/* one after the index of the last file, typically
* will be equal to file_count */
int loop_end_file ;
/* Upon exit from a loop, which file to play. */
/* -1 if there is no such file */
/*int end_file;*/
2008-07-20 07:41:41 +02:00
ACMStream * * files ;
} mus_acm_codec_data ;
2008-08-02 12:24:28 +02:00
# define AIX_BUFFER_SIZE 0x1000
/* AIXery */
typedef struct {
sample buffer [ AIX_BUFFER_SIZE ] ;
int segment_count ;
int stream_count ;
int current_segment ;
/* one per segment */
int32_t * sample_counts ;
/* organized like:
* segment1_stream1 , segment1_stream2 , segment2_stream1 , segment2_stream2 */
VGMSTREAM * * adxs ;
} aix_codec_data ;
2009-01-03 12:08:44 +01:00
typedef struct {
int segment_count ;
int current_segment ;
int loop_segment ;
/* one per segment */
int32_t * sample_counts ;
VGMSTREAM * * adxs ;
} aax_codec_data ;
2008-08-03 16:58:03 +02:00
/* for compressed NWA */
typedef struct {
NWAData * nwa ;
} nwa_codec_data ;
2008-01-31 07:04:26 +01:00
/* do format detection, return pointer to a usable VGMSTREAM, or NULL on failure */
VGMSTREAM * init_vgmstream ( const char * const filename ) ;
2008-05-20 17:18:38 +02:00
VGMSTREAM * init_vgmstream_from_STREAMFILE ( STREAMFILE * streamFile ) ;
2008-03-25 08:30:04 +01:00
2008-05-19 05:58:15 +02:00
/* reset a VGMSTREAM to start of stream */
void reset_vgmstream ( VGMSTREAM * vgmstream ) ;
2008-01-31 07:04:26 +01:00
/* allocate a VGMSTREAM and channel stuff */
VGMSTREAM * allocate_vgmstream ( int channel_count , int looped ) ;
/* deallocate, close, etc. */
void close_vgmstream ( VGMSTREAM * vgmstream ) ;
2008-02-05 07:21:57 +01:00
/* calculate the number of samples to be played based on looping parameters */
2008-05-16 22:28:36 +02:00
int32_t get_vgmstream_play_samples ( double looptimes , double fadeseconds , double fadedelayseconds , VGMSTREAM * vgmstream ) ;
2008-01-31 07:04:26 +01:00
/* render! */
void render_vgmstream ( sample * buffer , int32_t sample_count , VGMSTREAM * vgmstream ) ;
2008-02-05 07:21:57 +01:00
/* smallest self-contained group of samples is a frame */
2008-02-05 03:17:35 +01:00
int get_vgmstream_samples_per_frame ( VGMSTREAM * vgmstream ) ;
2008-02-05 07:21:57 +01:00
/* number of bytes per frame */
2008-02-05 03:17:35 +01:00
int get_vgmstream_frame_size ( VGMSTREAM * vgmstream ) ;
2008-02-05 10:21:20 +01:00
/* in NDS IMA the frame size is the block size, so the last one is short */
int get_vgmstream_samples_per_shortframe ( VGMSTREAM * vgmstream ) ;
int get_vgmstream_shortframe_size ( VGMSTREAM * vgmstream ) ;
2008-02-05 03:17:35 +01:00
2008-02-05 07:21:57 +01:00
/* Assume that we have written samples_written into the buffer already, and we have samples_to_do consecutive
* samples ahead of us . Decode those samples into the buffer . */
2008-02-05 03:17:35 +01:00
void decode_vgmstream ( VGMSTREAM * vgmstream , int samples_written , int samples_to_do , sample * buffer ) ;
2008-07-14 15:30:26 +02:00
/* Assume additionally that we have samples_to_do consecutive samples in "data",
* and this this is for channel number " channel " */
void decode_vgmstream_mem ( VGMSTREAM * vgmstream , int samples_written , int samples_to_do , sample * buffer , uint8_t * data , int channel ) ;
2008-02-05 07:21:57 +01:00
/* calculate number of consecutive samples to do (taking into account stopping for loop start and end) */
int vgmstream_samples_to_do ( int samples_this_block , int samples_per_frame , VGMSTREAM * vgmstream ) ;
/* Detect start and save values, also detect end and restore values. Only works on exact sample values.
* Returns 1 if loop was done . */
int vgmstream_do_loop ( VGMSTREAM * vgmstream ) ;
2008-03-25 08:30:04 +01:00
/* Write a description of the stream into array pointed by desc,
* which must be length bytes long . Will always be null - terminated if length > 0
*/
2008-03-11 02:27:59 +01:00
void describe_vgmstream ( VGMSTREAM * vgmstream , char * desc , int length ) ;
2008-02-05 07:44:44 +01:00
2008-03-25 08:30:04 +01:00
/* See if there is a second file which may be the second channel, given
* already opened mono opened_stream which was opened from filename .
* If a suitable file is found , open it and change opened_stream to a
* stereo stream . */
2008-05-20 17:18:38 +02:00
void try_dual_file_stereo ( VGMSTREAM * opened_stream , STREAMFILE * streamFile ) ;
2008-03-17 03:11:18 +01:00
2009-08-30 04:16:54 +02:00
# endif