Minor cleanups (no functionality changes)

- added comments, code alignment for clarity
- renamed some decoders for consistency (ex. eaxa > ea_xa, invert_psx >
psx_bmdx, vgm_adpcm_cfg > psx_cfg)
- removed layout_dkt_interleave (same as nolayout)
- removed skip_last_channel (not used anymore)
- removed meta_DSP_HALP (not used anymore)
This commit is contained in:
bnnm 2017-01-08 01:09:20 +01:00
parent 3e4299b373
commit c7c1564d9f
17 changed files with 463 additions and 445 deletions

View File

@ -3,43 +3,41 @@
#include "../vgmstream.h" #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(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_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void adx_next_key(VGMSTREAMCHANNEL * stream); void adx_next_key(VGMSTREAMCHANNEL * stream);
/* g721_decoder */
void decode_g721(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_g721(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void g72x_init_state(struct g72x_state *state_ptr); void g72x_init_state(struct g72x_state *state_ptr);
/* ima_decoder */
void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_dat4_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_dat4_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_int_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_int_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_eacs_ima(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_eacs_ima(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void decode_snds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_snds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_rad_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_rad_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_rad_ima_mono(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_rad_ima_mono(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_apple_ima4(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_apple_ima4(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* ngc_dsp_decoder */
void decode_ngc_dsp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ngc_dsp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ngc_dsp_mem(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, uint8_t * mem); void decode_ngc_dsp_mem(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, uint8_t * mem);
int32_t dsp_nibbles_to_samples(int32_t nibbles); int32_t dsp_nibbles_to_samples(int32_t nibbles);
/* ngc_dtk_decoder */
void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
/* ngc_afc_decoder */
void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* pcm_decoder */
void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm16LE_XOR_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE_XOR_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
@ -50,38 +48,70 @@ void decode_pcm8_sb_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels
void decode_pcm8_unsigned_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm8_unsigned_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm8_unsigned(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm8_unsigned(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* psx_decoder */
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_psx_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size);
void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); /* xa_decoder */
void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size);
void decode_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void init_get_high_nibble(VGMSTREAM * vgmstream); void init_get_high_nibble(VGMSTREAM * vgmstream);
void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); /*eaxa_decoder */
void decode_ea_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_ea_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_ea_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void decode_maxis_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_maxis_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
/* 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);
/* ws_decoder */
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* acm_decoder */
void decode_acm(ACMStream * acm, sample * outbuf, int32_t samples_to_do, int channelspacing);
/* nwa_decoder */
void decode_nwa(NWAData *nwa, sample *outbuf, int32_t samples_to_do);
/* msadpcm_decoder */
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels);
void decode_msadpcm_stereo(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do);
void decode_msadpcm_mono(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do);
/* aica_decoder */
void decode_aica(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* nds_procyon_decoder */
void decode_nds_procyon(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* l5_555_decoder */
void decode_l5_555(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* SASSC_decoder */
void decode_SASSC(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* lsf_decode */
void decode_lsf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
/* mtaf_decoder */
void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels);
/* hca_decoder */
void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
/* ogg_vorbis_decoder */
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
#endif #endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) /* mpeg_decoder */
void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
#endif
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);
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);
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
mpeg_codec_data *init_mpeg_codec_data(STREAMFILE *streamfile, off_t start_offset, long given_sample_rate, int given_channels, coding_t *coding_type, int * actual_sample_rate, int * actual_channels); mpeg_codec_data *init_mpeg_codec_data(STREAMFILE *streamfile, off_t start_offset, long given_sample_rate, int given_channels, coding_t *coding_type, int * actual_sample_rate, int * actual_channels);
void decode_fake_mpeg2_l2(VGMSTREAMCHANNEL * stream, mpeg_codec_data * data, sample * outbuf, int32_t samples_to_do); void decode_fake_mpeg2_l2(VGMSTREAMCHANNEL * stream, mpeg_codec_data * data, sample * outbuf, int32_t samples_to_do);
@ -90,51 +120,31 @@ long mpeg_bytes_to_samples(long bytes, const struct mpg123_frameinfo *mi);
void mpeg_set_error_logging(mpeg_codec_data * data, int enable); void mpeg_set_error_logging(mpeg_codec_data * data, int enable);
#endif #endif
/* g7221_decoder */
#ifdef VGM_USE_G7221 #ifdef VGM_USE_G7221
void decode_g7221(VGMSTREAM *vgmstream, void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
#endif #endif
/* g719_decoder */
#ifdef VGM_USE_G719 #ifdef VGM_USE_G719
void decode_g719(VGMSTREAM *vgmstream, void decode_g719(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
#endif #endif
/* mp4_aac_decoder */
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
#endif
/* at3_decoder */
#ifdef VGM_USE_MAIATRAC3PLUS #ifdef VGM_USE_MAIATRAC3PLUS
void decode_at3plus(VGMSTREAM *vgmstream, void decode_at3plus(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
#endif #endif
/* ffmpeg_decoder */
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
void decode_ffmpeg(VGMSTREAM *stream, sample * outbuf, int32_t samples_to_do, int channels); void decode_ffmpeg(VGMSTREAM *stream, sample * outbuf, int32_t samples_to_do, int channels);
void reset_ffmpeg(VGMSTREAM *vgmstream); void reset_ffmpeg(VGMSTREAM *vgmstream);
void seek_ffmpeg(VGMSTREAM *vgmstream, int32_t num_sample); void seek_ffmpeg(VGMSTREAM *vgmstream, int32_t num_sample);
#endif #endif
void decode_acm(ACMStream * acm, sample * outbuf, #endif /*_CODING_H*/
int32_t samples_to_do, int channelspacing);
void decode_nwa(NWAData *nwa, sample *outbuf, int32_t samples_to_do);
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels);
void decode_msadpcm_stereo(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do);
void decode_msadpcm_mono(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do);
void decode_aica(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_nds_procyon(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_l5_555(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_SASSC(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_lsf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels);
void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
#endif

View File

@ -14,7 +14,7 @@ int32_t EA_TABLE[20]= { 0x00000000, 0x000000F0, 0x000001CC, 0x00000188,
0x00000007, 0x00000008, 0x0000000A, 0x0000000B, 0x00000007, 0x00000008, 0x0000000A, 0x0000000B,
0x00000000, 0xFFFFFFFF, 0xFFFFFFFD, 0xFFFFFFFC}; 0x00000000, 0xFFFFFFFF, 0xFFFFFFFD, 0xFFFFFFFC};
void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { void decode_ea_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) {
uint8_t frame_info; uint8_t frame_info;
int32_t sample_count; int32_t sample_count;
int32_t coef1,coef2; int32_t coef1,coef2;

View File

@ -1,5 +1,5 @@
/* /*
* streamtypes.h - widely used type definitions * g72x_state.h - internal state used by g721 decoder
*/ */

View File

@ -214,7 +214,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
stream->adpcm_history2_32=hist2; stream->adpcm_history2_32=hist2;
} }
void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { 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; int predict_nr, shift_factor, sample;
int32_t hist1=stream->adpcm_history1_32; int32_t hist1=stream->adpcm_history1_32;
@ -301,7 +301,7 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel
* *
* Original research and algorithm by id-daemon / daemon1. * Original research and algorithm by id-daemon / daemon1.
*/ */
void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { 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; uint8_t predict_nr, shift, flag, byte;
int32_t scale = 0; int32_t scale = 0;
@ -367,7 +367,7 @@ void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels
* PS ADPCM of configurable size, with no flag. * PS ADPCM of configurable size, with no flag.
* Found in PS3 Afrika (SGDX type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33. * Found in PS3 Afrika (SGDX type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33.
*/ */
void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) { 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; uint8_t predict_nr, shift, byte;
int16_t scale = 0; int16_t scale = 0;

View File

@ -4,6 +4,7 @@
#include "../streamtypes.h" #include "../streamtypes.h"
#include "../vgmstream.h" #include "../vgmstream.h"
/* blocked layouts */
void ast_block_update(off_t block_ofset, VGMSTREAM * vgmstream); void ast_block_update(off_t block_ofset, VGMSTREAM * vgmstream);
void mxch_block_update(off_t block_ofset, VGMSTREAM * vgmstream); void mxch_block_update(off_t block_ofset, VGMSTREAM * vgmstream);
@ -46,6 +47,19 @@ void filp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ivaud_block_update(off_t block_offset, VGMSTREAM * vgmstream); void ivaud_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void psx_mgav_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_adm_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream);
/* other layouts */
void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
void render_vgmstream_nolayout(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); void render_vgmstream_nolayout(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
@ -60,16 +74,4 @@ void render_vgmstream_aax(sample * buffer, int32_t sample_count, VGMSTREAM * vgm
void render_vgmstream_scd_int(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); void render_vgmstream_scd_int(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
void psx_mgav_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_adm_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream);
#endif #endif

View File

@ -51,7 +51,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
vgmstream->sample_rate = sample_rate; vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = sample_count; vgmstream->num_samples = sample_count;
vgmstream->coding_type = coding_VAG_ADPCM_cfg; vgmstream->coding_type = coding_PSX_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = frame_size; vgmstream->interleave_block_size = frame_size;
vgmstream->meta_type = meta_BAF; vgmstream->meta_type = meta_BAF;

View File

@ -55,7 +55,7 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
switch (codec) { switch (codec) {
case 0: /* PS ADPCM */ case 0: /* PS ADPCM */
vgmstream->coding_type = coding_VAG_ADPCM_cfg; vgmstream->coding_type = coding_PSX_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */ vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */
@ -138,7 +138,7 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
switch (codec) { switch (codec) {
case 0: /* PS ADPCM */ case 0: /* PS ADPCM */
vgmstream->coding_type = coding_VAG_ADPCM_cfg; vgmstream->coding_type = coding_PSX_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */ vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */

View File

@ -225,7 +225,7 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
vgmstream->meta_type=meta_EAXA_R2; vgmstream->meta_type=meta_EAXA_R2;
} }
vgmstream->coding_type=coding_EAXA; vgmstream->coding_type=coding_EA_XA;
vgmstream->layout_type=layout_ea_blocked; vgmstream->layout_type=layout_ea_blocked;
if((vgmstream->ea_platform==EA_GC) || (vgmstream->ea_platform==EA_X360)) if((vgmstream->ea_platform==EA_GC) || (vgmstream->ea_platform==EA_X360))
vgmstream->ea_big_endian=1; vgmstream->ea_big_endian=1;

View File

@ -215,7 +215,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
break; break;
case coding_NGC_DTK: case coding_NGC_DTK:
vgmstream->layout_type = layout_dtk_interleave; vgmstream->layout_type = layout_none;
break; break;
case coding_NGC_DSP: case coding_NGC_DSP:
if (dsp_interleave_type == 0) { if (dsp_interleave_type == 0) {

View File

@ -29,7 +29,7 @@ VGMSTREAM * init_vgmstream_ngc_adpdtk(STREAMFILE *streamFile) {
vgmstream->num_samples = file_size/32*28; vgmstream->num_samples = file_size/32*28;
vgmstream->sample_rate = 48000; vgmstream->sample_rate = 48000;
vgmstream->coding_type = coding_NGC_DTK; vgmstream->coding_type = coding_NGC_DTK;
vgmstream->layout_type = layout_dtk_interleave; vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_NGC_ADPDTK; vgmstream->meta_type = meta_NGC_ADPDTK;
/* locality is such that two streamfiles is silly */ /* locality is such that two streamfiles is silly */

View File

@ -233,13 +233,13 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) {
callbacks.tell_func = tell_func; callbacks.tell_func = tell_func;
if (um3_ogg) { if (um3_ogg) {
inf.meta_type = meta_um3_ogg; inf.meta_type = meta_OGG_UM3;
} else if (kovs_ogg) { } else if (kovs_ogg) {
inf.meta_type = meta_KOVS_ogg; inf.meta_type = meta_OGG_KOVS;
} else if (psych_ogg) { } else if (psych_ogg) {
inf.meta_type = meta_psych_ogg; inf.meta_type = meta_OGG_PSYCH;
} else { } else {
inf.meta_type = meta_ogg_vorbis; inf.meta_type = meta_OGG_VORBIS;
} }
inf.layout_type = layout_ogg_vorbis; inf.layout_type = layout_ogg_vorbis;

View File

@ -33,7 +33,7 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) {
/* Check for Compression Scheme */ /* Check for Compression Scheme */
if (read_32bitLE(0x20,streamFile) == 1) if (read_32bitLE(0x20,streamFile) == 1)
vgmstream->coding_type = coding_invert_PSX; vgmstream->coding_type = coding_PSX_bmdx;
else else
vgmstream->coding_type = coding_PSX; vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0c,streamFile)*28/16/channel_count; vgmstream->num_samples = read_32bitLE(0x0c,streamFile)*28/16/channel_count;
@ -55,7 +55,7 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) {
start_offset = read_32bitLE(0x08,streamFile); start_offset = read_32bitLE(0x08,streamFile);
if (vgmstream->coding_type == coding_invert_PSX) if (vgmstream->coding_type == coding_PSX_bmdx)
{ {
uint8_t xor = read_8bit(start_offset,streamFile); uint8_t xor = read_8bit(start_offset,streamFile);
uint8_t add = (~(uint8_t)read_8bit(start_offset+2,streamFile))+1; uint8_t add = (~(uint8_t)read_8bit(start_offset+2,streamFile))+1;

View File

@ -150,7 +150,7 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) {
start_offset = 0x30; start_offset = 0x30;
} }
else if (version == 0x00020001) { /* HEVAG */ else if (version == 0x00020001) { /* HEVAG */
vgmstream->coding_type = coding_HEVAG_ADPCM; vgmstream->coding_type = coding_HEVAG;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_VAGs; vgmstream->meta_type = meta_PS2_VAGs;

View File

@ -195,7 +195,7 @@ VGMSTREAM * init_vgmstream_ps3_sgdx(STREAMFILE *streamFile) {
} }
#endif #endif
case 0x05: /* Short VAG ADPCM */ case 0x05: /* Short VAG ADPCM */
vgmstream->coding_type = coding_VAG_ADPCM_cfg; vgmstream->coding_type = coding_PSX_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4; vgmstream->interleave_block_size = 0x4;

View File

@ -503,7 +503,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
(long long)loop_start_ms*fmt.sample_rate/1000; (long long)loop_start_ms*fmt.sample_rate/1000;
vgmstream->loop_end_sample = vgmstream->loop_end_sample =
(long long)loop_end_ms*fmt.sample_rate/1000; (long long)loop_end_ms*fmt.sample_rate/1000;
vgmstream->meta_type = meta_RIFF_WAVE_labl_Marker; vgmstream->meta_type = meta_RIFF_WAVE_labl;
} }
else if (loop_start_offset >= 0) else if (loop_start_offset >= 0)
{ {

View File

@ -163,7 +163,6 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_wii_mus, init_vgmstream_wii_mus,
init_vgmstream_dc_asd, init_vgmstream_dc_asd,
init_vgmstream_naomi_spsd, init_vgmstream_naomi_spsd,
init_vgmstream_rsd2vag, init_vgmstream_rsd2vag,
init_vgmstream_rsd2pcmb, init_vgmstream_rsd2pcmb,
init_vgmstream_rsd2xadp, init_vgmstream_rsd2xadp,
@ -337,21 +336,23 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
init_vgmstream_xma, init_vgmstream_xma,
init_vgmstream_mp4_aac_ffmpeg, init_vgmstream_mp4_aac_ffmpeg,
init_vgmstream_ffmpeg,
init_vgmstream_ffmpeg, /* should go at the end */
#endif #endif
}; };
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
/* internal version with all parameters */ /* internal version with all parameters */
VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) { VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
int i; int i, fcns_size;
if (!streamFile) if (!streamFile)
return NULL; return NULL;
fcns_size = (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]));
/* try a series of formats, see which works */ /* try a series of formats, see which works */
for (i=0;i<INIT_VGMSTREAM_FCNS;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); VGMSTREAM * vgmstream = (init_vgmstream_fcns[i])(streamFile);
if (vgmstream) { if (vgmstream) {
/* these are little hacky checks */ /* these are little hacky checks */
@ -912,7 +913,6 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_fake_mpeg: case layout_fake_mpeg:
case layout_mpeg: case layout_mpeg:
#endif #endif
case layout_dtk_interleave:
case layout_none: case layout_none:
render_vgmstream_nolayout(buffer,sample_count,vgmstream); render_vgmstream_nolayout(buffer,sample_count,vgmstream);
break; break;
@ -1026,15 +1026,15 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_NGC_AFC: case coding_NGC_AFC:
case coding_PSX: case coding_PSX:
case coding_PSX_badflags: case coding_PSX_badflags:
case coding_invert_PSX: case coding_PSX_bmdx:
case coding_HEVAG_ADPCM: case coding_HEVAG:
case coding_XA: case coding_XA:
return 28; return 28;
case coding_VAG_ADPCM_cfg: case coding_PSX_cfg:
return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */ return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */
case coding_XBOX: case coding_XBOX:
case coding_INT_XBOX: case coding_INT_XBOX:
case coding_EAXA: case coding_EA_XA:
return 28; return 28;
case coding_MAXIS_ADPCM: case coding_MAXIS_ADPCM:
case coding_EA_ADPCM: case coding_EA_ADPCM:
@ -1153,11 +1153,11 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_NGC_AFC: case coding_NGC_AFC:
case coding_PSX: case coding_PSX:
case coding_PSX_badflags: case coding_PSX_badflags:
case coding_HEVAG_ADPCM: case coding_PSX_bmdx:
case coding_invert_PSX: case coding_HEVAG:
case coding_NDS_PROCYON: case coding_NDS_PROCYON:
return 16; return 16;
case coding_VAG_ADPCM_cfg: case coding_PSX_cfg:
return vgmstream->interleave_block_size; return vgmstream->interleave_block_size;
case coding_XA: case coding_XA:
return 14*vgmstream->channels; return 14*vgmstream->channels;
@ -1168,7 +1168,7 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return 15*vgmstream->channels; return 15*vgmstream->channels;
case coding_EA_ADPCM: case coding_EA_ADPCM:
return 30; return 30;
case coding_EAXA: case coding_EA_XA:
return 1; // the frame is variant in size return 1; // the frame is variant in size
case coding_WS: case coding_WS:
return vgmstream->current_block_size; return vgmstream->current_block_size;
@ -1387,20 +1387,10 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
break; break;
case coding_PSX: case coding_PSX:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
if(vgmstream->skip_last_channel)
{
if(chan!=vgmstream->channels-1) {
decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do); samples_to_do);
} }
} else {
decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
}
}
break; break;
case coding_PSX_badflags: case coding_PSX_badflags:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
@ -1409,23 +1399,23 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
case coding_invert_PSX: case coding_PSX_bmdx:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_invert_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_psx_bmdx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do); samples_to_do);
} }
break; break;
case coding_HEVAG_ADPCM: case coding_HEVAG:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_hevag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_hevag(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do); samples_to_do);
} }
break; break;
case coding_VAG_ADPCM_cfg: case coding_PSX_cfg:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_vag_adpcm_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_psx_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do, vgmstream->interleave_block_size); samples_to_do, vgmstream->interleave_block_size);
} }
@ -1437,9 +1427,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do,chan); samples_to_do,chan);
} }
break; break;
case coding_EAXA: case coding_EA_XA:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_eaxa(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_ea_xa(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do,chan); samples_to_do,chan);
} }
@ -1557,6 +1547,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
case coding_fake_MPEG2_L2: case coding_fake_MPEG2_L2:
decode_fake_mpeg2_l2( decode_fake_mpeg2_l2(
@ -1731,7 +1722,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
vgmstream->meta_type == meta_DSP_RS03 || vgmstream->meta_type == meta_DSP_RS03 ||
vgmstream->meta_type == meta_DSP_CSTR || vgmstream->meta_type == meta_DSP_CSTR ||
vgmstream->coding_type == coding_PSX || vgmstream->coding_type == coding_PSX ||
vgmstream->coding_type == coding_invert_PSX || vgmstream->coding_type == coding_PSX_bmdx ||
vgmstream->coding_type == coding_PSX_badflags) { vgmstream->coding_type == coding_PSX_badflags) {
int i; int i;
for (i=0;i<vgmstream->channels;i++) { for (i=0;i<vgmstream->channels;i++) {
@ -1741,7 +1732,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32; vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32;
} }
} }
/* todo preserve hevag/adjustable_vag_adpcm/others history? */ /* todo preserve ADPCM (ex hevag) history? */
#ifdef DEBUG #ifdef DEBUG
{ {
@ -1757,6 +1748,13 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
} }
#endif #endif
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;
}
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
if (vgmstream->coding_type==coding_ogg_vorbis) { if (vgmstream->coding_type==coding_ogg_vorbis) {
ogg_vorbis_codec_data *data = ogg_vorbis_codec_data *data =
@ -1766,17 +1764,13 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
ov_pcm_seek_lap(ogg_vorbis_file, vgmstream->loop_sample); ov_pcm_seek_lap(ogg_vorbis_file, vgmstream->loop_sample);
} }
#endif #endif
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;
}
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
if (vgmstream->coding_type==coding_FFmpeg) { if (vgmstream->coding_type==coding_FFmpeg) {
seek_ffmpeg(vgmstream, vgmstream->loop_start_sample); seek_ffmpeg(vgmstream, vgmstream->loop_start_sample);
} }
#endif /* VGM_USE_FFMPEG */ #endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
if (vgmstream->coding_type==coding_MP4_AAC) { if (vgmstream->coding_type==coding_MP4_AAC) {
mp4_aac_codec_data *data = (mp4_aac_codec_data *)(vgmstream->codec_data); mp4_aac_codec_data *data = (mp4_aac_codec_data *)(vgmstream->codec_data);
@ -1785,6 +1779,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
data->samples_discard = vgmstream->loop_sample; data->samples_discard = vgmstream->loop_sample;
} }
#endif #endif
#ifdef VGM_USE_MAIATRAC3PLUS #ifdef VGM_USE_MAIATRAC3PLUS
if (vgmstream->coding_type==coding_AT3plus) { if (vgmstream->coding_type==coding_AT3plus) {
int blocks_to_skip = vgmstream->loop_sample / 2048; int blocks_to_skip = vgmstream->loop_sample / 2048;
@ -1796,6 +1791,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
data->samples_discard = samples_to_discard; data->samples_discard = samples_to_discard;
} }
#endif #endif
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
/* won't work for fake MPEG */ /* won't work for fake MPEG */
if (vgmstream->layout_type==layout_mpeg) { if (vgmstream->layout_type==layout_mpeg) {
@ -1912,18 +1908,25 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case coding_PCM8_SB_int: case coding_PCM8_SB_int:
snprintf(temp,TEMPSIZE,"8-bit PCM with sign bit, 1 byte interleave"); snprintf(temp,TEMPSIZE,"8-bit PCM with sign bit, 1 byte interleave");
break; break;
case coding_NGC_DSP:
snprintf(temp,TEMPSIZE,"Gamecube \"DSP\" 4-bit ADPCM");
break;
case coding_CRI_ADX: case coding_CRI_ADX:
snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM");
break; break;
case coding_CRI_ADX_enc_8: case coding_CRI_ADX_enc_8:
snprintf(temp,TEMPSIZE,"encrypted (type 8) CRI ADX 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)");
break; break;
case coding_CRI_ADX_enc_9: case coding_CRI_ADX_enc_9:
snprintf(temp,TEMPSIZE,"encrypted (type 9) CRI ADX 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)");
break; break;
case coding_NGC_DSP:
snprintf(temp,TEMPSIZE,"Nintendo DSP 4-bit ADPCM");
break;
case coding_NGC_DTK:
snprintf(temp,TEMPSIZE,"Nintendo DTK 4-bit ADPCM");
break;
case coding_NGC_AFC:
snprintf(temp,TEMPSIZE,"Nintendo AFC 4-bit ADPCM");
break;
case coding_CRI_HCA: case coding_CRI_HCA:
snprintf(temp,TEMPSIZE,"CRI HCA"); snprintf(temp,TEMPSIZE,"CRI HCA");
break; break;
@ -1933,30 +1936,24 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case coding_DAT4_IMA: case coding_DAT4_IMA:
snprintf(temp,TEMPSIZE,"Eurocom DAT4 4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"Eurocom DAT4 4-bit IMA ADPCM");
break; break;
case coding_NGC_DTK:
snprintf(temp,TEMPSIZE,"Gamecube \"ADP\"/\"DTK\" 4-bit ADPCM");
break;
case coding_G721: case coding_G721:
snprintf(temp,TEMPSIZE,"CCITT G.721 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CCITT G.721 4-bit ADPCM");
break; break;
case coding_NGC_AFC:
snprintf(temp,TEMPSIZE,"Gamecube \"AFC\" 4-bit ADPCM");
break;
case coding_PSX: case coding_PSX:
snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM");
break; break;
case coding_PSX_badflags: case coding_PSX_badflags:
snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM with bad flags"); snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (bad flags)");
break; break;
case coding_invert_PSX: case coding_PSX_bmdx:
snprintf(temp,TEMPSIZE,"BMDX \"encrypted\" Playstation 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (BMDX encryption)");
break; break;
case coding_HEVAG_ADPCM: case coding_PSX_cfg:
snprintf(temp,TEMPSIZE,"PSVita HEVAG ADPCM");
break;
case coding_VAG_ADPCM_cfg:
snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)"); snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)");
break; break;
case coding_HEVAG:
snprintf(temp,TEMPSIZE,"Playstation Vita HEVAG 4-bit ADPCM");
break;
case coding_XA: case coding_XA:
snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM");
break; break;
@ -1964,19 +1961,14 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM");
break; break;
case coding_INT_XBOX: case coding_INT_XBOX:
snprintf(temp,TEMPSIZE,"XBOX Interleaved 4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM (interleaved)");
break; break;
case coding_EAXA: case coding_EA_XA:
snprintf(temp,TEMPSIZE,"Electronic Arts XA Based 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Electronic Arts 4-bit ADPCM (XA based)");
break; break;
case coding_EA_ADPCM: case coding_EA_ADPCM:
snprintf(temp,TEMPSIZE,"Electronic Arts XA Based (R1) 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Electronic Arts R1 4-bit ADPCM (XA based)");
break; break;
#ifdef VGM_USE_VORBIS
case coding_ogg_vorbis:
snprintf(temp,TEMPSIZE,"Vorbis");
break;
#endif
case coding_SDX2: case coding_SDX2:
snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM"); snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM");
break; break;
@ -2023,8 +2015,13 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"Heavy Iron .snds 4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"Heavy Iron .snds 4-bit IMA ADPCM");
break; break;
case coding_WS: case coding_WS:
snprintf(temp,TEMPSIZE,"Westwood Studios DPCM"); snprintf(temp,TEMPSIZE,"Westwood Studios ADPCM");
break; break;
#ifdef VGM_USE_VORBIS
case coding_ogg_vorbis:
snprintf(temp,TEMPSIZE,"Vorbis");
break;
#endif
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
case coding_fake_MPEG2_L2: case coding_fake_MPEG2_L2:
snprintf(temp,TEMPSIZE,"MPEG-2 Layer II Audio"); snprintf(temp,TEMPSIZE,"MPEG-2 Layer II Audio");
@ -2159,9 +2156,6 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case layout_interleave_byte: case layout_interleave_byte:
snprintf(temp,TEMPSIZE,"sub-frame interleave"); snprintf(temp,TEMPSIZE,"sub-frame interleave");
break;
case layout_dtk_interleave:
snprintf(temp,TEMPSIZE,"ADP/DTK nibble interleave");
break; break;
case layout_mxch_blocked: case layout_mxch_blocked:
snprintf(temp,TEMPSIZE,"MxCh blocked"); snprintf(temp,TEMPSIZE,"MxCh blocked");
@ -2486,7 +2480,7 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"GENH Generic Header"); snprintf(temp,TEMPSIZE,"GENH Generic Header");
break; break;
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
case meta_ogg_vorbis: case meta_OGG_VORBIS:
snprintf(temp,TEMPSIZE,"Ogg Vorbis"); snprintf(temp,TEMPSIZE,"Ogg Vorbis");
break; break;
case meta_OGG_SLI: case meta_OGG_SLI:
@ -2498,13 +2492,13 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_OGG_SFL: case meta_OGG_SFL:
snprintf(temp,TEMPSIZE,"Ogg Vorbis with SFPL for looping"); snprintf(temp,TEMPSIZE,"Ogg Vorbis with SFPL for looping");
break; break;
case meta_um3_ogg: case meta_OGG_UM3:
snprintf(temp,TEMPSIZE,"Ogg Vorbis, Ultramarine3 \"encryption\""); snprintf(temp,TEMPSIZE,"Ogg Vorbis, Ultramarine3 \"encryption\"");
break; break;
case meta_KOVS_ogg: case meta_OGG_KOVS:
snprintf(temp,TEMPSIZE,"Ogg Vorbis, KOVS header"); snprintf(temp,TEMPSIZE,"Ogg Vorbis, KOVS header");
break; break;
case meta_psych_ogg: case meta_OGG_PSYCH:
snprintf(temp,TEMPSIZE,"Ogg Vorbis, Psychic Software obfuscation"); snprintf(temp,TEMPSIZE,"Ogg Vorbis, Psychic Software obfuscation");
break; break;
#endif #endif
@ -2666,7 +2660,7 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_PS2_PSH: case meta_PS2_PSH:
snprintf(temp,TEMPSIZE,"Dawn of Mana - Seiken Densetsu 4 PSH Header"); snprintf(temp,TEMPSIZE,"Dawn of Mana - Seiken Densetsu 4 PSH Header");
break; break;
case meta_RIFF_WAVE_labl_Marker: case meta_RIFF_WAVE_labl:
snprintf(temp,TEMPSIZE,"RIFF WAVE header with loop markers"); snprintf(temp,TEMPSIZE,"RIFF WAVE header with loop markers");
break; break;
case meta_RIFF_WAVE_smpl: case meta_RIFF_WAVE_smpl:

View File

@ -7,11 +7,12 @@
enum { PATH_LIMIT = 32768 }; enum { PATH_LIMIT = 32768 };
/* Due mostly to licensing issues, Vorbis, MPEG, and G.722.1 decoding are #include "streamfile.h"
/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1, etc decoding is
* done by external libraries. * done by external libraries.
* If someone wants to do a standalone build, they can do it by simply * 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 * removing these defines (and the references to the libraries in the Makefile) */
* Makefile) */
#define VGM_USE_VORBIS #define VGM_USE_VORBIS
/* can be disabled to decode with FFmpeg instead */ /* can be disabled to decode with FFmpeg instead */
@ -19,18 +20,22 @@ enum { PATH_LIMIT = 32768 };
#define VGM_USE_MPEG #define VGM_USE_MPEG
#endif #endif
/* disabled by default, defined for builds that support it */ /* disabled by default, defined on compile-time for builds that support it*/
//#define VGM_USE_G7221 //#define VGM_USE_G7221
//#define VGM_USE_G719 //#define VGM_USE_G719
//#define VGM_USE_MP4V2
//#define VGM_USE_FDKAAC
//#define VGM_USE_MAIATRAC3PLUS
//#define VGM_USE_FFMPEG
#include "streamfile.h"
#include "coding/g72x_state.h"
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
#include <vorbis/vorbisfile.h> #include <vorbis/vorbisfile.h>
#endif #endif
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
#include <mpg123.h> #include <mpg123.h>
#endif #endif
#ifdef VGM_USE_G7221 #ifdef VGM_USE_G7221
#include "g7221.h" #include "g7221.h"
#endif #endif
@ -51,79 +56,99 @@ enum { PATH_LIMIT = 32768 };
#include "maiatrac3plus.h" #include "maiatrac3plus.h"
#endif #endif
#include "clHCA.h"
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#endif #endif
#include "coding/g72x_state.h"
#include "coding/acm_decoder.h" #include "coding/acm_decoder.h"
#include "coding/nwa_decoder.h" #include "coding/nwa_decoder.h"
#include "clHCA.h"
/* The encoding type specifies the format the sound data itself takes */ /* The encoding type specifies the format the sound data itself takes */
typedef enum { typedef enum {
/* 16-bit PCM */ /* 16-bit PCM */
coding_PCM16BE, /* big endian 16-bit PCM */
coding_PCM16LE, /* little endian 16-bit PCM */ coding_PCM16LE, /* little endian 16-bit PCM */
coding_PCM16LE_int, /* little endian 16-bit PCM with sample-level coding_PCM16LE_int, /* little endian 16-bit PCM with sample-level interleave */
interleave handled by the decoder */ coding_PCM16LE_XOR_int, /* little endian 16-bit PCM with sample-level xor */
coding_PCM16BE, /* big endian 16-bit PCM */
/* 8-bit PCM */ /* 8-bit PCM */
coding_PCM8, /* 8-bit PCM */ coding_PCM8, /* 8-bit PCM */
coding_PCM8_int, /* 8-Bit PCM with sample-level interleave */
coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */ coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */
coding_PCM8_int, /* 8-Bit PCM with sample-level interleave handled coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave */
by the decoder */ coding_PCM8_SB_int, /* 8-bit PCM, sign bit (others are 2's complement) with sample-level interleave */
coding_PCM8_SB_int, /* 8-bit PCM, sign bit (others are 2's complement),
sample-level interleave */
coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0), sample-level
interleave */
/* 4-bit ADPCM */ /* 4-bit ADPCM */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_CRI_ADX, /* CRI ADX */ coding_CRI_ADX, /* CRI ADX */
coding_CRI_ADX_enc_8, /* encrypted CRI ADX, type 8 (God Hand) */ coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */
coding_CRI_ADX_enc_9, /* encrypted CRI ADX, type 9 (PSO2) */ coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */
coding_NGC_DSP, /* NGC ADPCM, called DSP */
coding_NGC_DTK, /* NGC hardware disc ADPCM, called DTK, TRK or ADP */
coding_G721, /* CCITT G.721 ADPCM */
coding_NGC_AFC, /* NGC ADPCM, called AFC */
coding_PSX, /* PSX & PS2 ADPCM */
coding_invert_PSX, /* PSX ADPCM with some weirdness */
coding_PSX_badflags, /* with garbage in the flags byte */
coding_HEVAG_ADPCM, /* PSVita games */
coding_VAG_ADPCM_cfg, /* VAG with configurable frame size: FF XI, SGXD type 5, Bizarre Creations */
coding_XA, /* PSX CD-XA */
coding_XBOX, /* XBOX IMA */
coding_INT_XBOX, /* XBOX 'real interleaved' IMA */
coding_EAXA, /* EA/XA ADPCM */
coding_EA_ADPCM, /* EA ADPCM */
coding_MAXIS_ADPCM, /* MAXIS ADPCM */
coding_NDS_PROCYON, /* NDS Procyon Studio ADPCM */
#ifdef VGM_USE_VORBIS coding_NGC_DSP, /* Nintendo DSP ADPCM */
coding_ogg_vorbis, /* vorbis */ coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */
#endif coding_NGC_AFC, /* Nintendo AFC ADPCM */
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression */
coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression, coding_G721, /* CCITT G.721 */
with smaple-level interleave handled by the
decoder */ coding_XA, /* CD-ROM XA */
coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression */ coding_PSX, /* Sony PS ADPCM (VAG) */
coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, coding_PSX_badflags, /* Sony PS ADPCM with garbage in the flag byte */
with sample-level interleave handled by the coding_PSX_bmdx, /* Sony PS ADPCM with BMDX encryption */
decoder */ coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (FF XI, SGXD type 5, Bizarre Creations) */
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */ coding_HEVAG, /* Sony PSVita ADPCM */
coding_INT_DVI_IMA, /* Interleaved DVI */
coding_EA_XA, /* Electronic Arts XA ADPCM */
coding_EA_ADPCM, /* Electronic Arts R1 ADPCM */
coding_MAXIS_ADPCM, /* Maxis ADPCM */
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
coding_XBOX, /* XBOX IMA ADPCM */
coding_INT_XBOX, /* XBOX IMA ADPCM (interleaved) */
coding_IMA, /* IMA ADPCM (low nibble first) */
coding_INT_IMA, /* IMA ADPCM (interleaved) */
coding_DVI_IMA, /* DVI IMA ADPCM (high nibble first), aka ADP4 */
coding_INT_DVI_IMA, /* DVI IMA ADPCM (Interleaved) */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_EACS_IMA, coding_EACS_IMA,
coding_IMA, /* bare IMA, low nibble first */
coding_INT_IMA, /* */
coding_MS_IMA, /* Microsoft IMA */ coding_MS_IMA, /* Microsoft IMA */
coding_RAD_IMA, /* "Radical ADPCM" IMA */ coding_RAD_IMA, /* "Radical ADPCM" IMA */
coding_RAD_IMA_mono, /* "Radical ADPCM" IMA, mono (for interleave) */ coding_RAD_IMA_mono, /* "Radical ADPCM" IMA, mono (for interleave) */
coding_APPLE_IMA4, /* Apple Quicktime IMA4 */ coding_APPLE_IMA4, /* Apple Quicktime IMA4 */
coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */ coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */
coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */ coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */
coding_WS, /* Westwood Studios' custom VBR ADPCM */ coding_WS, /* Westwood Studios VBR ADPCM */
coding_MSADPCM, /* Microsoft ADPCM */
coding_AICA, /* Yamaha AICA ADPCM */
coding_L5_555, /* Level-5 0x555 ADPCM */
coding_SASSC, /* Activision EXAKT SASSC DPCM */
coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/
coding_MTAF, /* Konami MTAF ADPCM (IMA-derived) */
/* others */
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression DPCM */
coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression with sample-level interleave */
coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression DPCM */
coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, with sample-level interleave */
coding_ACM, /* InterPlay ACM */
coding_NWA0, /* Visual Art's NWA (compressed at various levels) */
coding_NWA1,
coding_NWA2,
coding_NWA3,
coding_NWA4,
coding_NWA5,
coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */
#ifdef VGM_USE_VORBIS
coding_ogg_vorbis, /* Xiph Vorbis (MDCT-based) */
#endif
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
coding_fake_MPEG2_L2, /* MPEG-2 Layer 2 (AHX), with lying headers */ coding_fake_MPEG2_L2, /* MPEG-2 Layer 2 (AHX), with lying headers */
/* I don't even know offhand if all these combinations exist... */ /* I don't even know offhand if all these combinations exist... */
@ -137,43 +162,26 @@ typedef enum {
coding_MPEG25_L2, coding_MPEG25_L2,
coding_MPEG25_L3, coding_MPEG25_L3,
#endif #endif
#ifdef VGM_USE_G7221 #ifdef VGM_USE_G7221
coding_G7221, /* G.722.1 (Polycom Siren 7) */ coding_G7221, /* ITU G.722.1 (Polycom Siren 7) */
coding_G7221C, /* G.722.1 with Annex C extension (Polycom Siren 14) */ coding_G7221C, /* ITU G.722.1 annex C (Polycom Siren 14) */
#endif #endif
#ifdef VGM_USE_G719 #ifdef VGM_USE_G719
coding_G719, coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */
#endif
coding_ACM, /* InterPlay ACM */
/* compressed NWA at various levels */
coding_NWA0,
coding_NWA1,
coding_NWA2,
coding_NWA3,
coding_NWA4,
coding_NWA5,
coding_MSADPCM, /* Microsoft ADPCM */
coding_AICA, /* Yamaha AICA ADPCM */
coding_L5_555, /* Level-5 0x555 */
coding_SASSC, /* Activision EXAKT SASSC DPCM */
coding_PCM16LE_XOR_int, /* sample-level xor */
coding_LSF, /* lsf ADPCM */
coding_MTAF, /* Konami IMA-derived MTAF ADPCM */
coding_CRI_HCA, /* CRI High Compression Audio */
#ifdef VGM_USE_FFMPEG
coding_FFmpeg,
#endif #endif
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
coding_MP4_AAC, coding_MP4_AAC, /* AAC (MDCT-based) */
#endif #endif
#ifdef VGM_USE_MAIATRAC3PLUS #ifdef VGM_USE_MAIATRAC3PLUS
coding_AT3plus, coding_AT3plus, /* Sony ATRAC3plus (MDCT-based) */
#endif
#ifdef VGM_USE_FFMPEG
coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */
#endif #endif
} coding_t; } coding_t;
@ -181,15 +189,15 @@ typedef enum {
typedef enum { typedef enum {
/* generic */ /* generic */
layout_none, /* straight data */ layout_none, /* straight data */
/* interleave */ /* interleave */
layout_interleave, /* equal interleave throughout the stream */ layout_interleave, /* equal interleave throughout the stream */
layout_interleave_shortblock, /* interleave with a short last block */ layout_interleave_shortblock, /* interleave with a short last block */
layout_interleave_byte, /* full byte interleave */ layout_interleave_byte, /* full byte interleave */
/* headered blocks */ /* headered blocks */
layout_ast_blocked, /* .ast STRM with BLCK blocks*/ layout_ast_blocked,
layout_halpst_blocked, /* blocks with HALPST-format header */ layout_halpst_blocked,
layout_xa_blocked, layout_xa_blocked,
layout_ea_blocked, layout_ea_blocked,
layout_eacs_blocked, layout_eacs_blocked,
@ -210,12 +218,18 @@ typedef enum {
layout_ps2_adm_blocked, layout_ps2_adm_blocked,
layout_dsp_bdsp_blocked, layout_dsp_bdsp_blocked,
layout_mxch_blocked, layout_mxch_blocked,
layout_ivaud_blocked, /* GTA IV .ivaud blocks */
layout_tra_blocked, /* DefJam Rapstar .tra blocks */
layout_ps2_iab_blocked,
layout_ps2_strlr_blocked,
#if 0
layout_strm_blocked, /* */
#endif
/* otherwise odd */ /* otherwise odd */
layout_dtk_interleave, /* dtk interleaves channels by nibble */ layout_acm, /* libacm layout */
layout_mus_acm, /* mus has multi-files to deal with */
layout_aix, /* CRI AIX's wheels within wheels */
layout_aax, /* CRI AAX's wheels within databases */
layout_scd_int, /* deinterleave done by the SCDINTSTREAMFILE */
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
layout_ogg_vorbis, /* ogg vorbis file */ layout_ogg_vorbis, /* ogg vorbis file */
#endif #endif
@ -223,31 +237,22 @@ typedef enum {
layout_fake_mpeg, /* MPEG audio stream with bad frame headers (AHX) */ layout_fake_mpeg, /* MPEG audio stream with bad frame headers (AHX) */
layout_mpeg, /* proper MPEG audio stream */ layout_mpeg, /* proper MPEG audio stream */
#endif #endif
layout_acm, /* dummy, let libacm handle layout */
layout_mus_acm, /* mus has multi-files to deal with */
layout_aix, /* CRI AIX's wheels within wheels */
layout_aax, /* CRI AAX's wheels within databases */
layout_ivaud_blocked, /* GTA IV .ivaud blocks */
layout_tra_blocked, /* DefJam Rapstar .tra blocks */
layout_ps2_iab_blocked,
layout_ps2_strlr_blocked,
layout_scd_int, /* deinterleave done by the SCDINTSTREAMFILE */
} layout_t; } 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. */ /* 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 { typedef enum {
/* DSP-specific */ /* DSP-specific */
meta_DSP_STD, /* standard GC ADPCM (DSP) header */ meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */
meta_DSP_CSMP, /* Metroid Prime 3, Donkey Kong Country Returns */ meta_DSP_CSMP, /* Retro: Metroid Prime 3, Donkey Kong Country Returns */
meta_DSP_CSTR, /* Star Fox Assault "Cstr" */ meta_DSP_CSTR, /* Star Fox Assault "Cstr" */
meta_DSP_RS03, /* Metroid Prime 2 "RS03" */ meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */
meta_DSP_STM, /* Paper Mario 2 STM */ meta_DSP_STM, /* Paper Mario 2 STM */
meta_DSP_HALP, /* SSB:M "HALPST" */ meta_DSP_AGSC, /* Retro: Metroid Prime 2 title */
meta_DSP_AGSC, /* Metroid Prime 2 title */
meta_DSP_MPDSP, /* Monopoly Party single header stereo */ meta_DSP_MPDSP, /* Monopoly Party single header stereo */
meta_DSP_JETTERS, /* Bomberman Jetters .dsp */ meta_DSP_JETTERS, /* Bomberman Jetters .dsp */
meta_DSP_MSS, meta_DSP_MSS, /* ? */
meta_DSP_GCM, meta_DSP_GCM, /* ? */
meta_DSP_STR, /* Conan .str files */ meta_DSP_STR, /* Conan .str files */
meta_DSP_SADB, /* .sad */ meta_DSP_SADB, /* .sad */
meta_DSP_WSI, /* .wsi */ meta_DSP_WSI, /* .wsi */
@ -256,11 +261,11 @@ typedef enum {
meta_DSP_WII_MUS, /* .mus */ meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */ meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */ meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
/* Nintendo */ /* Nintendo */
meta_STRM, /* STRM */ meta_STRM, /* Nintendo STRM */
meta_RSTM, /* RSTM (similar to STRM) */ meta_RSTM, /* Nintendo RSTM (similar to STRM) */
meta_AFC, /* AFC */ meta_AFC, /* AFC */
meta_AST, /* AST */ meta_AST, /* AST */
meta_RWSD, /* single-stream RWSD */ meta_RWSD, /* single-stream RWSD */
@ -269,7 +274,7 @@ typedef enum {
meta_CWAV, /* contents of CWAR */ meta_CWAV, /* contents of CWAR */
meta_FWAV, /* contents of FWAR */ meta_FWAV, /* contents of FWAR */
meta_RSTM_SPM, /* RSTM with 44->22khz hack */ meta_RSTM_SPM, /* RSTM with 44->22khz hack */
meta_THP, meta_THP, /* THP movie files */
meta_RSTM_shrunken, /* Atlus' mutant shortened RSTM */ meta_RSTM_shrunken, /* Atlus' mutant shortened RSTM */
meta_NDS_SWAV, /* Asphalt Urban GT 1 & 2 */ meta_NDS_SWAV, /* Asphalt Urban GT 1 & 2 */
meta_NDS_RRDS, /* Ridge Racer DS */ meta_NDS_RRDS, /* Ridge Racer DS */
@ -277,18 +282,16 @@ typedef enum {
meta_STX, /* Pikmin .stx */ meta_STX, /* Pikmin .stx */
meta_WIIU_BTSND, /* Wii U Boot Sound */ meta_WIIU_BTSND, /* Wii U Boot Sound */
/* CRI ADX */ meta_ADX_03, /* CRI ADX "type 03" */
meta_ADX_03, /* ADX "type 03" */ meta_ADX_04, /* CRI ADX "type 04" */
meta_ADX_04, /* ADX "type 04" */ meta_ADX_05, /* CRI ADX "type 05" */
meta_ADX_05, /* ADX "type 05" */
meta_AIX, /* CRI AIX */ meta_AIX, /* CRI AIX */
meta_AAX, /* CRI AAX */ meta_AAX, /* CRI AAX */
meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */ meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */
/* etc */ meta_NGC_ADPDTK, /* NGC DTK/ADP (.adp/dkt DTK) [no header_id] */
meta_NGC_ADPDTK, /* NGC DTK/ADP, no header (.adp) */
meta_kRAW, /* almost headerless PCM */ meta_kRAW, /* almost headerless PCM */
meta_RSF, /* Retro Studios RSF, no header (.rsf) */ meta_RSF, /* Retro Studios RSF (Metroid Prime .rsf) [no header_id] */
meta_HALPST, /* HAL Labs HALPST */ meta_HALPST, /* HAL Labs HALPST */
meta_GCSW, /* GCSW (PCM) */ meta_GCSW, /* GCSW (PCM) */
meta_CFN, /* Namco CAF Audio File */ meta_CFN, /* Namco CAF Audio File */
@ -296,6 +299,7 @@ typedef enum {
meta_HIS, /* Her Ineractive .his */ meta_HIS, /* Her Ineractive .his */
meta_BNSF, /* Bandai Namco Sound Format */ meta_BNSF, /* Bandai Namco Sound Format */
meta_PSX_XA, /* CD-ROM XA with RIFF header */
meta_PS2_SShd, /* .ADS with SShd header */ meta_PS2_SShd, /* .ADS with SShd header */
meta_PS2_NPSF, /* Namco Production Sound File */ meta_PS2_NPSF, /* Namco Production Sound File */
meta_PS2_RXW, /* Sony Arc The Lad Sound File */ meta_PS2_RXW, /* Sony Arc The Lad Sound File */
@ -309,11 +313,10 @@ typedef enum {
meta_PS2_VAGp, /* VAGp Mono File */ meta_PS2_VAGp, /* VAGp Mono File */
meta_PS2_VAGm, /* VAGp Mono File */ meta_PS2_VAGm, /* VAGp Mono File */
meta_PS2_pGAV, /* VAGp with Little Endian Header */ meta_PS2_pGAV, /* VAGp with Little Endian Header */
meta_PSX_GMS, /* GMS File (used in PS1 & PS2) */ meta_PSX_GMS, /* GMS File (used in PS1 & PS2) [no header_id] */
meta_PS2_STR, /* Pacman STR+STH files */ meta_PS2_STR, /* Pacman STR+STH files */
meta_PS2_ILD, /* ILD File */ meta_PS2_ILD, /* ILD File */
meta_PS2_PNB, /* PsychoNauts Bgm 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_VAGs, /* VAG Stereo from Kingdom Hearts */
meta_PS2_VPK, /* VPK Audio File */ meta_PS2_VPK, /* VPK Audio File */
meta_PS2_BMDX, /* Beatmania thing */ meta_PS2_BMDX, /* Beatmania thing */
@ -323,8 +326,8 @@ typedef enum {
meta_XSS, /* Dino Crisis 3 */ meta_XSS, /* Dino Crisis 3 */
meta_SL3, /* Test Drive Unlimited */ meta_SL3, /* Test Drive Unlimited */
meta_HGC1, /* Knights of the Temple 2 */ meta_HGC1, /* Knights of the Temple 2 */
meta_AUS, /* Variuos Capcom Games */ meta_AUS, /* Various Capcom games */
meta_RWS, /* Variuos Konami Games */ meta_RWS, /* Various Konami games */
meta_FSB1, /* FMOD Sample Bank, version 1 */ meta_FSB1, /* FMOD Sample Bank, version 1 */
meta_FSB2, /* FMOD Sample Bank, version 2 */ meta_FSB2, /* FMOD Sample Bank, version 2 */
meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */ meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */
@ -339,7 +342,7 @@ typedef enum {
meta_MUSX_V006, /* Spyro Games, possibly more */ meta_MUSX_V006, /* Spyro Games, possibly more */
meta_MUSX_V010, /* Spyro Games, possibly more */ meta_MUSX_V010, /* Spyro Games, possibly more */
meta_MUSX_V201, /* Sphinx and the cursed Mummy */ meta_MUSX_V201, /* Sphinx and the cursed Mummy */
meta_LEG, /* Legaia 2 */ meta_LEG, /* Legaia 2 [no header_id] */
meta_FILP, /* Resident Evil - Dead Aim */ meta_FILP, /* Resident Evil - Dead Aim */
meta_IKM, /* Zwei! */ meta_IKM, /* Zwei! */
meta_SFS, /* Baroque */ meta_SFS, /* Baroque */
@ -348,8 +351,8 @@ typedef enum {
meta_PS2_KCES, /* Dance Dance Revolution */ meta_PS2_KCES, /* Dance Dance Revolution */
meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */ meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */
meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */ meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */
meta_PCM_SCD, /* Ephemeral Fantasia */ meta_PCM_SCD, /* Lunar - Eternal Blue */
meta_PCM_PS2, /* Lunar - Eternal Blue */ meta_PCM_PS2, /* Konami: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses */
meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 */ meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 */
meta_PS2_PSW, /* Rayman Raving Rabbids */ meta_PS2_PSW, /* Rayman Raving Rabbids */
meta_PS2_VAS, /* Pro Baseball Spirits 5 */ meta_PS2_VAS, /* Pro Baseball Spirits 5 */
@ -358,7 +361,7 @@ typedef enum {
meta_SDT, /* Baldur's Gate - Dark Alliance */ meta_SDT, /* Baldur's Gate - Dark Alliance */
meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */ meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */
meta_NGC_SWD, /* Conflict - Desert Storm 1 & 2 */ meta_NGC_SWD, /* Conflict - Desert Storm 1 & 2 */
meta_CAPDSP, /* Capcom DSP Header */ meta_CAPDSP, /* Capcom DSP Header [no header_id] */
meta_DC_STR, /* SEGA Stream Asset Builder */ meta_DC_STR, /* SEGA Stream Asset Builder */
meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */ meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */
meta_NGC_BH2PCM, /* Bio Hazard 2 */ meta_NGC_BH2PCM, /* Bio Hazard 2 */
@ -368,13 +371,12 @@ typedef enum {
meta_PS2_OMU, /* PS2 Int file with Header */ meta_PS2_OMU, /* PS2 Int file with Header */
meta_PS2_XA2, /* XG3 Extreme-G Racing */ meta_PS2_XA2, /* XG3 Extreme-G Racing */
meta_IDSP, /* Chronicles of Narnia, Soul Calibur Legends, Mario Strikers Charged */ meta_IDSP, /* Chronicles of Narnia, Soul Calibur Legends, Mario Strikers Charged */
meta_SPT_SPD, /* Variouis */ meta_SPT_SPD, /* Various (SPT+SPT DSP) */
meta_ISH_ISD, /* Various */ meta_ISH_ISD, /* Various (ISH+ISD DSP) */
meta_GSP_GSB, /* Various */ meta_GSP_GSB, /* Various (GSP+GSB DSP), Super Swing Golf 1 & 2 */
meta_YDSP, /* WWE Day of Reckoning */ meta_YDSP, /* WWE Day of Reckoning */
meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */ meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */
meta_WAA_WAC_WAD_WAM, /* Beyond Good & Evil */ meta_WAA_WAC_WAD_WAM, /* Beyond Good & Evil */
meta_GCA, /* Metal Slug Anthology */ meta_GCA, /* Metal Slug Anthology */
meta_MSVP, /* Popcap Hits */ meta_MSVP, /* Popcap Hits */
@ -409,7 +411,7 @@ typedef enum {
meta_PS2_ASS, /* ASS */ meta_PS2_ASS, /* ASS */
meta_PS2_SEG, /* Eragon */ meta_PS2_SEG, /* Eragon */
meta_XBOX_SEG, meta_XBOX_SEG, /* Eragon */
meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */ meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */
meta_STR_ASR, /* Donkey Kong Jet Race */ meta_STR_ASR, /* Donkey Kong Jet Race */
meta_ZWDSP, /* Zack and Wiki */ meta_ZWDSP, /* Zack and Wiki */
@ -432,7 +434,7 @@ typedef enum {
meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
meta_XBOX_WVS, /* XBOX WVS */ meta_XBOX_WVS, /* XBOX WVS */
meta_NGC_WVS, /* NGC WVS */ meta_NGC_WVS, /* Metal Arms - Glitch in the System */
meta_XBOX_STMA, /* XBOX STMA */ meta_XBOX_STMA, /* XBOX STMA */
meta_XBOX_MATX, /* XBOX MATX */ meta_XBOX_MATX, /* XBOX MATX */
meta_XBOX_XMU, /* XBOX XMU */ meta_XBOX_XMU, /* XBOX XMU */
@ -444,35 +446,22 @@ typedef enum {
meta_EACS_PC, /* EACS PC */ meta_EACS_PC, /* EACS PC */
meta_EACS_PSX, /* EACS PSX */ meta_EACS_PSX, /* EACS PSX */
meta_EACS_SAT, /* EACS SATURN */ meta_EACS_SAT, /* EACS SATURN */
meta_EA_ADPCM, /* EA XA ADPCM */ meta_EA_ADPCM, /* EA header using XA ADPCM */
meta_EA_IMA, /* EA IMA */ meta_EA_IMA, /* EA header using IMA */
meta_EA_PCM, /* EA PCM */ meta_EA_PCM, /* EA header using PCM */
meta_RAW, /* RAW PCM file */ meta_RAW, /* RAW PCM file */
meta_GENH, /* generic header */ meta_GENH, /* generic header */
#ifdef VGM_USE_VORBIS
meta_ogg_vorbis, /* ogg vorbis */
meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */
meta_OGG_SLI2, /* Ogg Vorbis file w/ different styled .sli for looping */
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
meta_um3_ogg, /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */
meta_KOVS_ogg, /* Ogg Vorbis with exta header and 0x100 bytes XOR */
meta_psych_ogg, /* Ogg Vorbis with all bytes -0x23*/
#endif
meta_AIFC, /* Audio Interchange File Format AIFF-C */ meta_AIFC, /* Audio Interchange File Format AIFF-C */
meta_AIFF, /* Audio Interchange File Format */ meta_AIFF, /* Audio Interchange File Format */
meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */ meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */
meta_WS_AUD, /* Westwood Studios .aud */ meta_WS_AUD, /* Westwood Studios .aud */
meta_WS_AUD_old, /* Westwood Studios .aud, old style */ meta_WS_AUD_old, /* Westwood Studios .aud, old style */
#ifdef VGM_USE_MPEG
meta_AHX, /* CRI AHX header (same structure as ADX) */
#endif
meta_RIFF_WAVE, /* RIFF, for WAVs */ meta_RIFF_WAVE, /* RIFF, for WAVs */
meta_RIFF_WAVE_POS, /* .wav + .pos for looping */ meta_RIFF_WAVE_POS, /* .wav + .pos for looping */
meta_RIFF_WAVE_labl_Marker, /* RIFF w/ loop Markers in LIST-adtl-labl */ meta_RIFF_WAVE_labl, /* RIFF w/ loop Markers in LIST-adtl-labl */
meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */ meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */
meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */ meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */
meta_RIFF_WAVE_SNS, /* .sns RIFF */ meta_RIFF_WAVE_SNS, /* .sns RIFF */
@ -482,8 +471,8 @@ typedef enum {
meta_PC_MXST, /* Lego Island MxSt */ meta_PC_MXST, /* Lego Island MxSt */
meta_PC_SOB_SAB, /* Worms 4 Mayhem SOB+SAB file */ meta_PC_SOB_SAB, /* Worms 4 Mayhem SOB+SAB file */
meta_NWA, /* Visual Art's NWA */ meta_NWA, /* Visual Art's NWA */
meta_NWA_NWAINFOINI, /* NWA w/ NWAINFO.INI for looping */ meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */
meta_NWA_GAMEEXEINI, /* NWA w/ Gameexe.ini for looping */ meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */
meta_DVI, /* DVI Interleaved */ meta_DVI, /* DVI Interleaved */
meta_KCEY, /* KCEYCOMP */ meta_KCEY, /* KCEYCOMP */
meta_ACM, /* InterPlay ACM header */ meta_ACM, /* InterPlay ACM header */
@ -547,14 +536,14 @@ typedef enum {
meta_PS2_LPCM, /* Ah! My Goddess */ meta_PS2_LPCM, /* Ah! My Goddess */
meta_DSP_BDSP, /* Ah! My Goddess */ meta_DSP_BDSP, /* Ah! My Goddess */
meta_PS2_VMS, /* Autobahn Raser - Police Madness */ meta_PS2_VMS, /* Autobahn Raser - Police Madness */
meta_PS2_XAU, // Spectral Force Chronicle meta_PS2_XAU, /* Spectral Force Chronicle */
meta_GH3_BAR, /* Guitar Hero III Mobile .bar */ meta_GH3_BAR, /* Guitar Hero III Mobile .bar */
meta_FFW, /* Freedom Fighters [NGC] */ meta_FFW, /* Freedom Fighters [NGC] */
meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */ meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */
meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */ meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
meta_SQEX_SCD, /* Square-Enix SCD */ meta_SQEX_SCD, /* Square-Enix SCD */
meta_NGC_NST_DSP, /* Animaniacs [NGC] */ meta_NGC_NST_DSP, /* Animaniacs [NGC] */
meta_BAF, /* .baf (Blur) */ meta_BAF, /* Bizarre Creations (Blur, James Bond) */
meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_PS3_CPS, /* Eternal Sonata (PS3) */ meta_PS3_CPS, /* Eternal Sonata (PS3) */
meta_PS3_MSF, /* MSF header */ meta_PS3_MSF, /* MSF header */
@ -565,11 +554,11 @@ typedef enum {
meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */ meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */
meta_PS2_SPM, /* Lethal Skies Elite Pilot: Team SW */ meta_PS2_SPM, /* Lethal Skies Elite Pilot: Team SW */
meta_X360_TRA, /* Def Jam Rapstar */ meta_X360_TRA, /* Def Jam Rapstar */
meta_PS2_VGS, // Princess Soft PS2 games meta_PS2_VGS, /* Princess Soft PS2 games */
meta_PS2_IAB, // Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */
meta_PS2_STRLR, meta_PS2_STRLR, /* The Bouncer */
meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */ meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */
meta_VAWX, /* No More Heroes: Heroes Paradise, Moon Diver */ meta_VAWX, /* feelplus: No More Heroes Heroes Paradise, Moon Diver */
meta_PC_SNDS, // Incredibles PC .snds meta_PC_SNDS, // Incredibles PC .snds
meta_PS2_WMUS, // The Warriors (PS2) meta_PS2_WMUS, // The Warriors (PS2)
meta_HYPERSCAN_KVAG, // Hyperscan KVAG/BVG meta_HYPERSCAN_KVAG, // Hyperscan KVAG/BVG
@ -584,11 +573,11 @@ typedef enum {
meta_TUN, // LEGO Racers (PC) meta_TUN, // LEGO Racers (PC)
meta_WPD, // Shuffle! (PC) meta_WPD, // Shuffle! (PC)
meta_MN_STR, // Mini Ninjas (PC/PS3/WII) meta_MN_STR, // Mini Ninjas (PC/PS3/WII)
meta_PS2_MSS, // ShellShock Nam '67 (PS2) meta_PS2_MSS, // Guerilla: ShellShock Nam '67, Killzone (PS2)
meta_PS2_HSF, // Lowrider (PS2) meta_PS2_HSF, // Lowrider (PS2)
meta_PS3_IVAG, // Interleaved VAG files (PS3) meta_PS3_IVAG, // Interleaved VAG files (PS3)
meta_PS2_2PFS, // Mahoromatic: Moetto - KiraKira Maid-San (PS2) meta_PS2_2PFS, // Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2)
meta_PS2_VBK, meta_PS2_VBK, // Disney's Stitch - Experiment 626
meta_OTM, // Otomedius (Arcade) meta_OTM, // Otomedius (Arcade)
meta_CSTM, // Nintendo 3DS CSTM meta_CSTM, // Nintendo 3DS CSTM
meta_FSTM, // Nintendo Wii U FSTM meta_FSTM, // Nintendo Wii U FSTM
@ -598,14 +587,29 @@ typedef enum {
meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX
meta_HCA, /* CRI HCA */ meta_HCA, /* CRI HCA */
meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */ meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */
#ifdef VGM_USE_VORBIS
meta_OGG_VORBIS, /* ogg vorbis */
meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */
meta_OGG_SLI2, /* Ogg Vorbis file w/ different styled .sli for looping */
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */
meta_OGG_UM3, /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */
meta_OGG_KOVS, /* Ogg Vorbis with exta header and 0x100 bytes XOR */
meta_OGG_PSYCH, /* Ogg Vorbis with all bytes -0x23*/
#endif
#ifdef VGM_USE_MPEG
meta_AHX, /* CRI AHX header (same structure as ADX) */
#endif
#ifdef VGM_USE_MP4V2
meta_MP4, /* AAC (iOS) */
#endif
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
meta_FFmpeg, meta_FFmpeg,
#endif #endif
#ifdef VGM_USE_MP4V2
meta_MP4,
#endif
} meta_t; } meta_t;
/* info for a single vgmstream channel */
typedef struct { typedef struct {
STREAMFILE * streamfile; /* file used by this channel */ STREAMFILE * streamfile; /* file used by this channel */
off_t channel_start_offset; /* where data for this channel begins */ off_t channel_start_offset; /* where data for this channel begins */
@ -642,8 +646,8 @@ typedef struct {
int adpcm_step_index; /* for IMA */ int adpcm_step_index; /* for IMA */
int adpcm_scale; /* for MS ADPCM */ int adpcm_scale; /* for MS ADPCM */
struct g72x_state g72x_state; /* state for G.721 decoder, sort of big but we /* state for G.721 decoder, sort of big but we might as well keep it around */
might as well keep it around */ struct g72x_state g72x_state;
#ifdef DEBUG #ifdef DEBUG
int samples_done; int samples_done;
@ -664,6 +668,7 @@ typedef struct {
uint16_t key_xor; uint16_t key_xor;
} VGMSTREAMCHANNEL; } VGMSTREAMCHANNEL;
/* main vgmstream info */
typedef struct { typedef struct {
/* basics */ /* basics */
int32_t num_samples; /* the actual number of samples in this stream */ int32_t num_samples; /* the actual number of samples in this stream */
@ -706,23 +711,23 @@ typedef struct {
size_t loop_block_size; /* saved from current_block_size */ size_t loop_block_size; /* saved from current_block_size */
off_t loop_next_block_offset; /* saved from next_block_offset */ off_t loop_next_block_offset; /* saved from next_block_offset */
uint8_t xa_channel; /* Selected XA Channel */ /* decoder specific */
int32_t xa_sector_length; /* XA block */ uint8_t xa_channel; /* XA ADPCM: selected channel */
uint8_t xa_headerless; /* headerless XA block */ int32_t xa_sector_length; /* XA ADPCM: XA block */
int8_t get_high_nibble; uint8_t xa_headerless; /* XA ADPCM: headerless XA block */
uint8_t ea_big_endian; /* Big Endian ? */ int8_t get_high_nibble; /* ADPCM: which nibble (XA, IMA, EA) */
uint8_t ea_big_endian; /* EA ADPCM stuff */
uint8_t ea_compression_type; uint8_t ea_compression_type;
uint8_t ea_compression_version; uint8_t ea_compression_version;
uint8_t ea_platform; uint8_t ea_platform;
int32_t ws_output_size; /* output bytes for this block */ int32_t ws_output_size; /* WS ADPCM: output bytes for this block */
void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream */ int32_t thpNextFrameSize; /* THP */
int32_t thpNextFrameSize; void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream (for AAX/AIX/SCD) */
int skip_last_channel; /* todo not used anymore */
/* Data the codec needs for the whole stream. This is for codecs too /* Data the codec needs for the whole stream. This is for codecs too
* different from vgmstream's structure to be reasonably shoehorned into * different from vgmstream's structure to be reasonably shoehorned into
@ -744,7 +749,6 @@ typedef struct {
void (*decryption_callback)(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read); void (*decryption_callback)(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read);
uint8_t scd_xor; uint8_t scd_xor;
off_t scd_xor_length; off_t scd_xor_length;
} ogg_vorbis_streamfile; } ogg_vorbis_streamfile;
typedef struct { typedef struct {
@ -759,6 +763,7 @@ typedef struct {
#define AHX_EXPECTED_FRAME_SIZE 0x414 #define AHX_EXPECTED_FRAME_SIZE 0x414
/* MPEG_BUFFER_SIZE should be >= AHX_EXPECTED_FRAME_SIZE */ /* MPEG_BUFFER_SIZE should be >= AHX_EXPECTED_FRAME_SIZE */
#define MPEG_BUFFER_SIZE 0x1000 #define MPEG_BUFFER_SIZE 0x1000
typedef struct { typedef struct {
uint8_t buffer[MPEG_BUFFER_SIZE]; uint8_t buffer[MPEG_BUFFER_SIZE];
int buffer_used; int buffer_used;
@ -791,8 +796,7 @@ typedef struct {
} maiatrac3plus_codec_data; } maiatrac3plus_codec_data;
#endif #endif
/* with one file this is also used for just /* with one file this is also used for just ACM */
ACM */
typedef struct { typedef struct {
int file_count; int file_count;
int current_file; int current_file;
@ -835,6 +839,7 @@ typedef struct {
NWAData *nwa; NWAData *nwa;
} nwa_codec_data; } nwa_codec_data;
/* SQEX SCD interleaved */
typedef struct { typedef struct {
int substream_count; int substream_count;
VGMSTREAM **substreams; VGMSTREAM **substreams;
@ -927,6 +932,11 @@ typedef struct {
#endif #endif
#endif #endif
/* -------------------------------------------------------------------------*/
/* vgmstream "public" API */
/* -------------------------------------------------------------------------*/
/* do format detection, return pointer to a usable VGMSTREAM, or NULL on failure */ /* do format detection, return pointer to a usable VGMSTREAM, or NULL on failure */
VGMSTREAM * init_vgmstream(const char * const filename); VGMSTREAM * init_vgmstream(const char * const filename);
@ -935,10 +945,7 @@ VGMSTREAM * init_vgmstream_from_STREAMFILE(STREAMFILE *streamFile);
/* reset a VGMSTREAM to start of stream */ /* reset a VGMSTREAM to start of stream */
void reset_vgmstream(VGMSTREAM * vgmstream); void reset_vgmstream(VGMSTREAM * vgmstream);
/* allocate a VGMSTREAM and channel stuff */ /* close an open vgmstream */
VGMSTREAM * allocate_vgmstream(int channel_count, int looped);
/* deallocate, close, etc. */
void close_vgmstream(VGMSTREAM * vgmstream); void close_vgmstream(VGMSTREAM * vgmstream);
/* calculate the number of samples to be played based on looping parameters */ /* calculate the number of samples to be played based on looping parameters */
@ -947,6 +954,21 @@ int32_t get_vgmstream_play_samples(double looptimes, double fadeseconds, double
/* render! */ /* render! */
void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);
/* 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 */
void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length);
/* Return the average bitrate in bps of all unique files contained within this
* stream. Compares files by absolute paths. */
int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream);
/* -------------------------------------------------------------------------*/
/* vgmstream "private" API */
/* -------------------------------------------------------------------------*/
/* allocate a VGMSTREAM and channel stuff */
VGMSTREAM * allocate_vgmstream(int channel_count, int looped);
/* smallest self-contained group of samples is a frame */ /* smallest self-contained group of samples is a frame */
int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream); int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream);
/* number of bytes per frame */ /* number of bytes per frame */
@ -970,19 +992,9 @@ int vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMST
* Returns 1 if loop was done. */ * Returns 1 if loop was done. */
int vgmstream_do_loop(VGMSTREAM * vgmstream); int vgmstream_do_loop(VGMSTREAM * vgmstream);
/* 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
*/
void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length);
/* See if there is a second file which may be the second channel, given /* See if there is a second file which may be the second channel, given
* already opened mono opened_stream which was opened from filename. * already opened mono opened_stream which was opened from filename.
* If a suitable file is found, open it and change opened_stream to a * If a suitable file is found, open it and change opened_stream to a stereo stream. */
* stereo stream. */
void try_dual_file_stereo(VGMSTREAM * opened_stream, STREAMFILE *streamFile); void try_dual_file_stereo(VGMSTREAM * opened_stream, STREAMFILE *streamFile);
/* Return the average bitrate in bps of all unique files contained within this
* stream. Compares files by absolute paths. */
int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream);
#endif #endif