mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
Implemented ATRAC3plus support
This commit is contained in:
parent
bd4f5c4d50
commit
98e90f8a25
28
ext_includes/maiatrac3plus.h
Normal file
28
ext_includes/maiatrac3plus.h
Normal file
@ -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
|
5
ext_libs/at3plusdecoder.def
Normal file
5
ext_libs/at3plusdecoder.def
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
LIBRARY at3plusdecoder.dll
|
||||||
|
EXPORTS
|
||||||
|
Atrac3plusDecoder_openContext @1
|
||||||
|
Atrac3plusDecoder_closeContext @2
|
||||||
|
Atrac3plusDecoder_decodeFrame @3
|
BIN
ext_libs/at3plusdecoder.dll
Normal file
BIN
ext_libs/at3plusdecoder.dll
Normal file
Binary file not shown.
@ -50,6 +50,14 @@
|
|||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="at3plusdecoder.def">
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Building library stub</Message>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">lib /def:at3plusdecoder.def /machine:x86</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">at3plusdecoder.lib;at3plusdecoder.exp;%(Outputs)</Outputs>
|
||||||
|
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Building library stub</Message>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">lib /def:at3plusdecoder.def /machine:x86</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">at3plusdecoder.lib;at3plusdecoder.exp;%(Outputs)</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
<CustomBuild Include="libmpg123-0.def">
|
<CustomBuild Include="libmpg123-0.def">
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Building library stub</Message>
|
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Building library stub</Message>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">lib /def:libmpg123-0.def /machine:x86
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">lib /def:libmpg123-0.def /machine:x86
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>../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)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../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)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
@ -78,7 +78,7 @@
|
|||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>../ext_libs/libg7221_decode.lib;../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../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)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../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)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;NDEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
@ -103,7 +103,7 @@
|
|||||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg7221_decode.lib;../ext_libs/at3plusdecoder.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
|
@ -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,"ast")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"asr")) return 1;
|
if(!stricmp_utf8(p_extension,"asr")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"ass")) 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,"aud")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"aus")) return 1;
|
if(!stricmp_utf8(p_extension,"aus")) return 1;
|
||||||
|
|
||||||
|
28
src/coding/at3_decoder.c
Normal file
28
src/coding/at3_decoder.c
Normal file
@ -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
|
@ -96,6 +96,11 @@ void decode_g7221(VGMSTREAM *vgmstream,
|
|||||||
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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,
|
void decode_acm(ACMStream * acm, sample * outbuf,
|
||||||
int32_t samples_to_do, int channelspacing);
|
int32_t samples_to_do, int channelspacing);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;VGM_USE_G7221;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
@ -93,6 +93,7 @@
|
|||||||
<ClInclude Include="layout\layout.h" />
|
<ClInclude Include="layout\layout.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="coding\at3_decoder.c" />
|
||||||
<ClCompile Include="coding\lsf_decoder.c" />
|
<ClCompile Include="coding\lsf_decoder.c" />
|
||||||
<ClCompile Include="coding\mp4_aac_decoder.c" />
|
<ClCompile Include="coding\mp4_aac_decoder.c" />
|
||||||
<ClCompile Include="coding\mtaf_decoder.c" />
|
<ClCompile Include="coding\mtaf_decoder.c" />
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -165,6 +165,21 @@ int read_fmt(int big_endian,
|
|||||||
fmt->coding_type = coding_NGC_DSP;
|
fmt->coding_type = coding_NGC_DSP;
|
||||||
fmt->interleave = 8;
|
fmt->interleave = 8;
|
||||||
break;
|
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:
|
default:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -208,7 +223,11 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
|||||||
/* check extension, case insensitive */
|
/* check extension, case insensitive */
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
if (strcasecmp("wav",filename_extension(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)))
|
if (!strcasecmp("mwv",filename_extension(filename)))
|
||||||
mwv = 1;
|
mwv = 1;
|
||||||
@ -341,6 +360,11 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
|||||||
break;
|
break;
|
||||||
case coding_NGC_DSP:
|
case coding_NGC_DSP:
|
||||||
break;
|
break;
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
case coding_AT3:
|
||||||
|
sample_count = (data_size / fmt.block_size) * 2048 * fmt.channel_count;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -384,11 +408,25 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
|||||||
// override interleave_block_size with frame size
|
// override interleave_block_size with frame size
|
||||||
vgmstream->interleave_block_size = fmt.block_size;
|
vgmstream->interleave_block_size = fmt.block_size;
|
||||||
break;
|
break;
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
case coding_AT3:
|
||||||
|
vgmstream->interleave_block_size = fmt.block_size / fmt.channel_count;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
// use interleave from above
|
// use interleave from above
|
||||||
break;
|
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_flag) {
|
||||||
if (loop_start_ms >= 0)
|
if (loop_start_ms >= 0)
|
||||||
{
|
{
|
||||||
|
@ -453,6 +453,16 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (vgmstream->coding_type==coding_ACM) {
|
||||||
mus_acm_codec_data *data = vgmstream->codec_data;
|
mus_acm_codec_data *data = vgmstream->codec_data;
|
||||||
int i;
|
int i;
|
||||||
@ -642,6 +652,18 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (vgmstream->coding_type==coding_ACM) {
|
||||||
mus_acm_codec_data *data = vgmstream->codec_data;
|
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)
|
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
|
||||||
case coding_MP4_AAC:
|
case coding_MP4_AAC:
|
||||||
return ((mp4_aac_codec_data*)vgmstream->codec_data)->samples_per_frame;
|
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
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -1047,6 +1073,9 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
|||||||
#ifdef VGM_USE_G7221
|
#ifdef VGM_USE_G7221
|
||||||
case coding_G7221C:
|
case coding_G7221C:
|
||||||
case coding_G7221:
|
case coding_G7221:
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
case coding_AT3:
|
||||||
#endif
|
#endif
|
||||||
case coding_MSADPCM:
|
case coding_MSADPCM:
|
||||||
case coding_MTAF:
|
case coding_MTAF:
|
||||||
@ -1433,6 +1462,17 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
|||||||
chan);
|
chan);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
case coding_AT3:
|
||||||
|
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||||
|
decode_at3(vgmstream,
|
||||||
|
buffer+samples_written*vgmstream->channels+chan,
|
||||||
|
vgmstream->channels,
|
||||||
|
samples_to_do,
|
||||||
|
chan);
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case coding_ACM:
|
case coding_ACM:
|
||||||
/* handled in its own layout, here to quiet compiler */
|
/* 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;
|
data->samples_discard = vgmstream->loop_sample;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef VGM_USE_MPEG
|
||||||
/* won't work for fake MPEG */
|
/* won't work for fake MPEG */
|
||||||
if (vgmstream->layout_type==layout_mpeg) {
|
if (vgmstream->layout_type==layout_mpeg) {
|
||||||
@ -1857,6 +1908,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
case coding_G7221C:
|
case coding_G7221C:
|
||||||
snprintf(temp,TEMPSIZE,"ITU G.722.1 annex C (Polycom Siren 14)");
|
snprintf(temp,TEMPSIZE,"ITU G.722.1 annex C (Polycom Siren 14)");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
case coding_AT3:
|
||||||
|
snprintf(temp,TEMPSIZE,"ATRAC3plus");
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case coding_ACM:
|
case coding_ACM:
|
||||||
snprintf(temp,TEMPSIZE,"InterPlay ACM");
|
snprintf(temp,TEMPSIZE,"InterPlay ACM");
|
||||||
|
@ -38,6 +38,10 @@ enum { PATH_LIMIT = 32768 };
|
|||||||
#include <aacdecoder_lib.h>
|
#include <aacdecoder_lib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
#include <maiatrac3plus.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "coding/acm_decoder.h"
|
#include "coding/acm_decoder.h"
|
||||||
#include "coding/nwa_decoder.h"
|
#include "coding/nwa_decoder.h"
|
||||||
|
|
||||||
@ -142,6 +146,10 @@ typedef enum {
|
|||||||
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
|
#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC)
|
||||||
coding_MP4_AAC,
|
coding_MP4_AAC,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
|
coding_AT3,
|
||||||
|
#endif
|
||||||
} coding_t;
|
} coding_t;
|
||||||
|
|
||||||
/* The layout type specifies how the sound data is laid out in the file */
|
/* The layout type specifies how the sound data is laid out in the file */
|
||||||
@ -720,6 +728,15 @@ typedef struct {
|
|||||||
} g7221_codec_data;
|
} g7221_codec_data;
|
||||||
#endif
|
#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
|
/* with one file this is also used for just
|
||||||
ACM */
|
ACM */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user