From ea2782b6677b8d7d7ee78ecb40cf37ef63efb275 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 21:57:40 +0200 Subject: [PATCH 1/8] Fix some Ubi HX [XIII (GC)] --- src/meta/ubi_hx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/meta/ubi_hx.c b/src/meta/ubi_hx.c index e201e03d..1600c10a 100644 --- a/src/meta/ubi_hx.c +++ b/src/meta/ubi_hx.c @@ -239,6 +239,14 @@ static int parse_name(ubi_hx_header* hx, STREAMFILE* sf) { } } + /* XIII GC has one subsong 718260C4 B7C67534 with empty index entry + * (CGCWavResData with name does exist but its CGCWaveFileIdObj doesn't point to it) */ + if (!hx->is_external) { + strcpy(hx->internal_name,"?"); + return 1; + } + + VGM_LOG("UBI HX: name not found for CUUID %08x %08x\n", hx->cuuid1, hx->cuuid2); fail: vgm_logi("UBI HX: error parsing name at %x (report)\n", index_offset); return 0; From 2fb1185b830ba10fa76d08effb999525be7b40ce Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 21:58:26 +0200 Subject: [PATCH 2/8] Add Opus in .bwav --- src/meta/bwav.c | 53 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/src/meta/bwav.c b/src/meta/bwav.c index 612ba5bc..8cc39a36 100644 --- a/src/meta/bwav.c +++ b/src/meta/bwav.c @@ -1,5 +1,8 @@ #include "meta.h" #include "../coding/coding.h" +#include "../layout/layout.h" + +static layered_layout_data* build_layered_data(STREAMFILE* sf, int channels); /* BWAV - NintendoWare wavs [Super Mario Maker 2 (Switch)] */ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) { @@ -29,15 +32,13 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) { sample_rate = read_s32le(0x10 + 0x04, sf); /* 0x08: num_samples for full (non-prefetch) file, same as below if not prefetch */ num_samples = read_s32le(0x10 + 0x0c, sf); - /* 0x10: coefs */ + /* 0x10: coefs (empty for non-DSP codecs) */ /* 0x30: offset for full (non-prefetch) file? */ start_offset = read_u32le(0x10 + 0x34, sf); /* 0x38: flag? (always 1) */ loop_end = read_s32le(0x10 + 0x3C, sf); loop_start = read_s32le(0x10 + 0x40, sf); - /* 0x44: start predictor */ - /* 0x46: hist1 sample */ - /* 0x48: hist2 sample */ + /* 0x44: start predictor + hist1 + hist2 (empty for non-DSP codecs) */ /* 0x4a: null? */ loop_flag = (loop_end != -1); @@ -56,7 +57,6 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) { vgmstream->num_samples = num_samples; vgmstream->loop_start_sample = loop_start; vgmstream->loop_end_sample = loop_end; - vgmstream->allow_dual_stereo = 1; /* Animal Crossing: Happy Home Paradise */ switch(codec) { case 0x0000: /* Ring Fit Adventure (Switch) */ @@ -71,8 +71,17 @@ VGMSTREAM* init_vgmstream_bwav(STREAMFILE* sf) { vgmstream->interleave_block_size = interleave; dsp_read_coefs_le(vgmstream, sf, 0x10 + 0x10, 0x4C); dsp_read_hist_le(vgmstream, sf, 0x10 + 0x46, 0x4C); + + vgmstream->allow_dual_stereo = 1; /* Animal Crossing: Happy Home Paradise */ break; + case 0x0002: /* Zelda TOTK (Switch) */ + vgmstream->layout_data = build_layered_data(sf, channels); + if (!vgmstream->layout_data) goto fail; + vgmstream->coding_type = coding_FFmpeg; + vgmstream->layout_type = layout_layered; + + break; default: goto fail; } @@ -85,3 +94,37 @@ fail: close_vgmstream(vgmstream); return NULL; } + +static layered_layout_data* build_layered_data(STREAMFILE* sf, int channels) { + layered_layout_data* data = NULL; + STREAMFILE* temp_sf = NULL; + + data = init_layout_layered(channels); + if (!data) goto fail; + + for (int ch = 0; ch < channels; ch++) { + uint32_t subfile_offset = read_u32le(0x10 + 0x4c * ch + 0x34, sf); + uint32_t subfile_size = 0x28 + read_u32le(subfile_offset + 0x24, sf); /* NXOpus size, abridged (fails if non-common chunks are found, let's see) */ + + temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "opus"); + if (!temp_sf) goto fail; + + data->layers[ch] = init_vgmstream_opus_std(temp_sf); + if (!data->layers[ch]) goto fail; + + data->layers[ch]->stream_size = get_streamfile_size(temp_sf); + + close_streamfile(temp_sf); + temp_sf = NULL; + } + + if (!setup_layout_layered(data)) + goto fail; + + return data; + +fail: + free_layout_layered(data); + close_streamfile(temp_sf); + return NULL; +} From a6b8dcefc0bda83551a362bff1677410d1baab8b Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 22:00:04 +0200 Subject: [PATCH 3/8] Make src/base folder for future cleanup --- bootstrap | 4 ++-- src/CMakeLists.txt | 8 ++++++++ src/Makefile | 22 +++------------------- src/{ => base}/info.c | 7 ++++--- src/libvgmstream.vcxproj | 3 ++- src/libvgmstream.vcxproj.filters | 18 +++++++++++++++--- 6 files changed, 34 insertions(+), 28 deletions(-) rename src/{ => base}/info.c (96%) diff --git a/bootstrap b/bootstrap index 729404b4..c6a80137 100755 --- a/bootstrap +++ b/bootstrap @@ -4,8 +4,8 @@ # gets all files and updates .am scripts to avoid having to do manually (frowned upon by automake, whatevs) # maybe there is a better way or place for this -VGMSTREAM_SRCS=`(cd ./src/ && ls *.c coding/*.c layout/*.c meta/*.c util/*.c) | tr '\n' ' '` -VGMSTREAM_HDRS=`(cd ./src/ && ls *.h coding/*.h layout/*.h meta/*.h util/*.h) | tr '\n' ' '` +VGMSTREAM_SRCS=`(cd ./src/ && ls *.c */*.c) | tr '\n' ' '` +VGMSTREAM_HDRS=`(cd ./src/ && ls *.h */*.h) | tr '\n' ' '` AUDACIOUS_SRCS=`(cd ./audacious/ && ls *.cc) | tr '\n' ' '` AUDACIOUS_HDRS=`(cd ./audacious/ && ls *.h) | tr '\n' ' '` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf324909..675eb364 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,5 @@ +file(GLOB BASE_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/base/*.h") +file(GLOB BASE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/base/*.c") file(GLOB CODING_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/coding/*.h") file(GLOB CODING_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/coding/*.c") file(GLOB LAYOUT_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.h") @@ -12,17 +14,22 @@ file(GLOB MAIN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB MAIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c") # Setup source groups, mainly for Visual Studio +source_group("Header Files\\base" FILES ${BASE_HEADERS}) source_group("Header Files\\coding" FILES ${CODING_HEADERS}) source_group("Header Files\\layout" FILES ${LAYOUT_HEADERS}) source_group("Header Files\\meta" FILES ${META_HEADERS}) source_group("Header Files\\util" FILES ${UTIL_HEADERS}) source_group("Header Files\\ext" FILES ${EXT_HEADERS}) + +source_group("Source Files\\base" FILES ${BASE_SOURCES}) source_group("Source Files\\coding" FILES ${CODING_SOURCES}) source_group("Source Files\\layout" FILES ${LAYOUT_SOURCES}) source_group("Source Files\\meta" FILES ${META_SOURCES}) source_group("Source Files\\util" FILES ${UTIL_SOURCES}) set(libvgmstream_sources + ${BASE_HEADERS} + ${BASE_SOURCES} ${CODING_HEADERS} ${CODING_SOURCES} ${LAYOUT_HEADERS} @@ -38,6 +45,7 @@ set(libvgmstream_sources # Set up the proper include directories set(libvgmstream_includes ${VGM_SOURCE_DIR}/ext_includes + base coding layout meta diff --git a/src/Makefile b/src/Makefile index 4abd9526..06e299a1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,25 +5,9 @@ # automatically get all possible .o by finding all .c OBJECTS = -SRC_SRCS = $(wildcard *.c) -SRC_OBJS = $(patsubst %.c,%.o,$(SRC_SRCS)) -OBJECTS += $(SRC_OBJS) - -CODING_SRCS = $(wildcard coding/*.c) -CODING_OBJS = $(patsubst %.c,%.o,$(CODING_SRCS)) -OBJECTS += $(CODING_OBJS) - -LAYOUT_SRCS = $(wildcard layout/*.c) -LAYOUT_OBJS = $(patsubst %.c,%.o,$(LAYOUT_SRCS)) -OBJECTS += $(LAYOUT_OBJS) - -META_SRCS = $(wildcard meta/*.c) -META_OBJS = $(patsubst %.c,%.o,$(META_SRCS)) -OBJECTS += $(META_OBJS) - -UTIL_SRCS = $(wildcard util/*.c) -UTIL_OBJS = $(patsubst %.c,%.o,$(UTIL_SRCS)) -OBJECTS += $(UTIL_OBJS) +#SRCS = $(wildcard **/*.c) #GNUMake 3.81? +SRCS = $(wildcard *.c) $(wildcard */*.c) +OBJECTS = $(patsubst %.c,%.o,$(SRCS)) libvgmstream.a: $(OBJECTS) diff --git a/src/info.c b/src/base/info.c similarity index 96% rename from src/info.c rename to src/base/info.c index d9112170..5d7f5ede 100644 --- a/src/info.c +++ b/src/base/info.c @@ -1,7 +1,8 @@ #include -#include "vgmstream.h" -#include "coding/coding.h" -#include "mixing.h" +#include "../vgmstream.h" +#include "../coding/coding.h" +#include "../mixing.h" +#include "../util/channel_mappings.h" /*******************************************************************************/ diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index e175b302..8ba580ee 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -167,6 +167,7 @@ + @@ -179,7 +180,6 @@ - @@ -187,6 +187,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 9a06e2ec..4ca24904 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -9,6 +9,15 @@ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + {4437dc5f-0bf7-4a15-a70a-32258cafbe36} + + + {860f6a15-f877-4e8a-a0d6-fc4a0ccc985b} + + + {00c1e41e-bcac-4dec-896c-3a09c5125e54} + {07c49d19-cbf2-4e9f-b45d-d8a087f7926b} @@ -317,6 +326,9 @@ util\Header Files + + util\Header Files + util\Header Files @@ -349,9 +361,6 @@ Source Files - - Source Files - Source Files @@ -373,6 +382,9 @@ Source Files + + base\Source Files + coding\Source Files From e839f0635f2a46016af2e6dac4e1da1284da0830 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 22:00:30 +0200 Subject: [PATCH 4/8] cleanup: move channel mappings to .h --- src/coding/ffmpeg_decoder_utils.c | 1 + src/meta/hca.c | 1 + src/meta/ogg_vorbis.c | 1 + src/meta/riff.c | 1 + src/meta/wwise.c | 1 + src/mixing.c | 3 +- src/util/channel_mappings.h | 49 +++++++++++++++++++++++++++++++ src/vgmstream.h | 46 +---------------------------- 8 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 src/util/channel_mappings.h diff --git a/src/coding/ffmpeg_decoder_utils.c b/src/coding/ffmpeg_decoder_utils.c index 3765c6e7..da8699e0 100644 --- a/src/coding/ffmpeg_decoder_utils.c +++ b/src/coding/ffmpeg_decoder_utils.c @@ -1,4 +1,5 @@ #include "coding.h" +#include "../util/channel_mappings.h" #ifdef VGM_USE_FFMPEG diff --git a/src/meta/hca.c b/src/meta/hca.c index 86d912c9..92b5158c 100644 --- a/src/meta/hca.c +++ b/src/meta/hca.c @@ -2,6 +2,7 @@ #include "hca_keys.h" #include "../coding/coding.h" #include "../coding/hca_decoder_clhca.h" +#include "../util/channel_mappings.h" #ifdef VGM_DEBUG_OUTPUT //#define HCA_BRUTEFORCE diff --git a/src/meta/ogg_vorbis.c b/src/meta/ogg_vorbis.c index b008de65..4141b533 100644 --- a/src/meta/ogg_vorbis.c +++ b/src/meta/ogg_vorbis.c @@ -2,6 +2,7 @@ #include #include "meta.h" #include "../coding/coding.h" +#include "../util/channel_mappings.h" #include "ogg_vorbis_streamfile.h" diff --git a/src/meta/riff.c b/src/meta/riff.c index a46bf91f..8f7ffe81 100644 --- a/src/meta/riff.c +++ b/src/meta/riff.c @@ -3,6 +3,7 @@ #include "../coding/coding.h" #include "../layout/layout.h" #include "../util.h" +#include "../util/channel_mappings.h" #include "riff_ogg_streamfile.h" /* RIFF - Resource Interchange File Format, standard container used in many games */ diff --git a/src/meta/wwise.c b/src/meta/wwise.c index 852fcc0a..6c78aeec 100644 --- a/src/meta/wwise.c +++ b/src/meta/wwise.c @@ -3,6 +3,7 @@ #include "../coding/coding.h" #include "../util/chunks.h" #include "../util/endianness.h" +#include "../util/channel_mappings.h" /* Wwise uses a custom RIFF/RIFX header, non-standard enough that it's parsed it here. diff --git a/src/mixing.c b/src/mixing.c index 73717bff..896197f6 100644 --- a/src/mixing.c +++ b/src/mixing.c @@ -1,6 +1,7 @@ #include "vgmstream.h" #include "mixing.h" #include "plugins.h" +#include "util/channel_mappings.h" #include #include @@ -1187,7 +1188,7 @@ typedef enum { void mixing_macro_downmix(VGMSTREAM* vgmstream, int max /*, mapping_t output_mapping*/) { mixing_data *data = vgmstream->mixing_data; int ch, output_channels, mp_in, mp_out, ch_in, ch_out; - mapping_t input_mapping, output_mapping; + channel_mapping_t input_mapping, output_mapping; const double vol_max = 1.0; const double vol_sqrt = 1 / sqrt(2); const double vol_half = 1 / 2; diff --git a/src/util/channel_mappings.h b/src/util/channel_mappings.h new file mode 100644 index 00000000..72a0ab12 --- /dev/null +++ b/src/util/channel_mappings.h @@ -0,0 +1,49 @@ +#ifndef _CHANNEL_MAPPING_H +#define _CHANNEL_MAPPING_H + +/* standard WAVEFORMATEXTENSIBLE speaker positions */ +typedef enum { + speaker_FL = (1 << 0), /* front left */ + speaker_FR = (1 << 1), /* front right */ + speaker_FC = (1 << 2), /* front center */ + speaker_LFE = (1 << 3), /* low frequency effects */ + speaker_BL = (1 << 4), /* back left */ + speaker_BR = (1 << 5), /* back right */ + speaker_FLC = (1 << 6), /* front left center */ + speaker_FRC = (1 << 7), /* front right center */ + speaker_BC = (1 << 8), /* back center */ + speaker_SL = (1 << 9), /* side left */ + speaker_SR = (1 << 10), /* side right */ + + speaker_TC = (1 << 11), /* top center*/ + speaker_TFL = (1 << 12), /* top front left */ + speaker_TFC = (1 << 13), /* top front center */ + speaker_TFR = (1 << 14), /* top front right */ + speaker_TBL = (1 << 15), /* top back left */ + speaker_TBC = (1 << 16), /* top back center */ + speaker_TBR = (1 << 17), /* top back left */ + +} speaker_t; + +/* typical mappings that metas may use to set channel_layout (but plugin must actually use it) + * (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR) + * not too sure about names but no clear standards */ +typedef enum { + mapping_MONO = speaker_FC, + mapping_STEREO = speaker_FL | speaker_FR, + mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE, + mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */ + mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR, + mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC, + mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR, + mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR, + mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR, + mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR, + mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR, + mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR, + mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC, + mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC, + mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR, +} channel_mapping_t; + +#endif diff --git a/src/vgmstream.h b/src/vgmstream.h index 7effedfb..a56ff06c 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -762,50 +762,6 @@ typedef enum { } meta_t; -/* standard WAVEFORMATEXTENSIBLE speaker positions */ -typedef enum { - speaker_FL = (1 << 0), /* front left */ - speaker_FR = (1 << 1), /* front right */ - speaker_FC = (1 << 2), /* front center */ - speaker_LFE = (1 << 3), /* low frequency effects */ - speaker_BL = (1 << 4), /* back left */ - speaker_BR = (1 << 5), /* back right */ - speaker_FLC = (1 << 6), /* front left center */ - speaker_FRC = (1 << 7), /* front right center */ - speaker_BC = (1 << 8), /* back center */ - speaker_SL = (1 << 9), /* side left */ - speaker_SR = (1 << 10), /* side right */ - - speaker_TC = (1 << 11), /* top center*/ - speaker_TFL = (1 << 12), /* top front left */ - speaker_TFC = (1 << 13), /* top front center */ - speaker_TFR = (1 << 14), /* top front right */ - speaker_TBL = (1 << 15), /* top back left */ - speaker_TBC = (1 << 16), /* top back center */ - speaker_TBR = (1 << 17), /* top back left */ - -} speaker_t; - -/* typical mappings that metas may use to set channel_layout (but plugin must actually use it) - * (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR) - * not too sure about names but no clear standards */ -typedef enum { - mapping_MONO = speaker_FC, - mapping_STEREO = speaker_FL | speaker_FR, - mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE, - mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */ - mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR, - mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC, - mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR, - mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR, - mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR, - mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR, - mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR, - mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR, - mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC, - mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC, - mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR, -} mapping_t; typedef struct { int config_set; /* some of the mods below are set */ @@ -952,7 +908,7 @@ typedef struct { size_t stream_size; /* info to properly calculate bitrate in case of subsongs */ char stream_name[STREAM_NAME_SIZE]; /* name of the current stream (info), if the file stores it and it's filled */ - /* mapping config (info for plugins) */ + /* mapping config (info for plugins) see channel_mappings.h */ uint32_t channel_layout; /* order: FL FR FC LFE BL BR FLC FRC BC SL SR etc (WAVEFORMATEX flags where FL=lowest bit set) */ /* other config */ From f70b9cf7e6cd55bb1255ad14bc13dfccd0f1f8f9 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 22:12:26 +0200 Subject: [PATCH 5/8] cleanup: hide acm internals --- src/coding/acm_decoder.c | 23 +++++++++++++++++++++++ src/coding/coding.h | 3 +++ src/meta/acm.c | 10 +++------- src/vgmstream.h | 9 --------- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/coding/acm_decoder.c b/src/coding/acm_decoder.c index d87fe6fa..9aa4e6ba 100644 --- a/src/coding/acm_decoder.c +++ b/src/coding/acm_decoder.c @@ -4,6 +4,14 @@ /* libacm 1.2 (despite what libacm.h says) from: https://github.com/markokr/libacm */ + +/* libacm interface */ +struct acm_codec_data { + STREAMFILE* streamfile; + void* handle; + void* io_config; +}; + typedef struct { STREAMFILE* streamfile; /* reference */ int offset; @@ -145,3 +153,18 @@ static int acm_get_length_streamfile(void *arg) { return get_streamfile_size(config->streamfile); } + +void get_info_acm(acm_codec_data* data, int* p_channels, int* p_sample_rate, int* p_samples) { + if (!data || !data->handle) { + *p_channels = 0; + *p_sample_rate = 0; + *p_samples = 0; + return; + } + + ACMStream* handle = data->handle; + + *p_channels = handle->info.channels; + *p_sample_rate = handle->info.rate; + *p_samples = handle->total_values / handle->info.channels; +} diff --git a/src/coding/coding.h b/src/coding/coding.h index 430b0b57..9b4e9179 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -145,10 +145,13 @@ void decode_ws(VGMSTREAM* vgmstream, int channel, sample * outbuf, int channelsp /* acm_decoder */ +typedef struct acm_codec_data acm_codec_data; + acm_codec_data* init_acm(STREAMFILE* sf, int force_channel_number); void decode_acm(acm_codec_data* data, sample_t* outbuf, int32_t samples_to_do, int channelspacing); void reset_acm(acm_codec_data* data); void free_acm(acm_codec_data* data); +void get_info_acm(acm_codec_data* data, int* p_channels, int* p_sample_rate, int* p_samples); STREAMFILE* acm_get_streamfile(acm_codec_data* data); diff --git a/src/meta/acm.c b/src/meta/acm.c index e5887688..5c1d81f8 100644 --- a/src/meta/acm.c +++ b/src/meta/acm.c @@ -4,10 +4,10 @@ /* ACM - InterPlay infinity engine games [Planescape: Torment (PC), Baldur's Gate (PC)] */ VGMSTREAM* init_vgmstream_acm(STREAMFILE* sf) { - VGMSTREAM * vgmstream = NULL; + VGMSTREAM* vgmstream = NULL; int loop_flag = 0, channels, sample_rate, num_samples; int force_channel_number = 0; - acm_codec_data *data = NULL; + acm_codec_data* data = NULL; /* checks */ @@ -37,14 +37,10 @@ VGMSTREAM* init_vgmstream_acm(STREAMFILE* sf) { /* init decoder */ { - ACMStream *handle; data = init_acm(sf, force_channel_number); if (!data) goto fail; - handle = data->handle; - channels = handle->info.channels; - sample_rate = handle->info.rate; - num_samples = handle->total_values / handle->info.channels; + get_info_acm(data, &channels, &sample_rate, &num_samples); } diff --git a/src/vgmstream.h b/src/vgmstream.h index a56ff06c..357fbae1 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -991,15 +991,6 @@ typedef struct { } layered_layout_data; - -/* libacm interface */ -typedef struct { - STREAMFILE* streamfile; - void* handle; - void* io_config; -} acm_codec_data; - - #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) typedef struct { STREAMFILE* streamfile; From 4bc3f1365db6f8a3bbc6fa7606837e4b658bc734 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 22:34:35 +0200 Subject: [PATCH 6/8] cleanup: separate some util.h functions also avoid include useless functions when possible (faster compiles) --- cli/vgmstream123.c | 2 +- cli/vgmstream_cli.c | 1 + src/coding/coding.h | 1 + src/streamfile.c | 13 ++++ src/util.c | 99 ------------------------ src/util.h | 142 +--------------------------------- src/util/channel_mappings.h | 98 +++++++++++------------ src/util/reader_get.h | 100 ++++++++++++++++++++++++ src/util/reader_get_nibbles.h | 25 ++++++ src/util/reader_put.c | 29 +++++++ src/util/reader_put.h | 25 ++++++ src/util/samples_ops.c | 63 +++++++++++++++ src/util/samples_ops.h | 9 +++ 13 files changed, 320 insertions(+), 287 deletions(-) create mode 100644 src/util/reader_get.h create mode 100644 src/util/reader_get_nibbles.h create mode 100644 src/util/reader_put.c create mode 100644 src/util/reader_put.h create mode 100644 src/util/samples_ops.c create mode 100644 src/util/samples_ops.h diff --git a/cli/vgmstream123.c b/cli/vgmstream123.c index 10eafffe..8992419b 100644 --- a/cli/vgmstream123.c +++ b/cli/vgmstream123.c @@ -39,7 +39,7 @@ #include "../src/vgmstream.h" #include "../src/plugins.h" - +#include "../src/util/samples_ops.h" #include "../version.h" #ifndef VGMSTREAM_VERSION diff --git a/cli/vgmstream_cli.c b/cli/vgmstream_cli.c index 93040422..a76964a8 100644 --- a/cli/vgmstream_cli.c +++ b/cli/vgmstream_cli.c @@ -7,6 +7,7 @@ #include "../src/vgmstream.h" #include "../src/plugins.h" #include "../src/util.h" +#include "../src/util/samples_ops.h" //todo use <>? #ifdef HAVE_JSON #include "jansson/jansson.h" diff --git a/src/coding/coding.h b/src/coding/coding.h index 9b4e9179..f67d8a02 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -2,6 +2,7 @@ #define _CODING_H #include "../vgmstream.h" +#include "../util/reader_get_nibbles.h" //todo remove #include "hca_decoder_clhca.h" diff --git a/src/streamfile.c b/src/streamfile.c index 0e6cb01e..ec4d7df8 100644 --- a/src/streamfile.c +++ b/src/streamfile.c @@ -988,6 +988,19 @@ STREAMFILE* open_multifile_streamfile_f(STREAMFILE** sfs, size_t sfs_size) { /* **************************************************** */ +/* change pathname's extension to another (or add it if extensionless) */ +static void swap_extension(char* pathname, /*size_t*/ int pathname_len, const char* swap) { + char* extension = (char*)filename_extension(pathname); + //todo safeops + if (extension[0] == '\0') { + strcat(pathname, "."); + strcat(pathname, swap); + } + else { + strcpy(extension, swap); + } +} + STREAMFILE* open_streamfile(STREAMFILE* sf, const char* pathname) { return sf->open(sf, pathname, STREAMFILE_DEFAULT_BUFFER_SIZE); } diff --git a/src/util.c b/src/util.c index 858f6a4a..d35e239b 100644 --- a/src/util.c +++ b/src/util.c @@ -23,86 +23,6 @@ const char* filename_extension(const char* pathname) { return pathname + strlen(pathname); } -void swap_extension(char* pathname, int pathname_len, const char* swap) { - char* extension = (char*)filename_extension(pathname); - //todo safeops - if (extension[0] == '\0') { - strcat(pathname, "."); - strcat(pathname, swap); - } - else { - strcpy(extension, swap); - } -} - - -/* unused */ -/* -void interleave_channel(sample_t * outbuffer, sample_t * inbuffer, int32_t sample_count, int channel_count, int channel_number) { - int32_t insample,outsample; - - if (channel_count==1) { - memcpy(outbuffer,inbuffer,sizeof(sample)*sample_count); - return; - } - - for (insample=0,outsample=channel_number;insample> 8; -} - -void put_32bitLE(uint8_t * buf, int32_t i) { - buf[0] = (uint8_t)(i & 0xFF); - buf[1] = (uint8_t)((i >> 8) & 0xFF); - buf[2] = (uint8_t)((i >> 16) & 0xFF); - buf[3] = (uint8_t)((i >> 24) & 0xFF); -} - -void put_16bitBE(uint8_t * buf, int16_t i) { - buf[0] = i >> 8; - buf[1] = (i & 0xFF); -} - -void put_32bitBE(uint8_t * buf, int32_t i) { - buf[0] = (uint8_t)((i >> 24) & 0xFF); - buf[1] = (uint8_t)((i >> 16) & 0xFF); - buf[2] = (uint8_t)((i >> 8) & 0xFF); - buf[3] = (uint8_t)(i & 0xFF); -} int round10(int val) { int round_val = val % 10; @@ -112,25 +32,6 @@ int round10(int val) { return val + (10 - round_val); } -void swap_samples_le(sample_t *buf, int count) { - /* Windows can't be BE... I think */ -#if !defined(_WIN32) -#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ - int i; - for (i = 0; i < count; i++) { - /* 16b sample in memory: aabb where aa=MSB, bb=LSB */ - uint8_t b0 = buf[i] & 0xff; - uint8_t b1 = buf[i] >> 8; - uint8_t *p = (uint8_t*)&(buf[i]); - /* 16b sample in buffer: bbaa where bb=LSB, aa=MSB */ - p[0] = b0; - p[1] = b1; - /* when endianness is LE, buffer has bbaa already so this function can be skipped */ - } -#endif -#endif -} - /* length is maximum length of dst. dst will always be null-terminated if * length > 0 */ void concatn(int length, char * dst, const char * src) { diff --git a/src/util.h b/src/util.h index 8f8c2dd0..9a83e9c6 100644 --- a/src/util.h +++ b/src/util.h @@ -1,143 +1,15 @@ /* * util.h - utility functions */ - -#include "streamtypes.h" - #ifndef _UTIL_H #define _UTIL_H +#include "streamtypes.h" +#include "util/reader_get.h" +#include "util/reader_put.h" + /* very common functions, so static (inline) in .h as compiler can optimize to avoid some call overhead */ -/* host endian independent multi-byte integer reading */ - -static inline int16_t get_16bitBE(const uint8_t* p) { - return ((uint16_t)p[0]<<8) | ((uint16_t)p[1]); -} - -static inline int16_t get_16bitLE(const uint8_t* p) { - return ((uint16_t)p[0]) | ((uint16_t)p[1]<<8); -} - -static inline int32_t get_32bitBE(const uint8_t* p) { - return ((uint32_t)p[0]<<24) | ((uint32_t)p[1]<<16) | ((uint32_t)p[2]<<8) | ((uint32_t)p[3]); -} - -static inline int32_t get_32bitLE(const uint8_t* p) { - return ((uint32_t)p[0]) | ((uint32_t)p[1]<<8) | ((uint32_t)p[2]<<16) | ((uint32_t)p[3]<<24); -} - -static inline int64_t get_64bitBE(const uint8_t* p) { - return (uint64_t)(((uint64_t)p[0]<<56) | ((uint64_t)p[1]<<48) | ((uint64_t)p[2]<<40) | ((uint64_t)p[3]<<32) | ((uint64_t)p[4]<<24) | ((uint64_t)p[5]<<16) | ((uint64_t)p[6]<<8) | ((uint64_t)p[7])); -} - -static inline int64_t get_64bitLE(const uint8_t* p) { - return (uint64_t)(((uint64_t)p[0]) | ((uint64_t)p[1]<<8) | ((uint64_t)p[2]<<16) | ((uint64_t)p[3]<<24) | ((uint64_t)p[4]<<32) | ((uint64_t)p[5]<<40) | ((uint64_t)p[6]<<48) | ((uint64_t)p[7]<<56)); -} - -/* alias of the above */ -static inline int8_t get_s8 (const uint8_t* p) { return ( int8_t)p[0]; } -static inline uint8_t get_u8 (const uint8_t* p) { return (uint8_t)p[0]; } -static inline int16_t get_s16le(const uint8_t* p) { return ( int16_t)get_16bitLE(p); } -static inline uint16_t get_u16le(const uint8_t* p) { return (uint16_t)get_16bitLE(p); } -static inline int16_t get_s16be(const uint8_t* p) { return ( int16_t)get_16bitBE(p); } -static inline uint16_t get_u16be(const uint8_t* p) { return (uint16_t)get_16bitBE(p); } -static inline int32_t get_s32le(const uint8_t* p) { return ( int32_t)get_32bitLE(p); } -static inline uint32_t get_u32le(const uint8_t* p) { return (uint32_t)get_32bitLE(p); } -static inline int32_t get_s32be(const uint8_t* p) { return ( int32_t)get_32bitBE(p); } -static inline uint32_t get_u32be(const uint8_t* p) { return (uint32_t)get_32bitBE(p); } -static inline int64_t get_s64le(const uint8_t* p) { return ( int64_t)get_64bitLE(p); } -static inline uint64_t get_u64le(const uint8_t* p) { return (uint64_t)get_64bitLE(p); } -static inline int64_t get_s64be(const uint8_t* p) { return ( int64_t)get_64bitBE(p); } -static inline uint64_t get_u64be(const uint8_t* p) { return (uint64_t)get_64bitBE(p); } - -/* The recommended int-to-float type punning in C is through union, but pointer casting - * works too (though less portable due to aliasing rules?). For C++ memcpy seems - * recommended. Both work in GCC and VS2015+ (not sure about older, ifdef as needed). */ -static inline float get_f32be(const uint8_t* p) { - union { - uint32_t u32; - float f32; - } temp; - temp.u32 = get_u32be(p); - return temp.f32; -} -static inline float get_f32le(const uint8_t* p) { - union { - uint32_t u32; - float f32; - } temp; - temp.u32 = get_u32le(p); - return temp.f32; -} -static inline double get_d64be(const uint8_t* p) { - union { - uint64_t u64; - double d64; - } temp; - temp.u64 = get_u64be(p); - return temp.d64; -} -static inline double get_d64le(const uint8_t* p) { - union { - uint64_t u64; - double d64; - } temp; - temp.u64 = get_u64le(p); - return temp.d64; -} -#if 0 -static inline float get_f32be_cast(const uint8_t* p) { - uint32_t sample_int = get_u32be(p); - float* sample_float = (float*)&sample_int; - return *sample_float; -} -static inline float get_f32be_mcpy(const uint8_t* p) { - uint32_t sample_int = get_u32be(p); - float sample_float; - memcpy(&sample_float, &sample_int, sizeof(uint32_t)); - return sample_float; -} -#endif - - -void put_8bit(uint8_t* buf, int8_t i); -void put_16bitLE(uint8_t* buf, int16_t i); -void put_32bitLE(uint8_t* buf, int32_t i); -void put_16bitBE(uint8_t* buf, int16_t i); -void put_32bitBE(uint8_t* buf, int32_t i); - -/* alias of the above */ //TODO: improve -#define put_u8 put_8bit -#define put_u16le put_16bitLE -#define put_u32le put_32bitLE -#define put_u16be put_16bitBE -#define put_u32be put_32bitBE -#define put_s8 put_8bit -#define put_s16le put_16bitLE -#define put_s32le put_32bitLE -#define put_s16be put_16bitBE -#define put_s32be put_32bitBE - - -/* signed nibbles come up a lot */ -static int nibble_to_int[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1}; - -static inline int get_nibble_signed(uint8_t n, int upper) { - /*return ((n&0x70)-(n&0x80))>>4;*/ - return nibble_to_int[(n >> (upper?4:0)) & 0x0f]; -} - -static inline int get_high_nibble_signed(uint8_t n) { - /*return ((n&0x70)-(n&0x80))>>4;*/ - return nibble_to_int[n>>4]; -} - -static inline int get_low_nibble_signed(uint8_t n) { - /*return (n&7)-(n&8);*/ - return nibble_to_int[n&0xf]; -} - static inline int clamp16(int32_t val) { if (val > 32767) return 32767; else if (val < -32768) return -32768; @@ -177,12 +49,6 @@ int round10(int val); * extension in the original filename or the ending null byte if no extension */ const char* filename_extension(const char* pathname); -/* change pathname's extension to another (or add it if extensionless) */ -void swap_extension(char* pathname, /*size_t*/ int pathname_len, const char* swap); - -/* swap samples in machine endianness to little endian (useful to write .wav) */ -void swap_samples_le(sample_t *buf, int count); - void concatn(int length, char * dst, const char * src); #endif diff --git a/src/util/channel_mappings.h b/src/util/channel_mappings.h index 72a0ab12..02a4e501 100644 --- a/src/util/channel_mappings.h +++ b/src/util/channel_mappings.h @@ -1,49 +1,49 @@ -#ifndef _CHANNEL_MAPPING_H -#define _CHANNEL_MAPPING_H - -/* standard WAVEFORMATEXTENSIBLE speaker positions */ -typedef enum { - speaker_FL = (1 << 0), /* front left */ - speaker_FR = (1 << 1), /* front right */ - speaker_FC = (1 << 2), /* front center */ - speaker_LFE = (1 << 3), /* low frequency effects */ - speaker_BL = (1 << 4), /* back left */ - speaker_BR = (1 << 5), /* back right */ - speaker_FLC = (1 << 6), /* front left center */ - speaker_FRC = (1 << 7), /* front right center */ - speaker_BC = (1 << 8), /* back center */ - speaker_SL = (1 << 9), /* side left */ - speaker_SR = (1 << 10), /* side right */ - - speaker_TC = (1 << 11), /* top center*/ - speaker_TFL = (1 << 12), /* top front left */ - speaker_TFC = (1 << 13), /* top front center */ - speaker_TFR = (1 << 14), /* top front right */ - speaker_TBL = (1 << 15), /* top back left */ - speaker_TBC = (1 << 16), /* top back center */ - speaker_TBR = (1 << 17), /* top back left */ - -} speaker_t; - -/* typical mappings that metas may use to set channel_layout (but plugin must actually use it) - * (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR) - * not too sure about names but no clear standards */ -typedef enum { - mapping_MONO = speaker_FC, - mapping_STEREO = speaker_FL | speaker_FR, - mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE, - mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */ - mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR, - mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC, - mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR, - mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR, - mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR, - mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR, - mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR, - mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR, - mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC, - mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC, - mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR, -} channel_mapping_t; - -#endif +#ifndef _CHANNEL_MAPPING_H +#define _CHANNEL_MAPPING_H + +/* standard WAVEFORMATEXTENSIBLE speaker positions */ +typedef enum { + speaker_FL = (1 << 0), /* front left */ + speaker_FR = (1 << 1), /* front right */ + speaker_FC = (1 << 2), /* front center */ + speaker_LFE = (1 << 3), /* low frequency effects */ + speaker_BL = (1 << 4), /* back left */ + speaker_BR = (1 << 5), /* back right */ + speaker_FLC = (1 << 6), /* front left center */ + speaker_FRC = (1 << 7), /* front right center */ + speaker_BC = (1 << 8), /* back center */ + speaker_SL = (1 << 9), /* side left */ + speaker_SR = (1 << 10), /* side right */ + + speaker_TC = (1 << 11), /* top center*/ + speaker_TFL = (1 << 12), /* top front left */ + speaker_TFC = (1 << 13), /* top front center */ + speaker_TFR = (1 << 14), /* top front right */ + speaker_TBL = (1 << 15), /* top back left */ + speaker_TBC = (1 << 16), /* top back center */ + speaker_TBR = (1 << 17), /* top back left */ + +} speaker_t; + +/* typical mappings that metas may use to set channel_layout (but plugin must actually use it) + * (in order, so 3ch file could be mapped to FL FR FC or FL FR LFE but not LFE FL FR) + * not too sure about names but no clear standards */ +typedef enum { + mapping_MONO = speaker_FC, + mapping_STEREO = speaker_FL | speaker_FR, + mapping_2POINT1 = speaker_FL | speaker_FR | speaker_LFE, + mapping_2POINT1_xiph = speaker_FL | speaker_FR | speaker_FC, /* aka 3STEREO? */ + mapping_QUAD = speaker_FL | speaker_FR | speaker_BL | speaker_BR, + mapping_QUAD_surround = speaker_FL | speaker_FR | speaker_FC | speaker_BC, + mapping_QUAD_side = speaker_FL | speaker_FR | speaker_SL | speaker_SR, + mapping_5POINT0 = speaker_FL | speaker_FR | speaker_LFE | speaker_BL | speaker_BR, + mapping_5POINT0_xiph = speaker_FL | speaker_FR | speaker_FC | speaker_BL | speaker_BR, + mapping_5POINT0_surround = speaker_FL | speaker_FR | speaker_FC | speaker_SL | speaker_SR, + mapping_5POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR, + mapping_5POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_SL | speaker_SR, + mapping_7POINT0 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BC | speaker_FLC | speaker_FRC, + mapping_7POINT1 = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_FLC | speaker_FRC, + mapping_7POINT1_surround = speaker_FL | speaker_FR | speaker_FC | speaker_LFE | speaker_BL | speaker_BR | speaker_SL | speaker_SR, +} channel_mapping_t; + +#endif diff --git a/src/util/reader_get.h b/src/util/reader_get.h new file mode 100644 index 00000000..53eb5ddd --- /dev/null +++ b/src/util/reader_get.h @@ -0,0 +1,100 @@ +#ifndef _READER_GET_H +#define _READER_GET_H + +#include "../streamtypes.h" + +/* very common functions, so static (inline) in .h as compiler can optimize to avoid some call overhead */ + +/* host endian independent multi-byte integer reading */ + +static inline int16_t get_16bitBE(const uint8_t* p) { + return ((uint16_t)p[0]<<8) | ((uint16_t)p[1]); +} + +static inline int16_t get_16bitLE(const uint8_t* p) { + return ((uint16_t)p[0]) | ((uint16_t)p[1]<<8); +} + +static inline int32_t get_32bitBE(const uint8_t* p) { + return ((uint32_t)p[0]<<24) | ((uint32_t)p[1]<<16) | ((uint32_t)p[2]<<8) | ((uint32_t)p[3]); +} + +static inline int32_t get_32bitLE(const uint8_t* p) { + return ((uint32_t)p[0]) | ((uint32_t)p[1]<<8) | ((uint32_t)p[2]<<16) | ((uint32_t)p[3]<<24); +} + +static inline int64_t get_64bitBE(const uint8_t* p) { + return (uint64_t)(((uint64_t)p[0]<<56) | ((uint64_t)p[1]<<48) | ((uint64_t)p[2]<<40) | ((uint64_t)p[3]<<32) | ((uint64_t)p[4]<<24) | ((uint64_t)p[5]<<16) | ((uint64_t)p[6]<<8) | ((uint64_t)p[7])); +} + +static inline int64_t get_64bitLE(const uint8_t* p) { + return (uint64_t)(((uint64_t)p[0]) | ((uint64_t)p[1]<<8) | ((uint64_t)p[2]<<16) | ((uint64_t)p[3]<<24) | ((uint64_t)p[4]<<32) | ((uint64_t)p[5]<<40) | ((uint64_t)p[6]<<48) | ((uint64_t)p[7]<<56)); +} + +/* alias of the above */ +static inline int8_t get_s8 (const uint8_t* p) { return ( int8_t)p[0]; } +static inline uint8_t get_u8 (const uint8_t* p) { return (uint8_t)p[0]; } +static inline int16_t get_s16le(const uint8_t* p) { return ( int16_t)get_16bitLE(p); } +static inline uint16_t get_u16le(const uint8_t* p) { return (uint16_t)get_16bitLE(p); } +static inline int16_t get_s16be(const uint8_t* p) { return ( int16_t)get_16bitBE(p); } +static inline uint16_t get_u16be(const uint8_t* p) { return (uint16_t)get_16bitBE(p); } +static inline int32_t get_s32le(const uint8_t* p) { return ( int32_t)get_32bitLE(p); } +static inline uint32_t get_u32le(const uint8_t* p) { return (uint32_t)get_32bitLE(p); } +static inline int32_t get_s32be(const uint8_t* p) { return ( int32_t)get_32bitBE(p); } +static inline uint32_t get_u32be(const uint8_t* p) { return (uint32_t)get_32bitBE(p); } +static inline int64_t get_s64le(const uint8_t* p) { return ( int64_t)get_64bitLE(p); } +static inline uint64_t get_u64le(const uint8_t* p) { return (uint64_t)get_64bitLE(p); } +static inline int64_t get_s64be(const uint8_t* p) { return ( int64_t)get_64bitBE(p); } +static inline uint64_t get_u64be(const uint8_t* p) { return (uint64_t)get_64bitBE(p); } + +/* The recommended int-to-float type punning in C is through union, but pointer casting + * works too (though less portable due to aliasing rules?). For C++ memcpy seems + * recommended. Both work in GCC and VS2015+ (not sure about older, ifdef as needed). */ +static inline float get_f32be(const uint8_t* p) { + union { + uint32_t u32; + float f32; + } temp; + temp.u32 = get_u32be(p); + return temp.f32; +} +static inline float get_f32le(const uint8_t* p) { + union { + uint32_t u32; + float f32; + } temp; + temp.u32 = get_u32le(p); + return temp.f32; +} +static inline double get_d64be(const uint8_t* p) { + union { + uint64_t u64; + double d64; + } temp; + temp.u64 = get_u64be(p); + return temp.d64; +} +static inline double get_d64le(const uint8_t* p) { + union { + uint64_t u64; + double d64; + } temp; + temp.u64 = get_u64le(p); + return temp.d64; +} +#if 0 +static inline float get_f32be_cast(const uint8_t* p) { + uint32_t sample_int = get_u32be(p); + float* sample_float = (float*)&sample_int; + return *sample_float; +} +static inline float get_f32be_mcpy(const uint8_t* p) { + uint32_t sample_int = get_u32be(p); + float sample_float; + memcpy(&sample_float, &sample_int, sizeof(uint32_t)); + return sample_float; +} +#endif + + +#endif diff --git a/src/util/reader_get_nibbles.h b/src/util/reader_get_nibbles.h new file mode 100644 index 00000000..f9b4e9a3 --- /dev/null +++ b/src/util/reader_get_nibbles.h @@ -0,0 +1,25 @@ +#ifndef _READER_GET_NIBBLES_H +#define _READER_GET_NIBBLES_H + +#include "../streamtypes.h" + +/* signed nibbles come up a lot in decoders */ + +static int nibble_to_int[16] = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1}; + +static inline int get_nibble_signed(uint8_t n, int upper) { + /*return ((n&0x70)-(n&0x80))>>4;*/ + return nibble_to_int[(n >> (upper?4:0)) & 0x0f]; +} + +static inline int get_high_nibble_signed(uint8_t n) { + /*return ((n&0x70)-(n&0x80))>>4;*/ + return nibble_to_int[n>>4]; +} + +static inline int get_low_nibble_signed(uint8_t n) { + /*return (n&7)-(n&8);*/ + return nibble_to_int[n&0xf]; +} + +#endif diff --git a/src/util/reader_put.c b/src/util/reader_put.c new file mode 100644 index 00000000..ed04f154 --- /dev/null +++ b/src/util/reader_put.c @@ -0,0 +1,29 @@ +#include "reader_put.h" + +void put_8bit(uint8_t * buf, int8_t i) { + buf[0] = i; +} + +void put_16bitLE(uint8_t * buf, int16_t i) { + buf[0] = (i & 0xFF); + buf[1] = i >> 8; +} + +void put_32bitLE(uint8_t * buf, int32_t i) { + buf[0] = (uint8_t)(i & 0xFF); + buf[1] = (uint8_t)((i >> 8) & 0xFF); + buf[2] = (uint8_t)((i >> 16) & 0xFF); + buf[3] = (uint8_t)((i >> 24) & 0xFF); +} + +void put_16bitBE(uint8_t * buf, int16_t i) { + buf[0] = i >> 8; + buf[1] = (i & 0xFF); +} + +void put_32bitBE(uint8_t * buf, int32_t i) { + buf[0] = (uint8_t)((i >> 24) & 0xFF); + buf[1] = (uint8_t)((i >> 16) & 0xFF); + buf[2] = (uint8_t)((i >> 8) & 0xFF); + buf[3] = (uint8_t)(i & 0xFF); +} diff --git a/src/util/reader_put.h b/src/util/reader_put.h new file mode 100644 index 00000000..96624e5e --- /dev/null +++ b/src/util/reader_put.h @@ -0,0 +1,25 @@ +#ifndef _READER_PUT_H +#define _READER_PUT_H + +#include "../streamtypes.h" + + +void put_8bit(uint8_t* buf, int8_t i); +void put_16bitLE(uint8_t* buf, int16_t i); +void put_32bitLE(uint8_t* buf, int32_t i); +void put_16bitBE(uint8_t* buf, int16_t i); +void put_32bitBE(uint8_t* buf, int32_t i); + +/* alias of the above */ //TODO: improve +#define put_u8 put_8bit +#define put_u16le put_16bitLE +#define put_u32le put_32bitLE +#define put_u16be put_16bitBE +#define put_u32be put_32bitBE +#define put_s8 put_8bit +#define put_s16le put_16bitLE +#define put_s32le put_32bitLE +#define put_s16be put_16bitBE +#define put_s32be put_32bitBE + +#endif diff --git a/src/util/samples_ops.c b/src/util/samples_ops.c new file mode 100644 index 00000000..b4e09cad --- /dev/null +++ b/src/util/samples_ops.c @@ -0,0 +1,63 @@ +#include "samples_ops.h" + + +void swap_samples_le(sample_t *buf, int count) { + /* Windows can't be BE... I think */ +#if !defined(_WIN32) +#if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ + int i; + for (i = 0; i < count; i++) { + /* 16b sample in memory: aabb where aa=MSB, bb=LSB */ + uint8_t b0 = buf[i] & 0xff; + uint8_t b1 = buf[i] >> 8; + uint8_t *p = (uint8_t*)&(buf[i]); + /* 16b sample in buffer: bbaa where bb=LSB, aa=MSB */ + p[0] = b0; + p[1] = b1; + /* when endianness is LE, buffer has bbaa already so this function can be skipped */ + } +#endif +#endif +} + + +/* unused */ +/* +void interleave_channel(sample_t * outbuffer, sample_t * inbuffer, int32_t sample_count, int channel_count, int channel_number) { + int32_t insample,outsample; + + if (channel_count==1) { + memcpy(outbuffer,inbuffer,sizeof(sample)*sample_count); + return; + } + + for (insample=0,outsample=channel_number;insample Date: Sun, 7 May 2023 23:06:13 +0200 Subject: [PATCH 7/8] cleanup: separate coding/layout/meta types to .h --- src/libvgmstream.vcxproj | 7 + src/libvgmstream.vcxproj.filters | 21 + src/vgmstream.h | 745 +------------------------------ src/vgmstream_types.h | 718 +++++++++++++++++++++++++++++ 4 files changed, 761 insertions(+), 730 deletions(-) create mode 100644 src/vgmstream_types.h diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 8ba580ee..62eb143c 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -88,6 +88,7 @@ + @@ -175,6 +176,10 @@ + + + + @@ -735,6 +740,8 @@ + + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 4ca24904..9dea499e 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -89,6 +89,9 @@ Header Files + + Header Files + coding\Header Files @@ -350,6 +353,18 @@ util\Header Files + + util\Header Files + + + util\Header Files + + + util\Header Files + + + util\Header Files + util\Header Files @@ -2026,6 +2041,12 @@ util\Source Files + + util\Source Files + + + util\Source Files + util\Source Files diff --git a/src/vgmstream.h b/src/vgmstream.h index 357fbae1..9038f404 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -1,10 +1,23 @@ /* * vgmstream.h - definitions for VGMSTREAM, encapsulating a multi-channel, looped audio stream */ - #ifndef _VGMSTREAM_H #define _VGMSTREAM_H +/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1, etc decoding is done by external libraries. + * Libs are disabled by default, defined on compile-time for builds that support it */ +//#define VGM_USE_VORBIS +//#define VGM_USE_MPEG +//#define VGM_USE_G7221 +//#define VGM_USE_G719 +//#define VGM_USE_MP4V2 +//#define VGM_USE_FDKAAC +//#define VGM_USE_FFMPEG +//#define VGM_USE_ATRAC9 +//#define VGM_USE_CELT +//#define VGM_USE_SPEEX + + /* reasonable limits */ enum { /* Windows generally only allows 260 chars in path, but other OSs have higher limits, and we handle @@ -20,22 +33,9 @@ enum { }; #include "streamfile.h" +#include "vgmstream_types.h" #include "util/log.h" -/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1, etc decoding is done by external libraries. - * Libs are disabled by default, defined on compile-time for builds that support it */ -//#define VGM_USE_VORBIS -//#define VGM_USE_MPEG -//#define VGM_USE_G7221 -//#define VGM_USE_G719 -//#define VGM_USE_MP4V2 -//#define VGM_USE_FDKAAC -//#define VGM_USE_FFMPEG -//#define VGM_USE_ATRAC9 -//#define VGM_USE_CELT -//#define VGM_USE_SPEEX - - #ifdef VGM_USE_MP4V2 #define MP4V2_NO_STDINT_DEFS #include @@ -48,721 +48,6 @@ enum { #include "coding/g72x_state.h" -/* The encoding type specifies the format the sound data itself takes */ -typedef enum { - coding_SILENCE, /* generates silence */ - - /* PCM */ - coding_PCM16LE, /* little endian 16-bit PCM */ - coding_PCM16BE, /* big endian 16-bit PCM */ - coding_PCM16_int, /* 16-bit PCM with sample-level interleave (for blocks) */ - - coding_PCM8, /* 8-bit PCM */ - coding_PCM8_int, /* 8-bit PCM with sample-level interleave (for blocks) */ - coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */ - coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave (for blocks) */ - coding_PCM8_SB, /* 8-bit PCM, sign bit (others are 2's complement) */ - coding_PCM4, /* 4-bit PCM, signed */ - coding_PCM4_U, /* 4-bit PCM, unsigned */ - - coding_ULAW, /* 8-bit u-Law (non-linear PCM) */ - coding_ULAW_int, /* 8-bit u-Law (non-linear PCM) with sample-level interleave (for blocks) */ - coding_ALAW, /* 8-bit a-Law (non-linear PCM) */ - - coding_PCMFLOAT, /* 32-bit float PCM */ - coding_PCM24LE, /* little endian 24-bit PCM */ - coding_PCM24BE, /* big endian 24-bit PCM */ - - /* ADPCM */ - coding_CRI_ADX, /* CRI ADX */ - coding_CRI_ADX_fixed, /* CRI ADX, encoding type 2 with fixed coefficients */ - coding_CRI_ADX_exp, /* CRI ADX, encoding type 4 with exponential scale */ - coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */ - coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */ - - coding_NGC_DSP, /* Nintendo DSP ADPCM */ - coding_NGC_DSP_subint, /* Nintendo DSP ADPCM with frame subinterframe */ - coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */ - coding_NGC_AFC, /* Nintendo AFC ADPCM */ - coding_VADPCM, /* Silicon Graphics VADPCM */ - - coding_G721, /* CCITT G.721 */ - - coding_XA, /* CD-ROM XA 4-bit */ - coding_XA8, /* CD-ROM XA 8-bit */ - coding_XA_EA, /* EA's Saturn XA (not to be confused with EA-XA) */ - coding_PSX, /* Sony PS ADPCM (VAG) */ - coding_PSX_badflags, /* Sony PS ADPCM with custom flag byte */ - coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (int math) */ - coding_PSX_pivotal, /* Sony PS ADPCM with configurable frame size (float math) */ - coding_HEVAG, /* Sony PSVita ADPCM */ - - coding_EA_XA, /* Electronic Arts EA-XA ADPCM v1 (stereo) aka "EA ADPCM" */ - coding_EA_XA_int, /* Electronic Arts EA-XA ADPCM v1 (mono/interleave) */ - coding_EA_XA_V2, /* Electronic Arts EA-XA ADPCM v2 */ - coding_MAXIS_XA, /* Maxis EA-XA ADPCM */ - coding_EA_XAS_V0, /* Electronic Arts EA-XAS ADPCM v0 */ - coding_EA_XAS_V1, /* Electronic Arts EA-XAS ADPCM v1 */ - - coding_IMA, /* IMA ADPCM (stereo or mono, low nibble first) */ - coding_IMA_int, /* IMA ADPCM (mono/interleave, low nibble first) */ - coding_DVI_IMA, /* DVI IMA ADPCM (stereo or mono, high nibble first) */ - coding_DVI_IMA_int, /* DVI IMA ADPCM (mono/interleave, high nibble first) */ - coding_NW_IMA, - coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */ - coding_QD_IMA, - coding_WV6_IMA, /* Gorilla Systems WV6 4-bit IMA ADPCM */ - coding_HV_IMA, /* High Voltage 4-bit IMA ADPCM */ - coding_FFTA2_IMA, /* Final Fantasy Tactics A2 4-bit IMA ADPCM */ - coding_BLITZ_IMA, /* Blitz Games 4-bit IMA ADPCM */ - - coding_MS_IMA, /* Microsoft IMA ADPCM */ - coding_MS_IMA_mono, /* Microsoft IMA ADPCM (mono/interleave) */ - coding_XBOX_IMA, /* XBOX IMA ADPCM */ - coding_XBOX_IMA_mch, /* XBOX IMA ADPCM (multichannel) */ - coding_XBOX_IMA_int, /* XBOX IMA ADPCM (mono/interleave) */ - coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */ - coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */ - coding_RAD_IMA, /* Radical IMA ADPCM */ - coding_RAD_IMA_mono, /* Radical IMA ADPCM (mono/interleave) */ - coding_APPLE_IMA4, /* Apple Quicktime IMA4 */ - coding_FSB_IMA, /* FMOD's FSB multichannel IMA ADPCM */ - coding_WWISE_IMA, /* Audiokinetic Wwise IMA ADPCM */ - coding_REF_IMA, /* Reflections IMA ADPCM */ - coding_AWC_IMA, /* Rockstar AWC IMA ADPCM */ - coding_UBI_IMA, /* Ubisoft IMA ADPCM */ - coding_UBI_SCE_IMA, /* Ubisoft SCE IMA ADPCM */ - coding_H4M_IMA, /* H4M IMA ADPCM (stereo or mono, high nibble first) */ - coding_MTF_IMA, /* Capcom MT Framework IMA ADPCM */ - coding_CD_IMA, /* Crystal Dynamics IMA ADPCM */ - - coding_MSADPCM, /* Microsoft ADPCM (stereo/mono) */ - coding_MSADPCM_int, /* Microsoft ADPCM (mono) */ - coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */ - coding_WS, /* Westwood Studios VBR ADPCM */ - - coding_AICA, /* Yamaha AICA ADPCM (stereo) */ - coding_AICA_int, /* Yamaha AICA ADPCM (mono/interleave) */ - coding_CP_YM, /* Capcom's Yamaha ADPCM (stereo/mono) */ - coding_ASKA, /* Aska ADPCM */ - coding_NXAP, /* NXAP ADPCM */ - - coding_TGC, /* Tiger Game.com 4-bit ADPCM */ - - coding_NDS_PROCYON, /* Procyon Studio ADPCM */ - coding_L5_555, /* Level-5 0x555 ADPCM */ - coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/ - coding_MTAF, /* Konami MTAF ADPCM */ - coding_MTA2, /* Konami MTA2 ADPCM */ - coding_MC3, /* Paradigm MC3 3-bit ADPCM */ - coding_FADPCM, /* FMOD FADPCM 4-bit ADPCM */ - coding_ASF, /* Argonaut ASF 4-bit ADPCM */ - coding_DSA, /* Ocean DSA 4-bit ADPCM */ - coding_XMD, /* Konami XMD 4-bit ADPCM */ - coding_TANTALUS, /* Tantalus 4-bit ADPCM */ - coding_PCFX, /* PC-FX 4-bit ADPCM */ - coding_OKI16, /* OKI 4-bit ADPCM with 16-bit output and modified expand */ - coding_OKI4S, /* OKI 4-bit ADPCM with 16-bit output and cuadruple step */ - coding_PTADPCM, /* Platinum 4-bit ADPCM */ - coding_IMUSE, /* LucasArts iMUSE Variable ADPCM */ - coding_COMPRESSWAVE, /* CompressWave Huffman ADPCM */ - - /* 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_SASSC, /* Activision EXAKT SASSC 8-bit DPCM */ - coding_DERF, /* DERF 8-bit DPCM */ - coding_WADY, /* WADY 8-bit DPCM */ - coding_NWA, /* VisualArt's NWA DPCM */ - coding_ACM, /* InterPlay ACM */ - coding_CIRCUS_ADPCM, /* Circus 8-bit ADPCM */ - coding_UBI_ADPCM, /* Ubisoft 4/6-bit ADPCM */ - - coding_EA_MT, /* Electronic Arts MicroTalk (linear-predictive speech codec) */ - coding_CIRCUS_VQ, /* Circus VQ */ - coding_RELIC, /* Relic Codec (DCT-based) */ - coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */ - coding_TAC, /* tri-Ace Codec (MDCT-based) */ - coding_ICE_RANGE, /* Inti Creates "range" codec */ - coding_ICE_DCT, /* Inti Creates "DCT" codec */ - -#ifdef VGM_USE_VORBIS - coding_OGG_VORBIS, /* Xiph Vorbis with Ogg layer (MDCT-based) */ - coding_VORBIS_custom, /* Xiph Vorbis with custom layer (MDCT-based) */ -#endif - -#ifdef VGM_USE_MPEG - coding_MPEG_custom, /* MPEG audio with custom features (MDCT-based) */ - coding_MPEG_ealayer3, /* EALayer3, custom MPEG frames */ - coding_MPEG_layer1, /* MP1 MPEG audio (MDCT-based) */ - coding_MPEG_layer2, /* MP2 MPEG audio (MDCT-based) */ - coding_MPEG_layer3, /* MP3 MPEG audio (MDCT-based) */ -#endif - -#ifdef VGM_USE_G7221 - coding_G7221C, /* ITU G.722.1 annex C (Polycom Siren 14) */ -#endif - -#ifdef VGM_USE_G719 - coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */ -#endif - -#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) - coding_MP4_AAC, /* AAC (MDCT-based) */ -#endif - -#ifdef VGM_USE_ATRAC9 - coding_ATRAC9, /* Sony ATRAC9 (MDCT-based) */ -#endif - -#ifdef VGM_USE_CELT - coding_CELT_FSB, /* Custom Xiph CELT (MDCT-based) */ -#endif - -#ifdef VGM_USE_SPEEX - coding_SPEEX, /* Custom Speex (CELP-based) */ -#endif - -#ifdef VGM_USE_FFMPEG - coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */ -#endif -} 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 */ - - /* headered blocks */ - layout_blocked_ast, - layout_blocked_halpst, - layout_blocked_xa, - layout_blocked_ea_schl, - layout_blocked_ea_1snh, - layout_blocked_caf, - layout_blocked_wsi, - layout_blocked_str_snds, - layout_blocked_ws_aud, - layout_blocked_matx, - layout_blocked_dec, - layout_blocked_xvas, - layout_blocked_vs, - layout_blocked_mul, - layout_blocked_gsb, - layout_blocked_thp, - layout_blocked_filp, - layout_blocked_ea_swvr, - layout_blocked_adm, - layout_blocked_bdsp, - layout_blocked_mxch, - layout_blocked_ivaud, /* GTA IV .ivaud blocks */ - layout_blocked_ps2_iab, - layout_blocked_vs_str, - layout_blocked_rws, - layout_blocked_hwas, - layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */ - layout_blocked_awc, /* Rockstar AWC */ - layout_blocked_vgs, /* Guitar Hero II (PS2) */ - layout_blocked_xwav, - layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */ - layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */ - layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */ - layout_blocked_sthd, /* Dream Factory STHD */ - layout_blocked_h4m, /* H4M video */ - layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */ - layout_blocked_vs_square, - layout_blocked_vid1, - layout_blocked_ubi_sce, - layout_blocked_tt_ad, - - /* otherwise odd */ - layout_segmented, /* song divided in segments (song sections) */ - layout_layered, /* song divided in layers (song channels) */ - -} 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 { - meta_SILENCE, - - meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */ - meta_DSP_CSTR, /* Star Fox Assault "Cstr" */ - meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */ - meta_DSP_STM, /* Paper Mario 2 STM */ - meta_AGSC, /* Retro: Metroid Prime 2 title */ - meta_CSMP, /* Retro: Metroid Prime 3 (Wii), Donkey Kong Country Returns (Wii) */ - meta_RFRM, /* Retro: Donkey Kong Country Tropical Freeze (Wii U) */ - meta_DSP_MPDSP, /* Monopoly Party single header stereo */ - meta_DSP_JETTERS, /* Bomberman Jetters .dsp */ - meta_DSP_MSS, /* Free Radical GC games */ - meta_DSP_GCM, /* some of Traveller's Tales games */ - meta_DSP_STR, /* Conan .str files */ - meta_DSP_SADB, /* .sad */ - meta_DSP_WSI, /* .wsi */ - meta_IDSP_TT, /* Traveller's Tales games */ - meta_DSP_WII_MUS, /* .mus */ - meta_DSP_WII_WSD, /* Phantom Brave (WII) */ - meta_WII_NDP, /* Vertigo (Wii) */ - meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ - - meta_STRM, /* Nintendo STRM */ - meta_RSTM, /* Nintendo RSTM (Revolution Stream, similar to STRM) */ - meta_AFC, /* AFC */ - meta_AST, /* AST */ - meta_RWSD, /* single-stream RWSD */ - meta_RWAR, /* single-stream RWAR */ - meta_RWAV, /* contents of RWAR */ - meta_CWAV, /* contents of CWAR */ - meta_FWAV, /* contents of FWAR */ - meta_THP, /* THP movie files */ - meta_SWAV, - meta_NDS_RRDS, /* Ridge Racer DS */ - meta_WII_BNS, /* Wii BNS Banner Sound (similar to RSTM) */ - meta_WIIU_BTSND, /* Wii U Boot Sound */ - - meta_ADX_03, /* CRI ADX "type 03" */ - meta_ADX_04, /* CRI ADX "type 04" */ - meta_ADX_05, /* CRI ADX "type 05" */ - meta_AIX, /* CRI AIX */ - meta_AAX, /* CRI AAX */ - meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */ - - meta_DTK, - meta_RSF, - meta_HALPST, /* HAL Labs HALPST */ - meta_GCSW, /* GCSW (PCM) */ - meta_CAF, /* tri-Crescendo CAF */ - meta_MYSPD, /* U-Sing .myspd */ - meta_HIS, /* Her Ineractive .his */ - meta_BNSF, /* Bandai Namco Sound Format */ - - meta_XA, /* CD-ROM XA */ - meta_ADS, - meta_NPS, - meta_RXWS, - meta_RAW_INT, - meta_EXST, - meta_SVAG_KCET, - meta_PS_HEADERLESS, /* headerless PS-ADPCM */ - meta_MIB_MIH, - meta_PS2_MIC, /* KOEI MIC File */ - meta_PS2_VAGi, /* VAGi Interleaved File */ - meta_PS2_VAGp, /* VAGp Mono File */ - meta_PS2_pGAV, /* VAGp with Little Endian Header */ - meta_PS2_VAGp_AAAP, /* Acclaim Austin Audio VAG header */ - meta_SEB, - meta_STR_WAV, /* Blitz Games STR+WAV files */ - meta_ILD, - meta_PS2_PNB, /* PsychoNauts Bgm File */ - meta_VPK, /* VPK Audio File */ - meta_PS2_BMDX, /* Beatmania thing */ - meta_PS2_IVB, /* Langrisser 3 IVB */ - meta_PS2_SND, /* some Might & Magics SSND header */ - meta_SVS, /* Square SVS */ - meta_XSS, /* Dino Crisis 3 */ - meta_SL3, /* Test Drive Unlimited */ - meta_HGC1, /* Knights of the Temple 2 */ - meta_AUS, /* Various Capcom games */ - meta_RWS, /* RenderWare games (only when using RW Audio middleware) */ - meta_FSB1, /* FMOD Sample Bank, version 1 */ - meta_FSB2, /* FMOD Sample Bank, version 2 */ - meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */ - meta_FSB4, /* FMOD Sample Bank, version 4 */ - meta_FSB5, /* FMOD Sample Bank, version 5 */ - meta_RWX, /* Air Force Delta Storm (XBOX) */ - meta_XWB, /* Microsoft XACT framework (Xbox, X360, Windows) */ - meta_PS2_XA30, /* Driver - Parallel Lines (PS2) */ - meta_MUSC, /* Krome PS2 games */ - meta_MUSX, - meta_LEG, /* Legaia 2 [no header_id] */ - meta_FILP, /* Resident Evil - Dead Aim */ - meta_IKM, - meta_STER, - meta_BG00, /* Ibara, Mushihimesama */ - meta_PS2_RSTM, /* Midnight Club 3 */ - meta_PS2_KCES, /* Dance Dance Revolution */ - meta_HXD, - meta_VSV, - meta_SCD_PCM, /* Lunar - Eternal Blue */ - meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */ - meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */ - meta_PS2_VAS, /* Pro Baseball Spirits 5 */ - meta_PS2_ENTH, /* Enthusia */ - meta_SDT, /* Baldur's Gate - Dark Alliance */ - meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */ - meta_DC_STR, /* SEGA Stream Asset Builder */ - meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */ - meta_NGC_BH2PCM, /* Bio Hazard 2 */ - meta_SAP, - meta_DC_IDVI, /* Eldorado Gate */ - meta_KRAW, /* Geometry Wars - Galaxies */ - meta_PS2_OMU, /* PS2 Int file with Header */ - meta_PS2_XA2, /* XG3 Extreme-G Racing */ - meta_NUB, - meta_IDSP_NL, /* Mario Strikers Charged (Wii) */ - meta_IDSP_IE, /* Defencer (GC) */ - meta_SPT_SPD, /* Various (SPT+SPT DSP) */ - meta_ISH_ISD, /* Various (ISH+ISD DSP) */ - meta_GSP_GSB, /* Tecmo games (Super Swing Golf 1 & 2, Quamtum Theory) */ - meta_YDSP, /* WWE Day of Reckoning */ - meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */ - meta_UBI_JADE, /* Beyond Good & Evil, Rayman Raving Rabbids */ - meta_GCA, /* Metal Slug Anthology */ - meta_NGC_SSM, /* Golden Gashbell Full Power */ - meta_PS2_JOE, /* Wall-E / Pixar games */ - meta_NGC_YMF, /* WWE WrestleMania X8 */ - meta_SADL, - meta_FAG, /* Jackie Chan - Stuntmaster */ - meta_PS2_MIHB, /* Merged MIH+MIB */ - meta_NGC_PDT, /* Mario Party 6 */ - meta_DC_ASD, /* Miss Moonligh */ - meta_SPSD, - meta_RSD, - meta_PS2_ASS, /* ASS */ - meta_SEG, /* Eragon */ - meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */ - meta_KNON, - meta_ZWDSP, /* Zack and Wiki */ - meta_VGS, /* Guitar Hero Encore - Rocks the 80s */ - meta_DCS_WAV, - meta_SMP, - meta_WII_SNG, /* Excite Trucks */ - meta_MUL, - meta_SAT_BAKA, /* Crypt Killer */ - meta_VSF, - meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */ - meta_ADS_MIDWAY, - meta_PS2_SPS, /* Ape Escape 2 */ - meta_PS2_XA2_RRP, /* RC Revenge Pro */ - meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */ - meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */ - meta_RAW_WAVM, - meta_WVS, - meta_XBOX_MATX, /* XBOX MATX */ - meta_XMU, - meta_XVAS, - meta_EA_SCHL, /* Electronic Arts SCHl with variable header */ - meta_EA_SCHL_fixed, /* Electronic Arts SCHl with fixed header */ - meta_EA_BNK, /* Electronic Arts BNK */ - meta_EA_1SNH, /* Electronic Arts 1SNh/EACS */ - meta_EA_EACS, - meta_RAW_PCM, - meta_GENH, /* generic header */ - meta_AIFC, /* Audio Interchange File Format AIFF-C */ - meta_AIFF, /* Audio Interchange File Format */ - meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */ - meta_WS_AUD, /* Westwood Studios .aud */ - meta_WS_AUD_old, /* Westwood Studios .aud, old style */ - meta_RIFF_WAVE, /* RIFF, for WAVs */ - meta_RIFF_WAVE_POS, /* .wav + .pos for looping (Ys Complete PC) */ - 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_wsmp, /* RIFF w/ loop data in wsmp chunk */ - meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */ - meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */ - meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */ - meta_XNB, /* XNA Game Studio 4.0 */ - meta_PC_MXST, /* Lego Island MxSt */ - meta_SAB, /* Worms 4 Mayhem SAB+SOB file */ - meta_NWA, /* Visual Art's NWA */ - meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */ - meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */ - meta_SAT_DVI, /* Konami KCE Nagoya DVI (SAT games) */ - meta_DC_KCEY, /* Konami KCE Yokohama KCEYCOMP (DC games) */ - meta_ACM, /* InterPlay ACM header */ - meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */ - meta_DEC, /* Falcom PC games (Xanadu Next, Gurumin) */ - meta_VS, /* Men in Black .vs */ - meta_FFXI_BGW, /* FFXI (PC) BGW */ - meta_FFXI_SPW, /* FFXI (PC) SPW */ - meta_STS, - meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */ - meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */ - meta_NGC_DSP_IADP, /* Gamecube Interleave DSP */ - meta_PS2_TK5, /* Tekken 5 Stream Files */ - meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */ - meta_ZSD, /* Dragon Booster ZSD */ - meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */ - meta_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) */ - meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ - meta_PS2_VGV, /* Rune: Viking Warlord */ - meta_GCUB, - meta_MAXIS_XA, /* Sim City 3000 (PC) */ - meta_NGC_SCK_DSP, /* Scorpion King (NGC) */ - meta_CAFF, /* iPhone .caf */ - meta_EXAKT_SC, /* Activision EXAKT .SC (PS2) */ - meta_WII_WAS, /* DiRT 2 (WII) */ - meta_PONA_3DO, /* Policenauts (3DO) */ - meta_PONA_PSX, /* Policenauts (PSX) */ - meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */ - meta_AST_MV, - meta_AST_MMV, - meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ - meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */ - meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */ - meta_S14, /* raw Siren 14, 24kbit mono */ - meta_SSS, /* raw Siren 14, 48kbit stereo */ - 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_P3D, /* Prototype P3D */ - meta_PS2_TK1, /* Tekken (NamCollection) */ - meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */ - 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_EA_SWVR, /* Future Cop L.A.P.D., Freekstyle */ - 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 V (PS2) */ - meta_LPCM_SHADE, - meta_DSP_BDSP, /* Ah! My Goddess */ - meta_PS2_VMS, /* Autobahn Raser - Police Madness */ - meta_XAU, /* XPEC Entertainment (Beat Down (PS2 Xbox), Spectral Force Chronicle (PS2)) */ - meta_GH3_BAR, /* Guitar Hero III Mobile .bar */ - meta_FFW, /* Freedom Fighters [NGC] */ - meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */ - meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */ - meta_SQEX_SCD, /* Square-Enix SCD */ - meta_NGC_NST_DSP, /* Animaniacs [NGC] */ - meta_BAF, /* Bizarre Creations (Blur, James Bond) */ - meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ - meta_CPS, - meta_MSF, - meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */ - meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */ - meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */ - meta_SPM, - meta_VGS_PS, - meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */ - meta_VS_STR, /* The Bouncer */ - meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */ - meta_XWAV, - meta_RAW_SNDS, - meta_PS2_WMUS, /* The Warriors (PS2) */ - meta_HYPERSCAN_KVAG, /* Hyperscan KVAG/BVG */ - meta_IOS_PSND, /* Crash Bandicoot Nitro Kart 2 (iOS) */ - meta_BOS_ADP, - meta_QD_ADP, - meta_EB_SFX, /* Excitebots .sfx */ - meta_EB_SF0, /* Excitebots .sf0 */ - meta_MTAF, - meta_PS2_VAG1, /* Metal Gear Solid 3 VAG1 */ - meta_PS2_VAG2, /* Metal Gear Solid 3 VAG2 */ - meta_ALP, - meta_WPD, /* Shuffle! (PC) */ - meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */ - meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */ - meta_PS2_HSF, /* Lowrider (PS2) */ - meta_IVAG, - meta_PS2_2PFS, /* Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2) */ - meta_PS2_VBK, /* Disney's Stitch - Experiment 626 */ - meta_OTM, /* Otomedius (Arcade) */ - meta_CSTM, /* Nintendo 3DS CSTM (Century Stream) */ - meta_FSTM, /* Nintendo Wii U FSTM (caFe? Stream) */ - meta_IDSP_NAMCO, - meta_KT_WIIBGM, /* Koei Tecmo WiiBGM */ - meta_KTSS, /* Koei Tecmo Nintendo Stream (KNS) */ - meta_MCA, /* Capcom MCA "MADP" */ - meta_XB3D_ADX, /* Xenoblade Chronicles 3D ADX */ - meta_HCA, /* CRI HCA */ - meta_SVAG_SNK, - meta_PS2_VDS_VDM, /* Graffiti Kingdom */ - meta_FFMPEG, - meta_FFMPEG_faulty, - meta_CXS, - meta_AKB, - meta_PASX, - meta_XMA_RIFF, - meta_ASTB, - meta_WWISE_RIFF, /* Audiokinetic Wwise RIFF/RIFX */ - meta_UBI_RAKI, /* Ubisoft RAKI header (Rayman Legends, Just Dance 2017) */ - meta_SXD, /* Sony SXD (Gravity Rush, Freedom Wars PSV) */ - meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */ - meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */ - meta_GHS, - meta_AAC_TRIACE, - meta_MTA2, - meta_NGC_ULW, /* Burnout 1 (GC only) */ - meta_XA_XA30, - meta_XA_04SW, - meta_TXTH, /* generic text header */ - meta_SK_AUD, /* Silicon Knights .AUD (Eternal Darkness GC) */ - meta_AHX, - meta_STM, /* Angel Studios/Rockstar San Diego Games */ - meta_BINK, /* RAD Game Tools BINK audio/video */ - meta_EA_SNU, /* Electronic Arts SNU (Dead Space) */ - meta_AWC, /* Rockstar AWC (GTA5, RDR) */ - meta_OPUS, /* Nintendo Opus [Lego City Undercover (Switch)] */ - meta_RAW_AL, - meta_PC_AST, /* Dead Rising (PC) */ - meta_NAAC, /* Namco AAC (3DS) */ - meta_UBI_SB, /* Ubisoft banks */ - meta_EZW, /* EZ2DJ (Arcade) EZWAV */ - meta_VXN, /* Gameloft mobile games */ - meta_EA_SNR_SNS, /* Electronic Arts SNR+SNS (Burnout Paradise) */ - meta_EA_SPS, /* Electronic Arts SPS (Burnout Crash) */ - meta_VID1, - meta_PC_FLX, /* Ultima IX PC */ - meta_MOGG, /* Harmonix Music Systems MOGG Vorbis */ - meta_OGG_VORBIS, /* Ogg Vorbis */ - meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */ - meta_OPUS_SLI, /* Ogg Opus file w/ companion .sli for looping */ - meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */ - meta_OGG_KOVS, /* Ogg Vorbis with header and encryption (Koei Tecmo Games) */ - meta_OGG_encrypted, /* Ogg Vorbis with encryption */ - meta_KMA9, /* Koei Tecmo [Nobunaga no Yabou - Souzou (Vita)] */ - meta_XWC, /* Starbreeze games */ - meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */ - meta_SQEX_MAB, /* Square-Enix newest middleware (music) */ - meta_WAF, /* KID WAF [Ever 17 (PC)] */ - meta_WAVE, /* EngineBlack games [Mighty Switch Force! (3DS)] */ - meta_WAVE_segmented, /* EngineBlack games, segmented [Shantae and the Pirate's Curse (PC)] */ - meta_SMV, /* Cho Aniki Zero (PSP) */ - meta_NXAP, /* Nex Entertainment games [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */ - meta_EA_WVE_AU00, /* Electronic Arts PS movies [Future Cop - L.A.P.D. (PS), Supercross 2000 (PS)] */ - meta_EA_WVE_AD10, /* Electronic Arts PS movies [Wing Commander 3/4 (PS)] */ - meta_STHD, /* STHD .stx [Kakuto Chojin (Xbox)] */ - meta_MP4, /* MP4/AAC */ - meta_PCM_SRE, /* .PCM+SRE [Viewtiful Joe (PS2)] */ - meta_DSP_MCADPCM, /* Skyrim (Switch) */ - meta_UBI_LYN, /* Ubisoft LyN engine [The Adventures of Tintin (multi)] */ - meta_MSB_MSH, /* sfx companion of MIH+MIB */ - meta_TXTP, /* generic text playlist */ - meta_SMC_SMH, /* Wangan Midnight (System 246) */ - meta_PPST, /* PPST [Parappa the Rapper (PSP)] */ - meta_SPS_N1, - meta_UBI_BAO, /* Ubisoft BAO */ - meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */ - meta_H4M, /* Hudson HVQM4 video [Resident Evil 0 (GC), Tales of Symphonia (GC)] */ - meta_ASF, /* Argonaut ASF [Croc 2 (PC)] */ - meta_XMD, /* Konami XMD [Silent Hill 4 (Xbox), Castlevania: Curse of Darkness (Xbox)] */ - meta_CKS, /* Cricket Audio stream [Part Time UFO (Android), Mega Man 1-6 (Android)] */ - meta_CKB, /* Cricket Audio bank [Fire Emblem Heroes (Android), Mega Man 1-6 (Android)] */ - meta_WV6, /* Gorilla Systems PC games */ - meta_WAVEBATCH, /* Firebrand Games */ - meta_HD3_BD3, /* Sony PS3 bank */ - meta_BNK_SONY, /* Sony Scream Tool bank */ - meta_SSCF, - meta_DSP_VAG, /* Penny-Punching Princess (Switch) sfx */ - meta_DSP_ITL, /* Charinko Hero (GC) */ - meta_A2M, /* Scooby-Doo! Unmasked (PS2) */ - meta_AHV, /* Headhunter (PS2) */ - meta_MSV, - meta_SDF, - meta_SVG, /* Hunter - The Reckoning - Wayward (PS2) */ - meta_VIS, /* AirForce Delta Strike (PS2) */ - meta_VAI, /* Ratatouille (GC) */ - meta_AIF_ASOBO, /* Ratatouille (PC) */ - meta_AO, /* Cloudphobia (PC) */ - meta_APC, /* MegaRace 3 (PC) */ - meta_WV2, /* Slave Zero (PC) */ - meta_XAU_KONAMI, /* Yu-Gi-Oh - The Dawn of Destiny (Xbox) */ - meta_DERF, /* Stupid Invaders (PC) */ - meta_SADF, - meta_UTK, - meta_NXA, - meta_ADPCM_CAPCOM, - meta_UE4OPUS, - meta_XWMA, - meta_VA3, /* DDR Supernova 2 AC */ - meta_XOPUS, - meta_VS_SQUARE, - meta_NWAV, - meta_XPCM, - meta_MSF_TAMASOFT, - meta_XPS_DAT, - meta_ZSND, - meta_DSP_ADPY, - meta_DSP_ADPX, - meta_OGG_OPUS, - meta_IMC, - meta_GIN, - meta_DSF, - meta_208, - meta_DSP_DS2, - meta_MUS_VC, - meta_STRM_ABYLIGHT, - meta_MSF_KONAMI, - meta_XWMA_KONAMI, - meta_9TAV, - meta_BWAV, - meta_RAD, - meta_SMACKER, - meta_MZRT, - meta_XAVS, - meta_PSF, - meta_DSP_ITL_i, - meta_IMA, - meta_XWV_VALVE, - meta_UBI_HX, - meta_BMP_KONAMI, - meta_ISB, - meta_XSSB, - meta_XMA_UE3, - meta_FWSE, - meta_FDA, - meta_TGC, - meta_KWB, - meta_LRMD, - meta_WWISE_FX, - meta_DIVA, - meta_IMUSE, - meta_KTSR, - meta_KAT, - meta_PCM_SUCCESS, - meta_ADP_KONAMI, - meta_SDRH, - meta_WADY, - meta_DSP_SQEX, - meta_DSP_WIIVOICE, - meta_SBK, - meta_DSP_WIIADPCM, - meta_DSP_CWAC, - meta_COMPRESSWAVE, - meta_KTAC, - meta_MJB_MJH, - meta_BSNF, - meta_TAC, - meta_IDSP_TOSE, - meta_DSP_KWA, - meta_OGV_3RDEYE, - meta_PIFF_TPCM, - meta_WXD_WXH, - meta_BNK_RELIC, - meta_XSH_XSD_XSS, - meta_PSB, - meta_LOPU_FB, - meta_LPCM_FB, - meta_WBK, - meta_WBK_NSLB, - meta_DSP_APEX, - meta_MPEG, - meta_SSPF, - meta_S3V, - meta_ESF, - meta_ADM3, - meta_TT_AD, - meta_SNDZ, - meta_VAB, - meta_BIGRP, - -} meta_t; - - typedef struct { int config_set; /* some of the mods below are set */ diff --git a/src/vgmstream_types.h b/src/vgmstream_types.h new file mode 100644 index 00000000..22180fb4 --- /dev/null +++ b/src/vgmstream_types.h @@ -0,0 +1,718 @@ +#ifndef _VGMSTREAM_TYPES_H +#define _VGMSTREAM_TYPES_H + + +/* The encoding type specifies the format the sound data itself takes */ +typedef enum { + coding_SILENCE, /* generates silence */ + + /* PCM */ + coding_PCM16LE, /* little endian 16-bit PCM */ + coding_PCM16BE, /* big endian 16-bit PCM */ + coding_PCM16_int, /* 16-bit PCM with sample-level interleave (for blocks) */ + + coding_PCM8, /* 8-bit PCM */ + coding_PCM8_int, /* 8-bit PCM with sample-level interleave (for blocks) */ + coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */ + coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave (for blocks) */ + coding_PCM8_SB, /* 8-bit PCM, sign bit (others are 2's complement) */ + coding_PCM4, /* 4-bit PCM, signed */ + coding_PCM4_U, /* 4-bit PCM, unsigned */ + + coding_ULAW, /* 8-bit u-Law (non-linear PCM) */ + coding_ULAW_int, /* 8-bit u-Law (non-linear PCM) with sample-level interleave (for blocks) */ + coding_ALAW, /* 8-bit a-Law (non-linear PCM) */ + + coding_PCMFLOAT, /* 32-bit float PCM */ + coding_PCM24LE, /* little endian 24-bit PCM */ + coding_PCM24BE, /* big endian 24-bit PCM */ + + /* ADPCM */ + coding_CRI_ADX, /* CRI ADX */ + coding_CRI_ADX_fixed, /* CRI ADX, encoding type 2 with fixed coefficients */ + coding_CRI_ADX_exp, /* CRI ADX, encoding type 4 with exponential scale */ + coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */ + coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */ + + coding_NGC_DSP, /* Nintendo DSP ADPCM */ + coding_NGC_DSP_subint, /* Nintendo DSP ADPCM with frame subinterframe */ + coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */ + coding_NGC_AFC, /* Nintendo AFC ADPCM */ + coding_VADPCM, /* Silicon Graphics VADPCM */ + + coding_G721, /* CCITT G.721 */ + + coding_XA, /* CD-ROM XA 4-bit */ + coding_XA8, /* CD-ROM XA 8-bit */ + coding_XA_EA, /* EA's Saturn XA (not to be confused with EA-XA) */ + coding_PSX, /* Sony PS ADPCM (VAG) */ + coding_PSX_badflags, /* Sony PS ADPCM with custom flag byte */ + coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (int math) */ + coding_PSX_pivotal, /* Sony PS ADPCM with configurable frame size (float math) */ + coding_HEVAG, /* Sony PSVita ADPCM */ + + coding_EA_XA, /* Electronic Arts EA-XA ADPCM v1 (stereo) aka "EA ADPCM" */ + coding_EA_XA_int, /* Electronic Arts EA-XA ADPCM v1 (mono/interleave) */ + coding_EA_XA_V2, /* Electronic Arts EA-XA ADPCM v2 */ + coding_MAXIS_XA, /* Maxis EA-XA ADPCM */ + coding_EA_XAS_V0, /* Electronic Arts EA-XAS ADPCM v0 */ + coding_EA_XAS_V1, /* Electronic Arts EA-XAS ADPCM v1 */ + + coding_IMA, /* IMA ADPCM (stereo or mono, low nibble first) */ + coding_IMA_int, /* IMA ADPCM (mono/interleave, low nibble first) */ + coding_DVI_IMA, /* DVI IMA ADPCM (stereo or mono, high nibble first) */ + coding_DVI_IMA_int, /* DVI IMA ADPCM (mono/interleave, high nibble first) */ + coding_NW_IMA, + coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */ + coding_QD_IMA, + coding_WV6_IMA, /* Gorilla Systems WV6 4-bit IMA ADPCM */ + coding_HV_IMA, /* High Voltage 4-bit IMA ADPCM */ + coding_FFTA2_IMA, /* Final Fantasy Tactics A2 4-bit IMA ADPCM */ + coding_BLITZ_IMA, /* Blitz Games 4-bit IMA ADPCM */ + + coding_MS_IMA, /* Microsoft IMA ADPCM */ + coding_MS_IMA_mono, /* Microsoft IMA ADPCM (mono/interleave) */ + coding_XBOX_IMA, /* XBOX IMA ADPCM */ + coding_XBOX_IMA_mch, /* XBOX IMA ADPCM (multichannel) */ + coding_XBOX_IMA_int, /* XBOX IMA ADPCM (mono/interleave) */ + coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */ + coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */ + coding_RAD_IMA, /* Radical IMA ADPCM */ + coding_RAD_IMA_mono, /* Radical IMA ADPCM (mono/interleave) */ + coding_APPLE_IMA4, /* Apple Quicktime IMA4 */ + coding_FSB_IMA, /* FMOD's FSB multichannel IMA ADPCM */ + coding_WWISE_IMA, /* Audiokinetic Wwise IMA ADPCM */ + coding_REF_IMA, /* Reflections IMA ADPCM */ + coding_AWC_IMA, /* Rockstar AWC IMA ADPCM */ + coding_UBI_IMA, /* Ubisoft IMA ADPCM */ + coding_UBI_SCE_IMA, /* Ubisoft SCE IMA ADPCM */ + coding_H4M_IMA, /* H4M IMA ADPCM (stereo or mono, high nibble first) */ + coding_MTF_IMA, /* Capcom MT Framework IMA ADPCM */ + coding_CD_IMA, /* Crystal Dynamics IMA ADPCM */ + + coding_MSADPCM, /* Microsoft ADPCM (stereo/mono) */ + coding_MSADPCM_int, /* Microsoft ADPCM (mono) */ + coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */ + coding_WS, /* Westwood Studios VBR ADPCM */ + + coding_AICA, /* Yamaha AICA ADPCM (stereo) */ + coding_AICA_int, /* Yamaha AICA ADPCM (mono/interleave) */ + coding_CP_YM, /* Capcom's Yamaha ADPCM (stereo/mono) */ + coding_ASKA, /* Aska ADPCM */ + coding_NXAP, /* NXAP ADPCM */ + + coding_TGC, /* Tiger Game.com 4-bit ADPCM */ + + coding_NDS_PROCYON, /* Procyon Studio ADPCM */ + coding_L5_555, /* Level-5 0x555 ADPCM */ + coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/ + coding_MTAF, /* Konami MTAF ADPCM */ + coding_MTA2, /* Konami MTA2 ADPCM */ + coding_MC3, /* Paradigm MC3 3-bit ADPCM */ + coding_FADPCM, /* FMOD FADPCM 4-bit ADPCM */ + coding_ASF, /* Argonaut ASF 4-bit ADPCM */ + coding_DSA, /* Ocean DSA 4-bit ADPCM */ + coding_XMD, /* Konami XMD 4-bit ADPCM */ + coding_TANTALUS, /* Tantalus 4-bit ADPCM */ + coding_PCFX, /* PC-FX 4-bit ADPCM */ + coding_OKI16, /* OKI 4-bit ADPCM with 16-bit output and modified expand */ + coding_OKI4S, /* OKI 4-bit ADPCM with 16-bit output and cuadruple step */ + coding_PTADPCM, /* Platinum 4-bit ADPCM */ + coding_IMUSE, /* LucasArts iMUSE Variable ADPCM */ + coding_COMPRESSWAVE, /* CompressWave Huffman ADPCM */ + + /* 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_SASSC, /* Activision EXAKT SASSC 8-bit DPCM */ + coding_DERF, /* DERF 8-bit DPCM */ + coding_WADY, /* WADY 8-bit DPCM */ + coding_NWA, /* VisualArt's NWA DPCM */ + coding_ACM, /* InterPlay ACM */ + coding_CIRCUS_ADPCM, /* Circus 8-bit ADPCM */ + coding_UBI_ADPCM, /* Ubisoft 4/6-bit ADPCM */ + + coding_EA_MT, /* Electronic Arts MicroTalk (linear-predictive speech codec) */ + coding_CIRCUS_VQ, /* Circus VQ */ + coding_RELIC, /* Relic Codec (DCT-based) */ + coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */ + coding_TAC, /* tri-Ace Codec (MDCT-based) */ + coding_ICE_RANGE, /* Inti Creates "range" codec */ + coding_ICE_DCT, /* Inti Creates "DCT" codec */ + +#ifdef VGM_USE_VORBIS + coding_OGG_VORBIS, /* Xiph Vorbis with Ogg layer (MDCT-based) */ + coding_VORBIS_custom, /* Xiph Vorbis with custom layer (MDCT-based) */ +#endif + +#ifdef VGM_USE_MPEG + coding_MPEG_custom, /* MPEG audio with custom features (MDCT-based) */ + coding_MPEG_ealayer3, /* EALayer3, custom MPEG frames */ + coding_MPEG_layer1, /* MP1 MPEG audio (MDCT-based) */ + coding_MPEG_layer2, /* MP2 MPEG audio (MDCT-based) */ + coding_MPEG_layer3, /* MP3 MPEG audio (MDCT-based) */ +#endif + +#ifdef VGM_USE_G7221 + coding_G7221C, /* ITU G.722.1 annex C (Polycom Siren 14) */ +#endif + +#ifdef VGM_USE_G719 + coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */ +#endif + +#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) + coding_MP4_AAC, /* AAC (MDCT-based) */ +#endif + +#ifdef VGM_USE_ATRAC9 + coding_ATRAC9, /* Sony ATRAC9 (MDCT-based) */ +#endif + +#ifdef VGM_USE_CELT + coding_CELT_FSB, /* Custom Xiph CELT (MDCT-based) */ +#endif + +#ifdef VGM_USE_SPEEX + coding_SPEEX, /* Custom Speex (CELP-based) */ +#endif + +#ifdef VGM_USE_FFMPEG + coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */ +#endif +} 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 */ + + /* headered blocks */ + layout_blocked_ast, + layout_blocked_halpst, + layout_blocked_xa, + layout_blocked_ea_schl, + layout_blocked_ea_1snh, + layout_blocked_caf, + layout_blocked_wsi, + layout_blocked_str_snds, + layout_blocked_ws_aud, + layout_blocked_matx, + layout_blocked_dec, + layout_blocked_xvas, + layout_blocked_vs, + layout_blocked_mul, + layout_blocked_gsb, + layout_blocked_thp, + layout_blocked_filp, + layout_blocked_ea_swvr, + layout_blocked_adm, + layout_blocked_bdsp, + layout_blocked_mxch, + layout_blocked_ivaud, /* GTA IV .ivaud blocks */ + layout_blocked_ps2_iab, + layout_blocked_vs_str, + layout_blocked_rws, + layout_blocked_hwas, + layout_blocked_ea_sns, /* newest Electronic Arts blocks, found in SNS/SNU/SPS/etc formats */ + layout_blocked_awc, /* Rockstar AWC */ + layout_blocked_vgs, /* Guitar Hero II (PS2) */ + layout_blocked_xwav, + layout_blocked_xvag_subsong, /* XVAG subsongs [God of War III (PS4)] */ + layout_blocked_ea_wve_au00, /* EA WVE au00 blocks */ + layout_blocked_ea_wve_ad10, /* EA WVE Ad10 blocks */ + layout_blocked_sthd, /* Dream Factory STHD */ + layout_blocked_h4m, /* H4M video */ + layout_blocked_xa_aiff, /* XA in AIFF files [Crusader: No Remorse (SAT), Road Rash (3DO)] */ + layout_blocked_vs_square, + layout_blocked_vid1, + layout_blocked_ubi_sce, + layout_blocked_tt_ad, + + /* otherwise odd */ + layout_segmented, /* song divided in segments (song sections) */ + layout_layered, /* song divided in layers (song channels) */ + +} layout_t; + +/* The meta type specifies how we know what we know about the file. */ +typedef enum { + meta_SILENCE, + + meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */ + meta_DSP_CSTR, /* Star Fox Assault "Cstr" */ + meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */ + meta_DSP_STM, /* Paper Mario 2 STM */ + meta_AGSC, /* Retro: Metroid Prime 2 title */ + meta_CSMP, /* Retro: Metroid Prime 3 (Wii), Donkey Kong Country Returns (Wii) */ + meta_RFRM, /* Retro: Donkey Kong Country Tropical Freeze (Wii U) */ + meta_DSP_MPDSP, /* Monopoly Party single header stereo */ + meta_DSP_JETTERS, /* Bomberman Jetters .dsp */ + meta_DSP_MSS, /* Free Radical GC games */ + meta_DSP_GCM, /* some of Traveller's Tales games */ + meta_DSP_STR, /* Conan .str files */ + meta_DSP_SADB, /* .sad */ + meta_DSP_WSI, /* .wsi */ + meta_IDSP_TT, /* Traveller's Tales games */ + meta_DSP_WII_MUS, /* .mus */ + meta_DSP_WII_WSD, /* Phantom Brave (WII) */ + meta_WII_NDP, /* Vertigo (Wii) */ + meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ + + meta_STRM, /* Nintendo STRM */ + meta_RSTM, /* Nintendo RSTM (Revolution Stream, similar to STRM) */ + meta_AFC, /* AFC */ + meta_AST, /* AST */ + meta_RWSD, /* single-stream RWSD */ + meta_RWAR, /* single-stream RWAR */ + meta_RWAV, /* contents of RWAR */ + meta_CWAV, /* contents of CWAR */ + meta_FWAV, /* contents of FWAR */ + meta_THP, /* THP movie files */ + meta_SWAV, + meta_NDS_RRDS, /* Ridge Racer DS */ + meta_WII_BNS, /* Wii BNS Banner Sound (similar to RSTM) */ + meta_WIIU_BTSND, /* Wii U Boot Sound */ + + meta_ADX_03, /* CRI ADX "type 03" */ + meta_ADX_04, /* CRI ADX "type 04" */ + meta_ADX_05, /* CRI ADX "type 05" */ + meta_AIX, /* CRI AIX */ + meta_AAX, /* CRI AAX */ + meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */ + + meta_DTK, + meta_RSF, + meta_HALPST, /* HAL Labs HALPST */ + meta_GCSW, /* GCSW (PCM) */ + meta_CAF, /* tri-Crescendo CAF */ + meta_MYSPD, /* U-Sing .myspd */ + meta_HIS, /* Her Ineractive .his */ + meta_BNSF, /* Bandai Namco Sound Format */ + + meta_XA, /* CD-ROM XA */ + meta_ADS, + meta_NPS, + meta_RXWS, + meta_RAW_INT, + meta_EXST, + meta_SVAG_KCET, + meta_PS_HEADERLESS, /* headerless PS-ADPCM */ + meta_MIB_MIH, + meta_PS2_MIC, /* KOEI MIC File */ + meta_PS2_VAGi, /* VAGi Interleaved File */ + meta_PS2_VAGp, /* VAGp Mono File */ + meta_PS2_pGAV, /* VAGp with Little Endian Header */ + meta_PS2_VAGp_AAAP, /* Acclaim Austin Audio VAG header */ + meta_SEB, + meta_STR_WAV, /* Blitz Games STR+WAV files */ + meta_ILD, + meta_PS2_PNB, /* PsychoNauts Bgm File */ + meta_VPK, /* VPK Audio File */ + meta_PS2_BMDX, /* Beatmania thing */ + meta_PS2_IVB, /* Langrisser 3 IVB */ + meta_PS2_SND, /* some Might & Magics SSND header */ + meta_SVS, /* Square SVS */ + meta_XSS, /* Dino Crisis 3 */ + meta_SL3, /* Test Drive Unlimited */ + meta_HGC1, /* Knights of the Temple 2 */ + meta_AUS, /* Various Capcom games */ + meta_RWS, /* RenderWare games (only when using RW Audio middleware) */ + meta_FSB1, /* FMOD Sample Bank, version 1 */ + meta_FSB2, /* FMOD Sample Bank, version 2 */ + meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */ + meta_FSB4, /* FMOD Sample Bank, version 4 */ + meta_FSB5, /* FMOD Sample Bank, version 5 */ + meta_RWX, /* Air Force Delta Storm (XBOX) */ + meta_XWB, /* Microsoft XACT framework (Xbox, X360, Windows) */ + meta_PS2_XA30, /* Driver - Parallel Lines (PS2) */ + meta_MUSC, /* Krome PS2 games */ + meta_MUSX, + meta_LEG, /* Legaia 2 [no header_id] */ + meta_FILP, /* Resident Evil - Dead Aim */ + meta_IKM, + meta_STER, + meta_BG00, /* Ibara, Mushihimesama */ + meta_PS2_RSTM, /* Midnight Club 3 */ + meta_PS2_KCES, /* Dance Dance Revolution */ + meta_HXD, + meta_VSV, + meta_SCD_PCM, /* Lunar - Eternal Blue */ + meta_PS2_PCM, /* Konami KCEJ East: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses, 7 Blades */ + meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 (PS2) */ + meta_PS2_VAS, /* Pro Baseball Spirits 5 */ + meta_PS2_ENTH, /* Enthusia */ + meta_SDT, /* Baldur's Gate - Dark Alliance */ + meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */ + meta_DC_STR, /* SEGA Stream Asset Builder */ + meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */ + meta_NGC_BH2PCM, /* Bio Hazard 2 */ + meta_SAP, + meta_DC_IDVI, /* Eldorado Gate */ + meta_KRAW, /* Geometry Wars - Galaxies */ + meta_PS2_OMU, /* PS2 Int file with Header */ + meta_PS2_XA2, /* XG3 Extreme-G Racing */ + meta_NUB, + meta_IDSP_NL, /* Mario Strikers Charged (Wii) */ + meta_IDSP_IE, /* Defencer (GC) */ + meta_SPT_SPD, /* Various (SPT+SPT DSP) */ + meta_ISH_ISD, /* Various (ISH+ISD DSP) */ + meta_GSP_GSB, /* Tecmo games (Super Swing Golf 1 & 2, Quamtum Theory) */ + meta_YDSP, /* WWE Day of Reckoning */ + meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */ + meta_UBI_JADE, /* Beyond Good & Evil, Rayman Raving Rabbids */ + meta_GCA, /* Metal Slug Anthology */ + meta_NGC_SSM, /* Golden Gashbell Full Power */ + meta_PS2_JOE, /* Wall-E / Pixar games */ + meta_NGC_YMF, /* WWE WrestleMania X8 */ + meta_SADL, + meta_FAG, /* Jackie Chan - Stuntmaster */ + meta_PS2_MIHB, /* Merged MIH+MIB */ + meta_NGC_PDT, /* Mario Party 6 */ + meta_DC_ASD, /* Miss Moonligh */ + meta_SPSD, + meta_RSD, + meta_PS2_ASS, /* ASS */ + meta_SEG, /* Eragon */ + meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */ + meta_KNON, + meta_ZWDSP, /* Zack and Wiki */ + meta_VGS, /* Guitar Hero Encore - Rocks the 80s */ + meta_DCS_WAV, + meta_SMP, + meta_WII_SNG, /* Excite Trucks */ + meta_MUL, + meta_SAT_BAKA, /* Crypt Killer */ + meta_VSF, + meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */ + meta_ADS_MIDWAY, + meta_PS2_SPS, /* Ape Escape 2 */ + meta_PS2_XA2_RRP, /* RC Revenge Pro */ + meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */ + meta_UBI_CKD, /* Ubisoft CKD RIFF header (Rayman Origins Wii) */ + meta_RAW_WAVM, + meta_WVS, + meta_XBOX_MATX, /* XBOX MATX */ + meta_XMU, + meta_XVAS, + meta_EA_SCHL, /* Electronic Arts SCHl with variable header */ + meta_EA_SCHL_fixed, /* Electronic Arts SCHl with fixed header */ + meta_EA_BNK, /* Electronic Arts BNK */ + meta_EA_1SNH, /* Electronic Arts 1SNh/EACS */ + meta_EA_EACS, + meta_RAW_PCM, + meta_GENH, /* generic header */ + meta_AIFC, /* Audio Interchange File Format AIFF-C */ + meta_AIFF, /* Audio Interchange File Format */ + meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */ + meta_WS_AUD, /* Westwood Studios .aud */ + meta_WS_AUD_old, /* Westwood Studios .aud, old style */ + meta_RIFF_WAVE, /* RIFF, for WAVs */ + meta_RIFF_WAVE_POS, /* .wav + .pos for looping (Ys Complete PC) */ + 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_wsmp, /* RIFF w/ loop data in wsmp chunk */ + meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */ + meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */ + meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */ + meta_XNB, /* XNA Game Studio 4.0 */ + meta_PC_MXST, /* Lego Island MxSt */ + meta_SAB, /* Worms 4 Mayhem SAB+SOB file */ + meta_NWA, /* Visual Art's NWA */ + meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */ + meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */ + meta_SAT_DVI, /* Konami KCE Nagoya DVI (SAT games) */ + meta_DC_KCEY, /* Konami KCE Yokohama KCEYCOMP (DC games) */ + meta_ACM, /* InterPlay ACM header */ + meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */ + meta_DEC, /* Falcom PC games (Xanadu Next, Gurumin) */ + meta_VS, /* Men in Black .vs */ + meta_FFXI_BGW, /* FFXI (PC) BGW */ + meta_FFXI_SPW, /* FFXI (PC) SPW */ + meta_STS, + meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */ + meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */ + meta_NGC_DSP_IADP, /* Gamecube Interleave DSP */ + meta_PS2_TK5, /* Tekken 5 Stream Files */ + meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */ + meta_ZSD, /* Dragon Booster ZSD */ + meta_REDSPARK, /* "RedSpark" RSD (MadWorld) */ + meta_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) */ + meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ + meta_PS2_VGV, /* Rune: Viking Warlord */ + meta_GCUB, + meta_MAXIS_XA, /* Sim City 3000 (PC) */ + meta_NGC_SCK_DSP, /* Scorpion King (NGC) */ + meta_CAFF, /* iPhone .caf */ + meta_EXAKT_SC, /* Activision EXAKT .SC (PS2) */ + meta_WII_WAS, /* DiRT 2 (WII) */ + meta_PONA_3DO, /* Policenauts (3DO) */ + meta_PONA_PSX, /* Policenauts (PSX) */ + meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */ + meta_AST_MV, + meta_AST_MMV, + meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ + meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */ + meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */ + meta_S14, /* raw Siren 14, 24kbit mono */ + meta_SSS, /* raw Siren 14, 48kbit stereo */ + 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_P3D, /* Prototype P3D */ + meta_PS2_TK1, /* Tekken (NamCollection) */ + meta_NGC_RKV, /* Legacy of Kain - Blood Omen 2 (GC) */ + 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_EA_SWVR, /* Future Cop L.A.P.D., Freekstyle */ + 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 V (PS2) */ + meta_LPCM_SHADE, + meta_DSP_BDSP, /* Ah! My Goddess */ + meta_PS2_VMS, /* Autobahn Raser - Police Madness */ + meta_XAU, /* XPEC Entertainment (Beat Down (PS2 Xbox), Spectral Force Chronicle (PS2)) */ + meta_GH3_BAR, /* Guitar Hero III Mobile .bar */ + meta_FFW, /* Freedom Fighters [NGC] */ + meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */ + meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */ + meta_SQEX_SCD, /* Square-Enix SCD */ + meta_NGC_NST_DSP, /* Animaniacs [NGC] */ + meta_BAF, /* Bizarre Creations (Blur, James Bond) */ + meta_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ + meta_CPS, + meta_MSF, + meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */ + meta_SGXD, /* Sony: Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */ + meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */ + meta_SPM, + meta_VGS_PS, + meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */ + meta_VS_STR, /* The Bouncer */ + meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */ + meta_XWAV, + meta_RAW_SNDS, + meta_PS2_WMUS, /* The Warriors (PS2) */ + meta_HYPERSCAN_KVAG, /* Hyperscan KVAG/BVG */ + meta_IOS_PSND, /* Crash Bandicoot Nitro Kart 2 (iOS) */ + meta_BOS_ADP, + meta_QD_ADP, + meta_EB_SFX, /* Excitebots .sfx */ + meta_EB_SF0, /* Excitebots .sf0 */ + meta_MTAF, + meta_PS2_VAG1, /* Metal Gear Solid 3 VAG1 */ + meta_PS2_VAG2, /* Metal Gear Solid 3 VAG2 */ + meta_ALP, + meta_WPD, /* Shuffle! (PC) */ + meta_MN_STR, /* Mini Ninjas (PC/PS3/WII) */ + meta_MSS, /* Guerilla: ShellShock Nam '67 (PS2/Xbox), Killzone (PS2) */ + meta_PS2_HSF, /* Lowrider (PS2) */ + meta_IVAG, + meta_PS2_2PFS, /* Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2) */ + meta_PS2_VBK, /* Disney's Stitch - Experiment 626 */ + meta_OTM, /* Otomedius (Arcade) */ + meta_CSTM, /* Nintendo 3DS CSTM (Century Stream) */ + meta_FSTM, /* Nintendo Wii U FSTM (caFe? Stream) */ + meta_IDSP_NAMCO, + meta_KT_WIIBGM, /* Koei Tecmo WiiBGM */ + meta_KTSS, /* Koei Tecmo Nintendo Stream (KNS) */ + meta_MCA, /* Capcom MCA "MADP" */ + meta_XB3D_ADX, /* Xenoblade Chronicles 3D ADX */ + meta_HCA, /* CRI HCA */ + meta_SVAG_SNK, + meta_PS2_VDS_VDM, /* Graffiti Kingdom */ + meta_FFMPEG, + meta_FFMPEG_faulty, + meta_CXS, + meta_AKB, + meta_PASX, + meta_XMA_RIFF, + meta_ASTB, + meta_WWISE_RIFF, /* Audiokinetic Wwise RIFF/RIFX */ + meta_UBI_RAKI, /* Ubisoft RAKI header (Rayman Legends, Just Dance 2017) */ + meta_SXD, /* Sony SXD (Gravity Rush, Freedom Wars PSV) */ + meta_OGL, /* Shin'en Wii/WiiU (Jett Rocket (Wii), FAST Racing NEO (WiiU)) */ + meta_MC3, /* Paradigm games (T3 PS2, MX Rider PS2, MI: Operation Surma PS2) */ + meta_GHS, + meta_AAC_TRIACE, + meta_MTA2, + meta_NGC_ULW, /* Burnout 1 (GC only) */ + meta_XA_XA30, + meta_XA_04SW, + meta_TXTH, /* generic text header */ + meta_SK_AUD, /* Silicon Knights .AUD (Eternal Darkness GC) */ + meta_AHX, + meta_STM, /* Angel Studios/Rockstar San Diego Games */ + meta_BINK, /* RAD Game Tools BINK audio/video */ + meta_EA_SNU, /* Electronic Arts SNU (Dead Space) */ + meta_AWC, /* Rockstar AWC (GTA5, RDR) */ + meta_OPUS, /* Nintendo Opus [Lego City Undercover (Switch)] */ + meta_RAW_AL, + meta_PC_AST, /* Dead Rising (PC) */ + meta_NAAC, /* Namco AAC (3DS) */ + meta_UBI_SB, /* Ubisoft banks */ + meta_EZW, /* EZ2DJ (Arcade) EZWAV */ + meta_VXN, /* Gameloft mobile games */ + meta_EA_SNR_SNS, /* Electronic Arts SNR+SNS (Burnout Paradise) */ + meta_EA_SPS, /* Electronic Arts SPS (Burnout Crash) */ + meta_VID1, + meta_PC_FLX, /* Ultima IX PC */ + meta_MOGG, /* Harmonix Music Systems MOGG Vorbis */ + meta_OGG_VORBIS, /* Ogg Vorbis */ + meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */ + meta_OPUS_SLI, /* Ogg Opus file w/ companion .sli for looping */ + meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */ + meta_OGG_KOVS, /* Ogg Vorbis with header and encryption (Koei Tecmo Games) */ + meta_OGG_encrypted, /* Ogg Vorbis with encryption */ + meta_KMA9, /* Koei Tecmo [Nobunaga no Yabou - Souzou (Vita)] */ + meta_XWC, /* Starbreeze games */ + meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */ + meta_SQEX_MAB, /* Square-Enix newest middleware (music) */ + meta_WAF, /* KID WAF [Ever 17 (PC)] */ + meta_WAVE, /* EngineBlack games [Mighty Switch Force! (3DS)] */ + meta_WAVE_segmented, /* EngineBlack games, segmented [Shantae and the Pirate's Curse (PC)] */ + meta_SMV, /* Cho Aniki Zero (PSP) */ + meta_NXAP, /* Nex Entertainment games [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */ + meta_EA_WVE_AU00, /* Electronic Arts PS movies [Future Cop - L.A.P.D. (PS), Supercross 2000 (PS)] */ + meta_EA_WVE_AD10, /* Electronic Arts PS movies [Wing Commander 3/4 (PS)] */ + meta_STHD, /* STHD .stx [Kakuto Chojin (Xbox)] */ + meta_MP4, /* MP4/AAC */ + meta_PCM_SRE, /* .PCM+SRE [Viewtiful Joe (PS2)] */ + meta_DSP_MCADPCM, /* Skyrim (Switch) */ + meta_UBI_LYN, /* Ubisoft LyN engine [The Adventures of Tintin (multi)] */ + meta_MSB_MSH, /* sfx companion of MIH+MIB */ + meta_TXTP, /* generic text playlist */ + meta_SMC_SMH, /* Wangan Midnight (System 246) */ + meta_PPST, /* PPST [Parappa the Rapper (PSP)] */ + meta_SPS_N1, + meta_UBI_BAO, /* Ubisoft BAO */ + meta_DSP_SWITCH_AUDIO, /* Gal Gun 2 (Switch) */ + meta_H4M, /* Hudson HVQM4 video [Resident Evil 0 (GC), Tales of Symphonia (GC)] */ + meta_ASF, /* Argonaut ASF [Croc 2 (PC)] */ + meta_XMD, /* Konami XMD [Silent Hill 4 (Xbox), Castlevania: Curse of Darkness (Xbox)] */ + meta_CKS, /* Cricket Audio stream [Part Time UFO (Android), Mega Man 1-6 (Android)] */ + meta_CKB, /* Cricket Audio bank [Fire Emblem Heroes (Android), Mega Man 1-6 (Android)] */ + meta_WV6, /* Gorilla Systems PC games */ + meta_WAVEBATCH, /* Firebrand Games */ + meta_HD3_BD3, /* Sony PS3 bank */ + meta_BNK_SONY, /* Sony Scream Tool bank */ + meta_SSCF, + meta_DSP_VAG, /* Penny-Punching Princess (Switch) sfx */ + meta_DSP_ITL, /* Charinko Hero (GC) */ + meta_A2M, /* Scooby-Doo! Unmasked (PS2) */ + meta_AHV, /* Headhunter (PS2) */ + meta_MSV, + meta_SDF, + meta_SVG, /* Hunter - The Reckoning - Wayward (PS2) */ + meta_VIS, /* AirForce Delta Strike (PS2) */ + meta_VAI, /* Ratatouille (GC) */ + meta_AIF_ASOBO, /* Ratatouille (PC) */ + meta_AO, /* Cloudphobia (PC) */ + meta_APC, /* MegaRace 3 (PC) */ + meta_WV2, /* Slave Zero (PC) */ + meta_XAU_KONAMI, /* Yu-Gi-Oh - The Dawn of Destiny (Xbox) */ + meta_DERF, /* Stupid Invaders (PC) */ + meta_SADF, + meta_UTK, + meta_NXA, + meta_ADPCM_CAPCOM, + meta_UE4OPUS, + meta_XWMA, + meta_VA3, /* DDR Supernova 2 AC */ + meta_XOPUS, + meta_VS_SQUARE, + meta_NWAV, + meta_XPCM, + meta_MSF_TAMASOFT, + meta_XPS_DAT, + meta_ZSND, + meta_DSP_ADPY, + meta_DSP_ADPX, + meta_OGG_OPUS, + meta_IMC, + meta_GIN, + meta_DSF, + meta_208, + meta_DSP_DS2, + meta_MUS_VC, + meta_STRM_ABYLIGHT, + meta_MSF_KONAMI, + meta_XWMA_KONAMI, + meta_9TAV, + meta_BWAV, + meta_RAD, + meta_SMACKER, + meta_MZRT, + meta_XAVS, + meta_PSF, + meta_DSP_ITL_i, + meta_IMA, + meta_XWV_VALVE, + meta_UBI_HX, + meta_BMP_KONAMI, + meta_ISB, + meta_XSSB, + meta_XMA_UE3, + meta_FWSE, + meta_FDA, + meta_TGC, + meta_KWB, + meta_LRMD, + meta_WWISE_FX, + meta_DIVA, + meta_IMUSE, + meta_KTSR, + meta_KAT, + meta_PCM_SUCCESS, + meta_ADP_KONAMI, + meta_SDRH, + meta_WADY, + meta_DSP_SQEX, + meta_DSP_WIIVOICE, + meta_SBK, + meta_DSP_WIIADPCM, + meta_DSP_CWAC, + meta_COMPRESSWAVE, + meta_KTAC, + meta_MJB_MJH, + meta_BSNF, + meta_TAC, + meta_IDSP_TOSE, + meta_DSP_KWA, + meta_OGV_3RDEYE, + meta_PIFF_TPCM, + meta_WXD_WXH, + meta_BNK_RELIC, + meta_XSH_XSD_XSS, + meta_PSB, + meta_LOPU_FB, + meta_LPCM_FB, + meta_WBK, + meta_WBK_NSLB, + meta_DSP_APEX, + meta_MPEG, + meta_SSPF, + meta_S3V, + meta_ESF, + meta_ADM3, + meta_TT_AD, + meta_SNDZ, + meta_VAB, + meta_BIGRP, + +} meta_t; + +#endif From b4ad96fcffd424de01c66d2b2e5eff0e1107836d Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 7 May 2023 23:47:37 +0200 Subject: [PATCH 8/8] cleanup: move stuff --- src/api.h | 128 +++++++++++++++++++++++++++++++ src/libvgmstream.vcxproj | 1 + src/libvgmstream.vcxproj.filters | 3 + src/plugins.h | 119 +--------------------------- 4 files changed, 133 insertions(+), 118 deletions(-) create mode 100644 src/api.h diff --git a/src/api.h b/src/api.h new file mode 100644 index 00000000..b9a9f69d --- /dev/null +++ b/src/api.h @@ -0,0 +1,128 @@ +//possible future public/opaque API +#ifndef _API_H_ +#define _API_H_ +#if 0 + +#include +#include "api_streamfile.h" + +/* Current API version (major=breaking API/ABI changes, minor=compatible ABI changes). + * Internal bug fixes or added formats don't change these (see commit revision). + * Regular vgmstream features or formats are stable and are rarely removed, while this API may change from time to time */ +#define LIBVGMSTREAM_API_VERSION_MAJOR 0 +#define LIBVGMSTREAM_API_VERSION_MINOR 0 + +/* define standard C param call and name mangling (to avoid __stdcall / .defs) */ +//#define LIBVGMSTREAM_CALL __cdecl //needed? + +/* define external function types (during compilation) */ +//LIBVGMSTREAM_API void LIBVGMSTREAM_CALL vgmstream_function(void); +#if defined(LIBVGMSTREAM_EXPORT) + #define LIBVGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */ +#elif defined(LIBVGMSTREAM_IMPORT) + #define LIBVGMSTREAM_API __declspec(dllimport) /* when importing/linking vgmstream DLL */ +#else + #define LIBVGMSTREAM_API /* nothing, internal/default */ +#endif + +/* opaque vgmstream context/handle */ +typedef struct libvgmstream_t libvgmstream_t; + +/* init base vgmstream context */ +libvgmstream_t* libvgmstream_init(void); + +typedef struct { + int downmix_max_channels; // max number of channels + //int upmix_min_channels; // adds channels until min +} libvgmstream_config_t; + +/* pass default config, that will be applied to song on open (some formats like TXTP may override + * these settings). + * May only be called without song loaded (before _open or after _close), otherwise ignored. */ +void libvgmstream_setup(libvgmstream_t* vctx, libvgmstream_config_t* vcfg); + +//void libvgmstream_buffer(libvgmstream_t* vctx, int samples, int max_samples); + +/* Opens a new STREAMFILE to play. Returns < 0 on error when the file isn't recogniced. + * If file has subsongs, first open usually loads first subsong. get_info then can be used to check + * whether file has more subsongs (total_subsongs > 1), and call others. + * */ +int libvgmstream_open(libvgmstream_t* vctx, STREAMFILE* sf); +int libvgmstream_open_subsong(libvgmstream_t* vctx, STREAMFILE* sf, int subsong); + +typedef struct { + const int channels; + const int sample_rate; + + const int sample_count; /* file's samples (not final duration) */ + const int loop_start_sample; + const int loop_end_sample; + const int loop_flag; + + const int current_subsong; /* 0=not set, N=loaded subsong N */ + const int total_subsongs; /* 0=format has no subsongs, N=has N subsongs */ + const int file_bitrate; /* file's average bitrate */ + //const int codec_bitrate; /* codec's average bitrate */ + + /* descriptions */ + //const char* codec; + //const char* layout; + //const char* metadata; + + //int type; /* 0=pcm16, 1=float32, always interleaved: [0]=ch0, [1]=ch1 ... */ +} libvgmstream_into_t; + +/* Get info from current song. */ +void libvgmstream_t_get_info(libvgmstream_t* vctx, libvgmstream_into_t* vinfo); + + +libvgmstream_sbuf_t* libgstream_get_sbuf(libvgmstream_t* vctx); + +/* Converts samples. returns number of rendered samples, or <=0 if no more + * samples left (will fill buffer with silence) */ +int libvgmstream_play(libvgmstream_t* vctx); + + + +/* Gets final time based on config and current song. If config is set to "play forever" + * this still returns final time based on config as a reference. Returns > 0 on success. */ +int32_t libvgmstream_get_total_time(libvgmstream_t* vctx); +double libvgmstream_get_total_samples(libvgmstream_t* vctx); + + +/* Gets current position within song. When "play forever" is set, it'll clamp results to total_time. */ +int32_t libvgmstream_get_current_time(libvgmstream_t* vctx); +double libvgmstream_get_current_samples(libvgmstream_t* vctx); + + +/* Seeks to position */ +libvgmstream_t* libvgmstream_seek_absolute_sample(libvgmstream_t* vctx, int32_t sample); +libvgmstream_t* libvgmstream_seek_absolute_time(libvgmstream_t* vctx, double time); +libvgmstream_t* libvgmstream_seek_current_sample(libvgmstream_t* vctx, int32_t sample); +libvgmstream_t* libvgmstream_seek_current_time(libvgmstream_t* vctx, double time); + + +/* Closes current song. */ +void libvgmstream_close(libvgmstream_t* vctx); + +/* Frees vgmstream context. */ +void libvgmstream_free(libvgmstream_t* vctx); + +#if 0 +void vgmstream_get_buffer(...); + +void vgmstream_format_check(...); +void vgmstream_set_format_whilelist(...); +void vgmstream_set_format_blacklist(...); + +const char* vgmstream_describe(...); + +const char* vgmstream_get_title(...); + +VGMSTREAM_TAGS* vgmstream_get_tagfile(...); +#endif + + + +#endif +#endif diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 62eb143c..19bf7900 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -80,6 +80,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 9dea499e..c89f2c33 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -65,6 +65,9 @@ + + Header Files + Header Files diff --git a/src/plugins.h b/src/plugins.h index e63c4aa9..b160e8d5 100644 --- a/src/plugins.h +++ b/src/plugins.h @@ -5,24 +5,7 @@ #define _PLUGINS_H_ #include "streamfile.h" -//todo rename to api.h once public enough - - -#if 0 -/* define standard C param call and name mangling (to avoid __stdcall / .defs) */ -//#define VGMSTREAM_CALL __cdecl //needed? - -/* define external function types (during compilation) */ -#if defined(VGMSTREAM_EXPORT) - #define VGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */ -#elif defined(VGMSTREAM_IMPORT) - #define VGMSTREAM_API __declspec(dllimport) /* when importing/linking vgmstream DLL */ -#else - #define VGMSTREAM_API /* nothing, internal/default */ -#endif - -//VGMSTREAM_API void VGMSTREAM_CALL vgmstream_function(void); -#endif +#include "vgmstream.h" /* ****************************************** */ @@ -88,106 +71,6 @@ void vgmstream_set_log_callback(int level, void* callback); void vgmstream_set_log_stdout(int level); -#if 0 -//possible future public/opaque API - -/* opaque player state */ -//#define VGMSTREAM_CTX_VERSION 1 -typedef struct VGMSTREAM_CTX VGMSTREAM_CTX; - - -/* Setups base vgmstream player context. */ -VGMSTREAM_CTX* vgmstream_init_ctx(void); - - -/* Sets default config, that will be applied to song on open (some formats like TXTP may override - * these settings). - * May only be called without song loaded (before _open or after _close), otherwise ignored. */ -void vgmstream_set_config(VGMSTREAM_CTX* vctx, VGMSTREAM_CFG* vcfg); - -void vgmstream_set_buffer(VGMSTREAM_CTX* vctx, int samples, int max_samples); - -/* Opens a new STREAMFILE to play. Returns < 0 on error when the file isn't recogniced. - * If file has subsongs, first open usually loads first subsong. get_info then can be used to check - * whether file has more subsongs (total_subsongs > 1), and call others. - * */ -int vgmstream_open(STREAMFILE* sf); -int vgmstream_open_subsong(STREAMFILE* sf, int subsong); - -typedef struct { - const int channels; - const int sample_rate; - - const int sample_count; /* file's samples (not final duration) */ - const int loop_start_sample; - const int loop_end_sample; - const int loop_flag; - - const int current_subsong; /* 0=not set, N=loaded subsong N */ - const int total_subsongs; /* 0=format has no subsongs, N=has N subsongs */ - const int file_bitrate; /* file's average bitrate */ - //const int codec_bitrate; /* codec's average bitrate */ - - /* descriptions */ - //const char* codec; - //const char* layout; - //const char* metadata; - - //int type; /* 0=pcm16, 1=float32, always interleaved: [0]=ch0, [1]=ch1 ... */ -} VGMSTREAM_INFO; - -/* Get info from current song. */ -void vgmstream_ctx_get_info(VGMSTREAM_CTX* vctx, VGMSTREAM_INFO* vinfo); - - -/* Gets final time based on config and current song. If config is set to "play forever" - * this still returns final time based on config as a reference. Returns > 0 on success. */ -int32_t vgmstream_get_total_time(VGMSTREAM_CTX* vctx); -double vgmstream_get_total_samples(VGMSTREAM_CTX* vctx); - - -/* Gets current position within song. When "play forever" is set, it'll clamp results to total_time. */ -int32_t vgmstream_get_current_time(VGMSTREAM_CTX* vctx); -double vgmstream_get_current_samples(VGMSTREAM_CTX* vctx); - - -/* Seeks to position */ -VGMSTREAM_CTX* vgmstream_seek_absolute_sample(VGMSTREAM_CTX* vctx, int32_t sample); -VGMSTREAM_CTX* vgmstream_seek_absolute_time(VGMSTREAM_CTX* vctx, double time); -VGMSTREAM_CTX* vgmstream_seek_current_sample(VGMSTREAM_CTX* vctx, int32_t sample); -VGMSTREAM_CTX* vgmstream_seek_current_time(VGMSTREAM_CTX* vctx, double time); - - -/* Closes current song. */ -void vgmstream_close(VGMSTREAM_CTX* vctx); - -/* Frees vgmstream context. */ -void vgmstream_free_ctx(VGMSTREAM_CTX* vctx); - - -/* Converts samples. returns number of rendered samples, or <=0 if no more - * samples left (will fill buffer with silence) */ -int vgmstream_play(VGMSTREAM_CTX* vctx); - - -#if 0 -void vgmstream_get_buffer(...); - -void vgmstream_format_check(...); -void vgmstream_set_format_whilelist(...); -void vgmstream_set_format_blacklist(...); - -const char* vgmstream_describe(...); - -const char* vgmstream_get_title(...); - -VGMSTREAM_TAGS* vgmstream_get_tagfile(...); -#endif - -#endif - - - /* ****************************************** */ /* TAGS: loads key=val tags from a file */ /* ****************************************** */