diff --git a/ext_includes/maiatrac3plus.h b/ext_includes/maiatrac3plus.h new file mode 100644 index 00000000..26ac668f --- /dev/null +++ b/ext_includes/maiatrac3plus.h @@ -0,0 +1,28 @@ +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the MAIATRAC3PLUS_EXPORTS +// symbol defined on the command line. This symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// MAIATRAC3PLUS_API functions as being imported from a DLL, whereas this DLL sees symbols +// defined with this macro as being exported. + +#ifdef _WIN32 +#ifdef MAIATRAC3PLUS_EXPORTS +#define MAIATRAC3PLUS_API __declspec(dllexport) +#else +#define MAIATRAC3PLUS_API __declspec(dllimport) +#endif +#else +#define MAIATRAC3PLUS_API +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +MAIATRAC3PLUS_API void* Atrac3plusDecoder_openContext(); +MAIATRAC3PLUS_API int Atrac3plusDecoder_closeContext(void* context); +MAIATRAC3PLUS_API int Atrac3plusDecoder_decodeFrame(void* context, void* inbuf, int inbytes, int* channels, void** outbuf); + +#ifdef __cplusplus +} +#endif diff --git a/ext_libs/at3plusdecoder.def b/ext_libs/at3plusdecoder.def new file mode 100644 index 00000000..ad21cb1b --- /dev/null +++ b/ext_libs/at3plusdecoder.def @@ -0,0 +1,5 @@ +LIBRARY at3plusdecoder.dll +EXPORTS + Atrac3plusDecoder_openContext @1 + Atrac3plusDecoder_closeContext @2 + Atrac3plusDecoder_decodeFrame @3 diff --git a/ext_libs/at3plusdecoder.dll b/ext_libs/at3plusdecoder.dll new file mode 100644 index 00000000..2251113c Binary files /dev/null and b/ext_libs/at3plusdecoder.dll differ diff --git a/ext_libs/ext_libs.vcxproj b/ext_libs/ext_libs.vcxproj index 75fbcd3e..3ce6da42 100644 --- a/ext_libs/ext_libs.vcxproj +++ b/ext_libs/ext_libs.vcxproj @@ -50,6 +50,14 @@ + + Building library stub + lib /def:at3plusdecoder.def /machine:x86 + at3plusdecoder.lib;at3plusdecoder.exp;%(Outputs) + Building library stub + lib /def:at3plusdecoder.def /machine:x86 + at3plusdecoder.lib;at3plusdecoder.exp;%(Outputs) + Building library stub lib /def:libmpg123-0.def /machine:x86 diff --git a/fb2k/foo_input_vgmstream.vcxproj b/fb2k/foo_input_vgmstream.vcxproj index 98cb0454..d724555e 100644 --- a/fb2k/foo_input_vgmstream.vcxproj +++ b/fb2k/foo_input_vgmstream.vcxproj @@ -68,7 +68,7 @@ Disabled ../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) + WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -78,7 +78,7 @@ EditAndContinue - ../ext_libs/libg7221_decode.lib;../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;%(AdditionalDependencies) + ../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies) %(AdditionalLibraryDirectories) %(DelayLoadDLLs) true @@ -93,7 +93,7 @@ ../ext_includes;..\..\foobar\foobar2000\SDK;..\..\foobar\foobar2000\helpers;..\..\foobar\foobar2000\ATLHelpers;..\..\foobar\foobar2000\shared;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) + WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions) MultiThreaded @@ -103,7 +103,7 @@ NoExtensions - ../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;%(AdditionalDependencies) + ../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies) %(AdditionalLibraryDirectories) %(IgnoreSpecificDefaultLibraries) %(DelayLoadDLLs) diff --git a/fb2k/in_vgmstream.cpp b/fb2k/in_vgmstream.cpp index 6f54d544..4faef338 100644 --- a/fb2k/in_vgmstream.cpp +++ b/fb2k/in_vgmstream.cpp @@ -288,6 +288,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension if(!stricmp_utf8(p_extension,"ast")) return 1; if(!stricmp_utf8(p_extension,"asr")) return 1; if(!stricmp_utf8(p_extension,"ass")) return 1; + if(!stricmp_utf8(p_extension,"at3")) return 1; if(!stricmp_utf8(p_extension,"aud")) return 1; if(!stricmp_utf8(p_extension,"aus")) return 1; diff --git a/src/coding/at3_decoder.c b/src/coding/at3_decoder.c new file mode 100644 index 00000000..e4c09422 --- /dev/null +++ b/src/coding/at3_decoder.c @@ -0,0 +1,28 @@ +#include "../vgmstream.h" + +#ifdef VGM_USE_MAIATRAC3PLUS +#include "maiatrac3plus.h" +#include "coding.h" +#include "../util.h" + +void decode_at3(VGMSTREAM * vgmstream, + sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) { + VGMSTREAMCHANNEL *ch = &vgmstream->ch[0]; + maiatrac3plus_codec_data *data = vgmstream->codec_data; + int i; + + if ((0 == vgmstream->samples_into_block || data->samples_discard == vgmstream->samples_into_block) && 0 == channel) + { + uint8_t code_buffer[0x8000]; + vgmstream->ch[channel].streamfile->read(ch->streamfile, code_buffer, ch->offset, vgmstream->interleave_block_size * vgmstream->channels); + Atrac3plusDecoder_decodeFrame(data->handle, code_buffer, vgmstream->interleave_block_size * vgmstream->channels, &data->channels, (void**)&data->buffer); + data->samples_discard = 0; + } + + for (i = 0; i < samples_to_do; i++) + { + outbuf[i*channelspacing] = data->buffer[(vgmstream->samples_into_block+i)*data->channels+channel]; + } +} + +#endif diff --git a/src/coding/coding.h b/src/coding/coding.h index d779ffdf..eb49785d 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -96,6 +96,11 @@ void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); #endif +#ifdef VGM_USE_MAIATRAC3PLUS +void decode_at3(VGMSTREAM *vgmstream, + sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); +#endif + void decode_acm(ACMStream * acm, sample * outbuf, int32_t samples_to_do, int channelspacing); diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 2daadc4a..60c00f7a 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -56,7 +56,7 @@ Disabled ../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -70,7 +70,7 @@ ../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreaded @@ -93,6 +93,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 3a31a0ad..f52edb16 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1,950 +1,953 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {07c49d19-cbf2-4e9f-b45d-d8a087f7926b} - - - {4d311953-abb4-4e92-adcb-bcad28c13312} - - - {f3158382-6a38-463f-aaba-1a1618a18868} - - - {4367a8fa-d09f-489d-86b3-ab8fa707e5b2} - - - {8c0f574c-7490-47c3-aa37-ba7d30ad8e72} - - - {e273dc50-87c5-4d9b-8c71-773a369f00c5} - - - {54878363-4abe-444e-aa77-4757e09edb4d} - - - {f05d3f7e-37a3-4373-b1bf-b952af37854c} - - - {e729b7b3-e13c-4cf9-9ded-428c209b6f62} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - meta\Header Files - - - coding\Header Files - - - coding\Header Files - - - coding\Header Files - - - coding\Header Files - - - layout\Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - coding\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - layout\Source Files - - - layout\Source Files - - - layout\Source Files - - - coding\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - coding\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - layout\Source Files - - - meta\Source Files - - - meta\Source Files - - - meta\Source Files - - - coding\Source Files - - - meta\Source Files - - + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {07c49d19-cbf2-4e9f-b45d-d8a087f7926b} + + + {4d311953-abb4-4e92-adcb-bcad28c13312} + + + {f3158382-6a38-463f-aaba-1a1618a18868} + + + {4367a8fa-d09f-489d-86b3-ab8fa707e5b2} + + + {8c0f574c-7490-47c3-aa37-ba7d30ad8e72} + + + {e273dc50-87c5-4d9b-8c71-773a369f00c5} + + + {54878363-4abe-444e-aa77-4757e09edb4d} + + + {f05d3f7e-37a3-4373-b1bf-b952af37854c} + + + {e729b7b3-e13c-4cf9-9ded-428c209b6f62} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + meta\Header Files + + + coding\Header Files + + + coding\Header Files + + + coding\Header Files + + + coding\Header Files + + + layout\Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + coding\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + layout\Source Files + + + layout\Source Files + + + layout\Source Files + + + coding\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + coding\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + layout\Source Files + + + meta\Source Files + + + meta\Source Files + + + meta\Source Files + + + coding\Source Files + + + meta\Source Files + + + coding\Source Files + + \ No newline at end of file diff --git a/src/meta/riff.c b/src/meta/riff.c index 4b3a48a4..379f412e 100644 --- a/src/meta/riff.c +++ b/src/meta/riff.c @@ -165,6 +165,21 @@ int read_fmt(int big_endian, fmt->coding_type = coding_NGC_DSP; fmt->interleave = 8; break; +#ifdef VGM_USE_MAIATRAC3PLUS + case 0xFFFE: /* WAVEFORMATEXTENSIBLE */ + if (read_32bit(current_chunk+0x20,streamFile) == 0xE923AABF && + read_16bit(current_chunk+0x24,streamFile) == (int16_t)0xCB58 && + read_16bit(current_chunk+0x26,streamFile) == 0x4471 && + read_32bitLE(current_chunk+0x28,streamFile) == 0xFAFF19A1 && + read_32bitLE(current_chunk+0x2C,streamFile) == 0x62CEE401) { + uint16_t bztmp = read_16bit(current_chunk+0x32,streamFile); + bztmp = (bztmp >> 8) | (bztmp << 8); + fmt->coding_type = coding_AT3; + fmt->block_size = (bztmp & 0x3FF) * 8 + 8; + fmt->interleave = 0; + } + break; +#endif default: goto fail; } @@ -208,7 +223,11 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) { /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("wav",filename_extension(filename)) && - strcasecmp("lwav",filename_extension(filename))) + strcasecmp("lwav",filename_extension(filename)) +#ifdef VGM_USE_MAIATRAC3PLUS + && strcasecmp("at3",filename_extension(filename)) +#endif + ) { if (!strcasecmp("mwv",filename_extension(filename))) mwv = 1; @@ -341,6 +360,11 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) { break; case coding_NGC_DSP: break; +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: + sample_count = (data_size / fmt.block_size) * 2048 * fmt.channel_count; + break; +#endif default: goto fail; } @@ -384,11 +408,25 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) { // override interleave_block_size with frame size vgmstream->interleave_block_size = fmt.block_size; break; +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: + vgmstream->interleave_block_size = fmt.block_size / fmt.channel_count; +#endif default: // use interleave from above break; } +#ifdef VGM_USE_MAIATRAC3PLUS + if (fmt.coding_type == coding_AT3) { + maiatrac3plus_codec_data *data = malloc(sizeof(maiatrac3plus_codec_data)); + data->buffer = 0; + data->samples_discard = 0; + data->handle = Atrac3plusDecoder_openContext(); + vgmstream->codec_data = data; + } +#endif + if (loop_flag) { if (loop_start_ms >= 0) { diff --git a/src/vgmstream.c b/src/vgmstream.c index a2a2c52f..a8ccd893 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -453,6 +453,16 @@ void reset_vgmstream(VGMSTREAM * vgmstream) { } #endif +#ifdef VGM_USE_MAIATRAC3PLUS + if (vgmstream->coding_type==coding_AT3) { + maiatrac3plus_codec_data *data = vgmstream->codec_data; + + if (data->handle) Atrac3plusDecoder_closeContext(data->handle); + data->handle = Atrac3plusDecoder_openContext(); + data->samples_discard = 0; + } +#endif + if (vgmstream->coding_type==coding_ACM) { mus_acm_codec_data *data = vgmstream->codec_data; int i; @@ -642,6 +652,18 @@ void close_vgmstream(VGMSTREAM * vgmstream) { } #endif +#ifdef VGM_USE_MAIATRAC3PLUS + if (vgmstream->coding_type == coding_AT3) { + maiatrac3plus_codec_data *data = vgmstream->codec_data; + + if (data) + { + if (data->handle) Atrac3plusDecoder_closeContext(data->handle); + free(data); + } + } +#endif + if (vgmstream->coding_type==coding_ACM) { mus_acm_codec_data *data = vgmstream->codec_data; @@ -952,6 +974,10 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) { #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) case coding_MP4_AAC: return ((mp4_aac_codec_data*)vgmstream->codec_data)->samples_per_frame; +#endif +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: + return 2048 - ((maiatrac3plus_codec_data*)vgmstream->codec_data)->samples_discard; #endif default: return 0; @@ -1047,6 +1073,9 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) { #ifdef VGM_USE_G7221 case coding_G7221C: case coding_G7221: +#endif +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: #endif case coding_MSADPCM: case coding_MTAF: @@ -1433,6 +1462,17 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to chan); } break; +#endif +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: + for (chan=0;chanchannels;chan++) { + decode_at3(vgmstream, + buffer+samples_written*vgmstream->channels+chan, + vgmstream->channels, + samples_to_do, + chan); + } + break; #endif case coding_ACM: /* handled in its own layout, here to quiet compiler */ @@ -1592,6 +1632,17 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { data->samples_discard = vgmstream->loop_sample; } #endif +#ifdef VGM_USE_MAIATRAC3PLUS + if (vgmstream->coding_type==coding_AT3) { + int blocks_to_skip = vgmstream->loop_sample / 2048; + int samples_to_discard = vgmstream->loop_sample % 2048; + maiatrac3plus_codec_data *data = (maiatrac3plus_codec_data *)(vgmstream->codec_data); + vgmstream->loop_ch[0].offset = + vgmstream->loop_ch[0].channel_start_offset + + vgmstream->interleave_block_size * vgmstream->channels * blocks_to_skip; + data->samples_discard = samples_to_discard; + } +#endif #ifdef VGM_USE_MPEG /* won't work for fake MPEG */ if (vgmstream->layout_type==layout_mpeg) { @@ -1857,6 +1908,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case coding_G7221C: snprintf(temp,TEMPSIZE,"ITU G.722.1 annex C (Polycom Siren 14)"); break; +#endif +#ifdef VGM_USE_MAIATRAC3PLUS + case coding_AT3: + snprintf(temp,TEMPSIZE,"ATRAC3plus"); + break; #endif case coding_ACM: snprintf(temp,TEMPSIZE,"InterPlay ACM"); diff --git a/src/vgmstream.h b/src/vgmstream.h index a2aa707f..c03326e7 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -38,6 +38,10 @@ enum { PATH_LIMIT = 32768 }; #include #endif +#ifdef VGM_USE_MAIATRAC3PLUS +#include +#endif + #include "coding/acm_decoder.h" #include "coding/nwa_decoder.h" @@ -142,6 +146,10 @@ typedef enum { #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) coding_MP4_AAC, #endif + +#ifdef VGM_USE_MAIATRAC3PLUS + coding_AT3, +#endif } coding_t; /* The layout type specifies how the sound data is laid out in the file */ @@ -720,6 +728,15 @@ typedef struct { } g7221_codec_data; #endif +#ifdef VGM_USE_MAIATRAC3PLUS +typedef struct { + sample *buffer; + int channels; + int samples_discard; + void *handle; +} maiatrac3plus_codec_data; +#endif + /* with one file this is also used for just ACM */ typedef struct {